68 Commits

Author SHA1 Message Date
Scott Schafer
d36c326926
chore(deps): update rust crate annotate-snippets to 0.12.1 2025-09-02 15:43:38 -06:00
Ross Sullivan
30b6707135
chore: Moved remaining cargo_exe logic to testsuite 2025-06-25 23:18:08 +09:00
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Josh Stone
d97bf418d9 test(msrv): use a far future "newer" version
Two tests were using `.rust_version("1.90.0")` for a "newer" Rust, but
this failed in rust-lang/rust#142792 for the start of the *real* 1.90.0.
Let's bump that to 1.999.0 so we won't have to deal with it for a while.
2025-06-22 12:05:40 -07:00
Ed Page
81411ec545 feat: Stabilize Edition 2024 2024-11-25 09:27:09 -06:00
Ed Page
5306252c70 test(msrv): Workaround Edition 2024 stabilization
With 2024 stabilized, there will be a "first supported" version which is
above the versions used in tests.

In particular, for the `cargo install` test, we can't test the scenario
until a couple of versions have passed.
We have to rely on Edition 2024 changing ony resolver v3 which is
already covered.
2024-11-25 09:20:54 -06:00
Ed Page
7b58bd51c3 feat(resolver): Stabilize v3 resolver 2024-11-06 12:57:19 -06:00
Ed Page
51f634b3bd test: Remove unused msrv-policy
Missed this in #14639
2024-10-30 09:57:01 -05:00
Ed Page
487bbc813f test(install): Verify edition=2024 is ignored 2024-10-23 15:15:02 -05:00
Ed Page
49f096edaf test(install): Verify resolver=3 is ignored 2024-10-23 15:14:08 -05:00
Ed Page
0498e84f89 feat: Stabilize MSRV-aware resolver config
This includes
- `cargo generate-lockfile --ignore-rust-version`
- `cargo update --ignore-rust-version`

This does not include
- `edition = "2024"`
- `resolver = "3"`
2024-10-04 12:49:28 -05:00
Ed Page
94db932164 fix(resolve): Improve multi-MSRV workspaces
We do this by resolving for a package version that is compatible
with the most number of MSRVs within a workspace.

If a version requirement is just right, every package will get the
highest MSRV-compatible dependency.

If its too high, packages will get MSRV-incompatible dependency
versions.
This will happen regardless of what we do due to the nature of
`"fallback"`.

If its too low, packages with higher MSRVs will get older-than-necessary
dependency versions.
This is similar to the "some with and without MSRV" workspaces.
When locking dependencies, we do report to users when newer MSRV/SemVer
compatible dependencies are available to help guide them to upgrading if
desired.

Fixes #14414
2024-09-19 15:46:22 -05:00
Ed Page
64abeb2ba1 test(msrv): Show msrv resolver issue 2024-09-19 15:46:10 -05:00
Ed Page
892ad4148d test(msrv): Clarify the differences in deps 2024-09-19 15:44:11 -05:00
Ed Page
3a47885f4f test(msrv): Clarify role of deps 2024-09-19 15:29:05 -05:00
Ed Page
6b796471a0 test(msrv): Clarify version numbers 2024-09-19 15:26:14 -05:00
Ed Page
911f5e17b6 feat(resolve): Report MSRV compatible version instead of incomptible
This expands on #14461 to where only MSRV-compatible versions are
"actionable".  MSRV-incompatible versions are therefore unstyled.

We report the MSRV needed so people can choose to unblock by updating
their MSRV.  I had wondered if we should report the the absolute latest
MSRV-incompatible version or the one with the next higher MSRV from
where the user is at.  Both are reasonable use cases, so I erred with
absolute latest version.
2024-08-30 09:40:54 -05:00
Ed Page
ded3f004a4 fix(resolve): Generalize term describing updates
`latest` was easy.  `latest compatible` was ok.  But how do I talk about
"latest compatible with your MSRV".  That gets messy.
2024-08-30 09:26:56 -05:00
Ed Page
353cd87cea fix(resolve): With latest message, differentiate actionable updates
Instead of always listing the absolute latest version as a warning
color, we now differentiate
- compatible updates are always actionable
- incompatible, direct deps are always actionable

These get reported and made yellow while non-actionable messages are
unstyled.

This is not intended as *the* solution for #13908 though it makes
improvements in that direction.
This is prep work for improved MSRV reporting where we will
differentiate this further by only considering MSRV-compatible updates as actionable
(or rustc-compatible when not using MSRV-aware reslver).

I just used a broad stroke to say "compatible" in the message means "semver
compatible" and use `^`
- We could focus on "compatible with dependent version reqs" which is
  what will be most actionable but seeing if we can get away without
  having to track all in-coming version reqs.
- We could be more nuanced in language but the more verbose we are, the
  more we take away from higher priority messages
2024-08-27 13:40:03 -05:00
Ed Page
3c19a8cb7b feat(resolve): Report incompatible with rustc when MSRV-resolve disabled 2024-08-26 14:12:54 -05:00
Ed Page
437b73ceb3 fix(resolve): Report incompatible packages with precise Rust version
The nesting in `annotate_required_rust_version` might seem weird but its
for a follow up commit.
2024-08-23 16:38:07 -05:00
Ed Page
89cf552c06 test(resolve): Explicitly verify msrv report 2024-08-23 16:37:09 -05:00
Ed Page
d2ec764995 fix(resolve): Dont show locking workspace members
This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
2024-08-22 16:57:06 -05:00
Ed Page
428e1732f1 feat(update): Report when incompatible-rust-version packages are selected
In discussin this in #13873, it highlighted that we need to make sure we
tell people when we get in this state.

I decided to keep "latest" and "required rust version" messages mutually
exclusive to avoid too much noise.  I gave "required rust version"
higher precedence as its the more critical to operation and, if you are
using an MSRV-incompatible package, it likely is "latest" already.

I was tempted to change colors to make "required rust version" stand out
from "latest" but was unsure what direction to go, so I held off.
Options included
- red for "required rust version", yellow for "latest"
- yellow for "required rust version", nothing for "latest"

There is also more discussion on how to format "latest" at #13908.
2024-08-16 15:01:53 -05:00
Ed Page
8622918953 fix(config): Adjust MSRV resolve config field name / values
Fixes #13540
2024-07-31 15:27:01 -05:00
eth3lbert
8466aad641
test: migrate rust_version to snapbox 2024-07-02 07:14:00 +08:00
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