42 Commits

Author SHA1 Message Date
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05: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
9ee41598e8 feat(resolver): Add default Edition2024 to resolver v3 2024-04-22 10:45:59 -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
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
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
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
e772fc93b4 feat(update): Include a Locking message 2024-04-15 12:36:36 -05: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
38718eaa93 feat(resolve): Fallback to 'rustc -V' for MSRV resolving 2024-04-11 14:40:52 -05:00
Ed Page
a8e816b079 test(resolve): Show no-MSRV case 2024-04-11 14:36:50 -05:00
Ed Page
c7d89c64f1 feat(cli): Add --ignore-rust-version to update/generate-lockfile 2024-04-11 14:27:57 -05:00
Ed Page
c9de6eeeb2 test(resolve): Show update/generate-lockfile behavior 2024-04-11 14:18:10 -05:00
Ed Page
cd3d31b361 feat(reslve): Respect '--ignore-rust-version' 2024-04-11 12:56:53 -05:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
Ed Page
90a681dcb8 fix(msrv): Report all incompatible packages, not just a random one
In #9930, it recommended improving the error for incompatible packages
so people can better get to the root of the problem.
For example, you might get an error about `clap_lex` but resolving the
error for the higher level `clap` could make the problem with `clap_lex`
go away.

Because I generally saw earlier packages in the graph reported, I
assumed we were reporting these errors bottom up.
It turns out, we are reporting them in the `UnitGraph`s order, which is
non-deterministic because it is built on a `HashMap`.

So this adds determinism and shows all incompatible dependencies
(not just the bottom or the root).
This is a first step.
We might find that we still want to only include the shallowest units,
rather than all.
At that point, we can add the complexity to address this by walking the
unit graph.

We could also further improve this by querying the index to suggest
compatible versions of packages.
2024-03-01 12:28:41 -06:00
Ed Page
41449f771b test(msrv): Use variables 2024-03-01 12:13:38 -06:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Scott Schafer
0d62ae2fc3
feat: Add rustc style errors for manifest parsing 2023-12-15 13:30:10 -07:00
Ed Page
0d29d3f71b fix(resolver): Prefer MSRV, rather than ignore incompatible
This is another experiment for #9930.

Comparing preferring over exclusively using MSRV compatible:

Benefits
- Better error messages
- `--ignore-rust-version` is implicitly sticky

Downsides
- Can't backtrack for MSRV compatible version
- Still requires workspace-wide MSRV (compared to our desired end state of declaring MSRV as yet another dependency)

This builds on #12930
2023-11-14 14:56:58 -06:00
Ed Page
0bc5d22285 test(resolver): Verify backtracking for MSRV resolver 2023-11-14 14:56:53 -06:00
Ed Page
a78bba7a92 fix(manifest): Improve error on good pre-release 2023-08-30 16:42:08 -05:00
Ed Page
9fb8128d9e test(manifest): Verify error on good pre-release 2023-08-30 16:42:08 -05:00
Ed Page
4bf1af0cd0 fix(update): Make -p more convenient by being positional
Generally, cargo avoids positional arguments.  Mostly for the commands
that might forward arguments to another command, like `cargo test`.
It also allows some flexibility in turning flags into options.

For `cargo add` and `cargo remove`, we decided to accept positionals
because the motivations didn't seem to apply as much (similar to `cargo
install`).

This applies the pattern to `cargo update` as well which is in the same
category of commands as `cargo add` and `cargo remove`.

As for `--help` formatting, I'm mixed on whether `[SPEC]...` should be at the top like
other positionals or should be relegated to "Package selection".  I went
with the latter mostly to make it easier to visualize the less common
choice.

Switching to a positional for `cargo update` (while keeping `-p` for
backwards compatibility) was referenced in #12425.
2023-08-23 11:57:36 -05:00
Ed Page
4abd05ea44 test(resolver): Enable msrv-policy
This was kept separate to show that the prior commit didn't change
anything for stable users.
2023-08-25 14:19:22 -05:00
Ed Page
10196aaee3 test(resolver): Demonstrate existing behavior 2023-08-25 09:59:16 -05:00
Ed Page
1701b4e3d8 fix(manifest): Improve rust-version error messages
Since we have tests for a couple of cases, I figured we could
improve the error messages for them.
2023-08-24 20:29:14 -05:00
Ed Page
423a334520 refactor: Parse, don't validate, rust_version
By using the `PartialVersion` type with serde, we get the context for
the error automatically.
2023-08-24 14:15:35 -05:00
Scott Schafer
43f9b8ea83 chore: update rust_version tests to use check 2023-02-20 12:22:29 -06:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -06:00
Josh Triplett
934e79072a Only show advice to use cargo update --precise for non-local packages
Packages in the local workspace can't get updated this way; the user
just needs to point to a different source, or otherwise update the
package themselves.
2022-08-08 10:37:15 -07:00
Josh Triplett
dcbb433340 Make the rust-version error recommend cargo update -p crate@ver --precise ...
People encountering a dependency with a newer `rust-version` requirement
may not know about `cargo update --precise`, or may consider alternate
approaches that may be harmful (such as pinning with a `=` dependency).

Provide specific guidance in the error message.

If the user is using `cargo install`, suggest `cargo install --locked` instead.
2022-08-08 10:37:15 -07:00
Dirkjan Ochtman
d783456598 Stabilize rust-version 2021-08-02 13:38:58 +02:00
Dirkjan Ochtman
040d27f39d Don't try to parse MSRV if feature is not enabled 2021-01-30 23:14:30 +01:00
Dirkjan Ochtman
c221fec911 Implement support for rust-version field in project metadata 2021-01-20 11:40:41 +01:00