17326 Commits

Author SHA1 Message Date
bors
e91b58d252 Auto merge of #13794 - epage:workspace, r=weihanglo
docs(ref): Index differences between virtual / real manifests

### What does this PR try to resolve?

For a user to read the reference and to understand when each type of workspace might be right for them, they have to know to also read the section on Package Selection.

This reframes the section on needing to set `resolver = "2"` to being about differences when there isn't a root package and extends it to summarize a part of Package Selection, linking out to it. The hope is that this will make it all of the differences more discoverable without retreading too much of the same ground within Reference-style documentation.

Part of #13580

### How should we test and review this PR?

### Additional information

r? `@weihanglo`
2024-04-25 22:21:37 +00:00
Ed Page
5f5e0fc504 docs(ref): Index differences between virtual / real manifests
For a user to read the reference and to understand when each type of
workspace might be right for them, they have to know to also read the
section on Package Selection.

This reframes the section on needing to set `resolver = "2"` to being
about differences when there isn't a root package and extends it to
summarize a part of Package Selection, linking out to it.
The hope is that this will make it all of the differences more
discoverable without retreading too much of the same ground within
Reference-style documentation.

Part of #13580
2024-04-25 14:33:39 -05:00
Ed Page
50adf47c18 docs(ref): Add a caution about default-members with root package 2024-04-25 14:31:49 -05:00
Ed Page
2289026d70 docs(ref): Move default-members defalting to default-members
This also tweaks the wording to be clear that `default-members` always
apply in the workspace root, not just for virtual workspaces.
2024-04-25 14:31:27 -05:00
Ed Page
58415ff288 docs(ref): Clarify default-members and members relationship
The old statement that its a subset of `members` is incorrect because
some members can be inferred and not show up in `members`.

I tried to reword this to better convey the goal of what was being said
2024-04-25 14:27:37 -05:00
Ed Page
0b15bef075 docs(ref): Simplify default-members wording
This will make it easier to make future changes
2024-04-25 14:10:38 -05:00
Ed Page
6a213f792e docs(ref): Don't call out default-members is optional
Nothing else in the files does despite it all being optional and this
will be clearer in a follow up when I specify the defaults.
2024-04-25 14:09:26 -05:00
bors
cb1123f4f2 Auto merge of #13802 - weihanglo:refactor, r=epage
refactor(toml): extract dependency-to-source-id to function
2024-04-25 17:51:14 +00:00
Weihang Lo
d855cd634a
refactor(toml): remove unnecessary ? operators 2024-04-25 13:27:58 -04:00
Weihang Lo
7ed7612a79
refactor(toml): format arg captures 2024-04-25 13:27:58 -04:00
Weihang Lo
4b0fac9c05
refactor(toml): make match patterns explicit 2024-04-25 13:27:57 -04:00
Weihang Lo
cc7fcaf57c
refactor(toml): move git and patch conflict to separate match arm 2024-04-25 13:27:57 -04:00
Weihang Lo
3505b05792
refactor(toml): show name with underscore for readability 2024-04-25 13:27:57 -04:00
Weihang Lo
a5d2a1d3dc
refactor(toml): extract dependency-to-source-id to function 2024-04-25 13:27:57 -04:00
bors
93edfb9206 Auto merge of #13801 - Muscraft:add-lint-reason, r=epage
Add where lint was set

`rustc` and `clippy` both show why the lint was emitted and where the level was set the first time it was emitted for a package. We already showed why the list was being emitted but did not show where the lint level was set. This PR adds where the lint was set at.
2024-04-25 17:22:07 +00:00
Scott Schafer
dfc9bd2068
feat(lints): Add where lint level was set 2024-04-24 14:57:36 -06:00
Scott Schafer
d5bc35d844
refactor(lints): Keep workspace and package lints separate 2024-04-24 14:52:45 -06:00
Scott Schafer
2655b069c6
test(cargo-lints): Add a test for workspace inheritance 2024-04-24 14:48:48 -06:00
Scott Schafer
b83c0a4939
refactor(cargo-lints): Cleanup getting the level for a lint 2024-04-24 14:48:38 -06:00
bors
955503e1de Auto merge of #13800 - epage:u3, r=weihanglo
fix(toml): Don't double-warn when underscore is used in workspace dep

### What does this PR try to resolve?

This is prep for removing them in the 2024 Edition and is part of rust-lang/rust#123754 and #13629

Particularly, I wanted to make sure I didn't make things worse and in doing so found there was room for improvement.

### How should we test and review this PR?

### Additional information
2024-04-24 20:25:10 +00:00
bors
e3d42b6019 Auto merge of #13798 - epage:underscore, r=weihanglo
fix(toml): Be more forceful with underscore/dash redundancy

### What does this PR try to resolve?

This is prep for removing them in the 2024 Edition and is part of rust-lang/rust#123754 and #13629

During #13783, I had considered making the 2024 edition behavior a "unused key" warning.  However, the work and code mess to pipe the data through correctly handle the two fields in all cases didn't seem worth it (and a hard error might be better to help users transition).

