6003 Commits

Author SHA1 Message Date
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
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
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
9ee41598e8 feat(resolver): Add default Edition2024 to resolver v3 2024-04-22 10:45:59 -05:00
Ed Page
d1f02476c2 fix(toml): Deprecate underscore fields 2024-04-18 16:15:34 -05:00
Ed Page
868662c480 test(toml): Show underscore field behavior 2024-04-18 14:57:12 -05:00
Ed Page
208d10d06d fix(toml): Switch the duplicate table warning to an unused key warning 2024-04-18 14:49:50 -05:00
Ed Page
265f93e913 test(toml): Be consistent on expected output formatting 2024-04-18 14:45:27 -05:00
Ed Page
d210644a1b test(toml): Switch from build to check for these bad_config 2024-04-18 14:40:04 -05:00
Ed Page
8520ec63b6 test(toml): Centralize underscore field tests 2024-04-18 14:38:05 -05:00
Ed Page
3fc52d53b1 test(toml): Make test names scale to more scenarios 2024-04-18 14:35:39 -05:00
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