5992 Commits

Author SHA1 Message Date
Ed Page
f1caef11c4 test: Move off of deprecated manifest fields 2024-04-18 14:11:31 -05: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
Scott Schafer
064184a2bb
feat(fix): Add features for unused deps on Edition 2024 2024-04-19 11:43:39 -06:00
Scott Schafer
87915e71fe
feat: Avoid creating implicit features on edition 2024 2024-04-19 11:43:38 -06:00
Scott Schafer
e2741019c2
feat: Add unused_optional_dependency lint 2024-04-19 11:42:25 -06:00
Scott Schafer
8d676dde40
feat(implicit_features): Show why lint was emiited 2024-04-19 11:41:28 -06:00
Scott Schafer
7aac7f875c
fix(implicit_features): Work with any dep table 2024-04-19 11:15:02 -06:00
Scott Schafer
9855e50dcd
refactor: Make implicit_features <= edition 2021 2024-04-19 11:03:05 -06:00
Scott Schafer
495f94e80e
refactor(implicit_features): Use lint description for title 2024-04-19 10:58:55 -06:00
Sebastian Thiel
07d2bd7517
reproduce failure when packaging a path-dependency inside a symlinked git repository (#13773) 2024-04-19 07:11:37 +02:00
bors
7e9c2ef30f Auto merge of #13775 - epage:incomplete-dep, r=weihanglo
fix(toml)!: Disallow source-less dependencies

### What does this PR try to resolve?

This is part of #13629 addressing “dependency without path, version, git, workspace specified”.

This turns deps like
```toml
foo = { optional = true }
```
from `version="*"` deps with a warning into errors. This breaking change was deemed acceptable because this behavior has been considered a bug from the beginning.
We have gotten little to no feedback about people wanting this behavior.

This improves our forwards-compatibility story as we can add new dependency sources and they won't be considered a wildcard registry dependency on older cargo.

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

I removed the `cargo_add` test because it is redundant.

We no longer get the “unused key” warnings because those warnings get deferred to after this error gets reported.

### Additional information
2024-04-18 22:02:05 +00:00
Ed Page
cf23e4b538 fix(toml)!: Disallow source-less dependencies
This is part of #13629

This turns deps like
```toml
foo = { optional = true }
```
from `version="*"` deps with a warning into errors.
This breaking change was deemed acceptable because this behavior has
been considered a bug from the beginning.
We have gotten little to no feedback about people wanting this behavior.

This improves our forwards-compatibility story as we can add new
dependency sources and they won't be considered a wildcard registry
dependency on older cargo.
2024-04-18 12:55:27 -05:00
Scott Schafer
20b3734b40
refactor: Improve lint tests 2024-04-18 11:13:15 -06:00
bors
39b8f1702e Auto merge of #13771 - epage:rust-version, r=weihanglo
fix(msrv): Error, rather than panic, on rust-version 'x'

### What does this PR try to resolve?

Fixes #13768

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

### Additional information
2024-04-18 01:52:33 +00:00
Arlo Siemsen
6207f93087 fix(credential): trim newlines in token from stdin for credential providers 2024-04-17 17:39:46 -05:00
Ed Page
3a2cc82789 test(msrv): Migrate most parse tests to unit tests 2024-04-17 16:47:29 -05:00
Ed Page
675d67d093 fix(msrv): Error, rather than panic, on rust-version 'x'
Fixes #13768
2024-04-17 15:10:18 -05:00
Ed Page
af9288f1b6 test(msrv): Show current parse behavior with X 2024-04-17 15:05:58 -05:00
Arlo Siemsen
a498391686 show buggy behavior of not trimming newlines in new credential process test 2024-04-17 12:50:32 -05:00
Ed Page
18a5940046 fix(msrv): Put MSRV-aware resolver behind a config
This is a part of #13540 which is a party of #9930.

The config is `resolver.something-like-precedence` with values:
- `something-like-maximum` (default)
- `something-like-rust-version`

This is punting on the actual config schema so we can implement
`package.resolver` and `edition = "2024"` support as we want the
MSRV-aware resolver available without `cargo_features`.
2024-04-17 12:35:14 -05:00
Ed Page
7af4bcf397 test(msrv): Show config on stable 2024-04-17 12:35:05 -05:00
Ed Page
34afc4f1ff test(msrv): Prep for config to be added 2024-04-17 11:44:02 -05:00
Ed Page
226b53ef31 test(resolver): Verify some more msrv cases 2024-04-17 11:35:18 -05:00
bors
852a31615d Auto merge of #13767 - epage:msrv-test, r=ehuss
test(msrv): Re-organize MSRV tests

### What does this PR try to resolve?

- Merge test cases
- Clarify names
- Focus on `cargo tree`, rather than `cargo check` (faster and more to
  what we are testing)

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

### Additional information
2024-04-17 15:32:37 +00:00
Ed Page
3a3dda38d9 test(msrv): Reorganize MSRV tests
- Merge test cases
- Clarify names
- Focus on `cargo tree`, rather than `cargo check` (faster and more to
  what we are testing)
2024-04-17 09:32:44 -05:00
Ed Page
d6643254b5 test(msrv): Show regular MSRV resolve case 2024-04-17 09:32:41 -05:00
Ed Page
04f84e461b test(msrv): Group bad rust-version tests 2024-04-17 09:32:36 -05:00
Ed Page
1d0c6ebd8f feat(install): Including Locking message
As we switch to MSRV-aware resolver, this will help users work out why
MSRV-aware resolving isn't helping them.

This will also make it more obvious if we breaking things when
developing the MSRV-aware resolver.
2024-04-16 13:35:25 -05:00
Ed Page
cbd9def9dc feat(fix): Migrate from project to package on Edition 2024 2024-04-15 13:33:28 -05:00
Ed Page
98298d4966 feat(fix): Report manifest migrations 2024-04-15 13:33:27 -05:00
Ed Page
d5606b2278 test(fix): Show current project/package behavior 2024-04-15 13:32:17 -05:00
Ed Page
2f4d3df54d fix(toml): Error on use of [project] on 2024 Edition 2024-04-15 13:32:17 -05:00
Ed Page
c9325c9bd9 refactor(toml): Move project tests next to each other 2024-04-15 13:32:17 -05:00
Ed Page
77f96f5c61 fix(toml): Simplify [project] warning 2024-04-15 13:32:17 -05:00
Ed Page
bec36fce99 fix(update): Remove locking message for --precise
We aren't locking to latest.
We could customize the message for precise but it seemed a bit
excessive.
2024-04-15 13:00:34 -05:00
Ed Page
e772fc93b4 feat(update): Include a Locking message 2024-04-15 12:36:36 -05:00
bors
9f8adffe2e Auto merge of #13754 - epage:resolve-type, r=weihanglo
feat(resolve): Tell the user the style of resovle done

### What does this PR try to resolve?

This is to help with https://github.com/rust-lang/cargo/issues/9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest compatible version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest compatible versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.

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

### Additional information
2024-04-15 17:49:32 +00:00
bors
624233b0ed Auto merge of #13659 - RalfJung:rustc-wrapper, r=ehuss
Make sure to also wrap the initial `-vV` invocation

Fixes https://github.com/rust-lang/cargo/issues/10885 and therefore helps unblock https://github.com/rust-lang/miri/issues/3422.

This ensures that the version info actually matches the compiler that will later be doing the builds.
2024-04-15 17:18:26 +00:00
David Tolnay
afea119dff
Recategorize cargo test's --doc flag under "Target Selection" 2024-04-14 19:11:02 -07:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Ed Page
2ff60a5fc2 test(resolve): Show minimal version output 2024-04-13 20:37:55 -05:00
bors
48eca1b164 Auto merge of #13750 - epage:death, r=weihanglo
test: Remove add/remove death tests

Seeing recent fialures on Windows
- #13748
- #13738
- #13740

and maybe more

The test was added in #12744.  It seems of limited utility because there are innumerable ways of adding new writes that aren't atomic and we can't test for them all.
Even this case, its limited.

See also https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Flaky.20test.3A.20.20-death.3A.3Akill_cargo_add_never_corrupts_cargo/near/432979594
2024-04-12 21:16:36 +00:00
Ed Page
30efa8d9c5 test: Remove add/remove death tests
Seeing recent fialures on Windows
- #13748
- #13738
- #13740

and maybe more

The test was added in #12744.  It seems of limited utility because there
are innumerable ways of adding new writes that aren't atomic and we
can't test for them all.
Even this case, its limited.

See also https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Flaky.20test.3A.20.20-death.3A.3Akill_cargo_add_never_corrupts_cargo/near/432979594
2024-04-12 16:06:15 -05:00
bors
7dc84a2d31 Auto merge of #13742 - epage:msrv-update, r=Muscraft
feat(cli): Add --ignore-rust-version to update/generate-lockfile

### What does this PR try to resolve?

This is part of #9930 and extends `--ignore-rust-version` to `cargo update` and `cargo generate-lockfile`

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

First commit sets up tests

### Additional information
2024-04-12 16:57:51 +00:00
bors
7ac5d58f36 Auto merge of #13735 - linyihai:package-no-match, r=epage
`cargo package -p no-exist` emitt  error when the -p `package` not found

### What does this PR try to resolve?

Fixes #13719

If `-p` is used, and the spec doesn't match any member, we emit an error  like `cargo publish -p` does.

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

The first commit add a test to show the issue, the next commit add the check logic to fix it.

### Additional information
2024-04-12 16:27:02 +00:00
Ralf Jung
8a7ba8f8d9 Also wrap the initial -vV invocation in the rustc_(workspace_)wrapper
Based on an earlier draft by oli-obk
2024-04-12 12:33:34 +02:00
Lin Yihai
decbadb36f fix: cargo package -p includes all packages if no match is found 2024-04-12 10:57:58 +08:00
Lin Yihai
ac7bf6eb19 test(package): cargo package -p doesnt-exist will package all packages in workspace 2024-04-12 10:57:35 +08:00