### How should we test and review this PR?

### Additional information
2024-04-24 19:55:43 +00:00
Ed Page
751fd47d34 fix(toml): Don't double-warn when underscore is used in workspace dep 2024-04-24 14:22:23 -05:00
Ed Page
4cc82833bd test(toml): Show default_features warning for workspace dependencies 2024-04-24 13:51:31 -05:00
bors
52dae0c1f6 Auto merge of #13793 - ijackson:symlink, r=epage
Fix warning suppression for config.toml vs config compat symlinks

### What does this PR try to resolve?

Background: the cargo config file is being renamed from `.cargo/config` to `.cargo/config.toml`.  There's code in new cargo to look for both files (for compatibility), to issue a warning when onliy the old filename is found, and also to issue a warning if both files are found.  The warning suggests making a symlink if compatibility with old cargo is wanted.

An attempt was made to detect when both the old and new files exists, but one is a symlink to the other, but as reported in #13667, this code is not effective.  (It would work only if the symlink had the precise absolute pathname that cargo has decided to use for the lookup, which would be an unnatural way to make the link.)

Logically, the warning should appear when both files exist *but are different*.  That is the anomalous situation that will generate confusing behaviour.   By "different" we ought to mean "aren't the very same file".

That's what this MR implements, where possible.  On Unix, we use the information from stat(2).  That's not available on other platforms; on those, we arrange to also tolerate a symlink referring to precisely `config.toml` as a relative pathname, which is also fine, since by definition the target is then in the same directrory as `config`.

Fixes #13667.

### How should we test and review this PR?

I have interleaved the new tests with the commits that support them.  In each case, a functional commit is followed by a test which fails just beforehand.

(This can be observed by experimentally reordering the branch.)

I have also done ad-hoc testing.

### Additional information

I'm making the assumption that a symlink containing a relative path does something sane on Windows.  This assumption may be unwarranted.  If so, "Handle `config` -> `config.toml` (without full path)" needs to be dropped, and the test case needs to be `#[cfg(unix)]`.

But also, in this case, we should probably put some warnings in the stdlib docs!
2024-04-24 17:36:34 +00:00
bors
70fb498994 Auto merge of #13797 - Muscraft:cleanup-linting-system, r=epage
Cleanup linting system

There are a number of problems with the current linting system, most notably that lints could run without `-Zcargo-lints` being set. This PR fixes that issue and a few others that are low-hanging fruit.
2024-04-24 16:31:40 +00:00
Ian Jackson
2f16838385 config reading: use same_file for suppressing "both files" warning (fmt)
Apply deferred indentation changes.  Whitespace change only.
2024-04-24 15:28:09 +01:00
Ian Jackson
23440c0dcd config reading: use same_file for suppressing "both files" warning
This is 100% reliable on Unix, and better on Windows.

(In this commit I avoid reindenting things to make review easier; the
formatting will be fixed in the next commit.)

Fixes #13667
2024-04-24 15:28:08 +01:00
Ian Jackson
91f3e457ab Tests: Add test case for config.toml -> config 2024-04-24 11:45:58 +01:00
Ian Jackson
dcce00745d Tests: Add test case for config -> config.toml (relative) 2024-04-24 10:12:13 +01:00
Ian Jackson
13be0cfa8b Tests: Rename config symlink creation function
"symlink A to B" is confusing; it is ambiguous (at leaset to me)
whether it means A -> B or B -> A.

And I'm about to introduce a function that does the reverse,
and also one that makes a relative rather than full path link.

So rename this function.
2024-04-24 10:03:40 +01:00
bors
c939267591 Auto merge of #13790 - epage:install, r=weihanglo
fix(install): Don't respect MSRV for non-local installs

### What does this PR try to resolve?

This is part of #9930

### How should we test and review this PR?

### Additional information
2024-04-23 19:35:19 +00:00
Ed Page
dcbf2b5d32 fix(install): Don't respect MSRV for non-local installs
This is part of #9930
2024-04-23 14:17:10 -05:00
Ed Page
cd8d5f7c10 refactor(msrv): Simplify tracking of use of MSRV-aware resolver
The design for this stems from
- It being unclear what the initialization order would be
- Prematurely writing this for `Cargo.lock` version to leverage it and
  maybe to switch other MSRV-aware logic to
2024-04-23 14:15:59 -05:00
bors
125aa57ad2 Auto merge of #13782 - klensy:llibc, r=weihanglo
gate some libc usages under cfg(unix), drop os_info features

Places few `libc` usages under `cfg(unix)`. That didn't remove it from tree, but still looks cleaner.
Drop features from os_info crate, as serde support currently unused.
2024-04-23 17:32:32 +00:00
bors
b89b81a6c7 Auto merge of #13785 - epage:msrv-edition2024, r=weihanglo
feat(resolver): Add default Edition2024 to resolver v3

### What does this PR try to resolve?

With #13776 done, we can now make MSRV-aware resolver the default for the new edition as part of #9930

### How should we test and review this PR?

### Additional information
2024-04-23 02:27:06 +00:00
bors
11d5b73b29 Auto merge of #13789 - cuviper:test-offline, r=weihanglo
Fix 2 tests for offline execution

In `alt_registry::warn_for_unused_fields`, the second part of the test
runs on `--registry crates-io`, so it needs a local replacement url.

In `install::install_global_cargo_config`, it was adding to the "config"
file, but the `pkg` before it configured the dummy registry replacement
in "config.toml". So that replacement wasn't actually used, and if you
ran tests online it was trying to install `bar v0.1.1` from the real
registry! The filename is now fixed, and the test double-checks that
we're only trying to install the local `bar v0.0.1`.
2024-04-23 01:57:56 +00:00
Josh Stone
6dda4e006b Fix 2 tests for offline execution
In `alt_registry::warn_for_unused_fields`, the second part of the test
runs on `--registry crates-io`, so it needs a local replacement url.

In `install::install_global_cargo_config`, it was adding to the "config"
file, but the `pkg` before it configured the dummy registry replacement
in "config.toml". So that replacement wasn't actually used, and if you
ran tests online it was trying to install `bar v0.1.1` from the real
registry! The filename is now fixed, and the test double-checks that
we're only trying to install the local `bar v0.0.1`.
2024-04-22 16:19:17 -07:00
Ed Page
034ef3c27b fix(toml): Be more forceful with underscore/dash redundancy
During #13783, I had considered making the 2024 edition behavior a
"unused key" warning.  However, I'm being too lazy in piping the data
through correctly (and a hard error might be better to help users
transition).
2024-04-22 12:47:43 -05:00
bors
d29ad6788a Auto merge of #13783 - epage:underscore, r=ehuss
fix(toml): Report `_` fied variants (e.g. `dev_dependencies`) as deprecated

### What does this PR try to resolve?

This is prep for removing them in the 2024 Edition and is part of rust-lang/rust#123754 and #13629

This doesn't include 2024 Edition work because there is a risk of conflict with other work going on these areas.

This changes us from
- When using `-` and `_` variants: deprecated, will error some time
- Otherwise, nothing

To
- When using `-` and `_` variants: unused field warning
- When using only `_`: deprecation, will be removed in 2024

I decided to model this as an unused field warning because that is what this is and that is how any other use of `_` works.  We might hard error during a transition period but I'd eventually want these to just make the code act like anything else in the end.

### How should we test and review this PR?

### Additional information
2024-04-22 16:25:06 +00:00
Ed Page
9ee41598e8 feat(resolver): Add default Edition2024 to resolver v3 2024-04-22 10:45:59 -05:00
Ed Page
706f8a71c8 fix(msrv): Don't require -Zmsrv-policy for resolver=3
We still have `edition2024` guarding this.

Dealing with two feature flags to control behavior is messy.  We just
need to make sure both get stabilized :).
2024-04-22 10:45:19 -05:00
Scott Schafer
11d6013c1d
fix(cargo-lints): Respect Forbid lint level 2024-04-20 20:12:47 -06:00
Scott Schafer
2d40a475d9
feat: Add unstable im_a_teapot lint 2024-04-20 19:33:13 -06:00
Scott Schafer
00a64e4da3
fix: Only run lints when cargo-lints are enabled 2024-04-20 19:22:32 -06:00
Scott Schafer
b89864cc3b
fix: Allow should not get translated to Note 2024-04-20 16:31:04 -06:00
klensy
57e820e329 cargo-credential: bump version to 0.4.5
as required by check-version-bump CI
2024-04-20 10:38:49 +03:00
bors
14b46ecc62 Auto merge of #13776 - epage:msrv-resolver, r=weihanglo
feat(resolver): Add v3 resolver for MSRV-aware resolving

### What does this PR try to resolve?
This is a part of #9930 and is important for changing the default with the new edition.

### How should we test and review this PR?

### Additional information
2024-04-20 04:37:21 +00:00
Ed Page
d0528058a1 feat(resolver): Add v3 resolver for MSRV-aware resolving
This is a part of #9930 and is important for changing the default with
the new edition.
2024-04-19 20:02:31 -05:00
bors
02499abbe9 Auto merge of #13778 - Muscraft:unused-dependencies, r=epage
Unused dependencies cleanup

The implementation of #12826 was used as a demonstration for #12235, in #13621. The demonstration implementation was far from ideal and was lacking a few features. This PR makes the implementation "feature complete", and fixes known bugs with the initial implementation.
2024-04-19 21:28:56 +00:00
bors
80d5b607dd Auto merge of #13777 - Byron:fix-13773, r=weihanglo
fix 13773 - 'cargo build' fails when list_files() with gix is triggered

Fixes #13773.

### Tasks

* [x] reproduce issue with new test-case
* [x] update [fixed `gix-dir`](https://github.com/rust-lang/cargo/pull/13777) in Cargo.lock to turn test green
2024-04-19 18:39:22 +00:00