-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(resolver): Treat unset MSRV as compatible #13791
Conversation
We last tweaked this logic in rust-lang#13066. However, we noticed this was inconsistent with `cargo add` in automatically selecting version requirements. It looks like this is a revert of rust-lang#13066, taking us back to the behavior in rust-lang#12950. In rust-lang#12950 there was a concern about the proliferation of no-MSRV and whether we should de-prioritize those to make the chance of success more likely. There are no right answes here, only which wrong answer is ok enough. - Do we treat lack of rust version as `rust-version = "*"` as some people expect or do we try to be smart? - If a user adds or removes `rust-version`, how should that affect the priority? One piece of new information is that the RFC for this has us trying to fill the no-MSRV gap with `rust-version = some-value-representing-the-current-toolchain>`.
I wish we had taken better notes about what problems #13066 fixed. I remember feeling strongly about it at the time. Let me try and reconstructed through brute force. There are three categories of compatibility Incompatible (
The think about it differently:
Generated with https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5c0b44e43e2cac5b4f598c24e6eff132
|
One change from when we had that conversation is that we had a lot less clear of a picture of how to deal with not enough data to make good choices. Since then, the RFC evolved to include
I'll have to come back later to dig into this. I think the core of the problem is when there are at least 3 versions involved, rather than just 2. |
After dinner the problem became obvious, and a better design for the script also seems worth doing. The table has been updated. |
To summarize, when upgrading from an MSRV compatible to an unset MSRV, we are changing the behavior from "prefer MSRV compatible" to "prefer unset". The nuance comes in when dealing with what dependents can rely on working for version with an unset MSRV. Initially
However, over time, the user will upgrade their rust version far enough that they won't want a years-old version but one of those mysterious versions. It could be latest, who knows.
Another angle to this is if the dependency adds back in an MSRV.
From this analysis, I'm finding that I don't care enough about the differences between the two cases which leads me to preferring consistency with |
Seams convincing. |
☀️ Test successful - checks-actions |
I'm glad for the conclusion, but if you view this from the perspective of the crate author I think this wouldn't have been very hard to figure out: If a crate author publishes a new semver compatible version with an unset MSRV, do they want their users to switch to it? Or do they want people to keep using the older release forever? |
Update cargo 18 commits in 6087566b3fa73bfda29702632493e938b12d19e5..05364cb2f61a2c2b091e061c1f42b207dfb5f81f 2024-04-30 20:45:20 +0000 to 2024-05-03 16:48:59 +0000 - chore(deps): update msrv (3 versions) to v1.76 (rust-lang/cargo#13857) - Stabilize `-Zcheck-cfg` as always enabled (rust-lang/cargo#13571) - fix(lints): Prevent inheritance from bring exposed for published packages (rust-lang/cargo#13852) - refactor: remove unnecessary branch for link binary on macOS (rust-lang/cargo#13851) - perf(toml): Avoid inferring when targets are known (rust-lang/cargo#13849) - Update continuous-integration.md: Include CircleCI reference (rust-lang/cargo#13850) - chore(deps): update msrv (1 version) to v1.78 (rust-lang/cargo#13848) - Workaround copying file returning EAGAIN on ZFS on mac OS (rust-lang/cargo#13845) - Clean package perf improvements (rust-lang/cargo#13818) - fix(toml): Validate crates_types/proc-macro for bin like others (rust-lang/cargo#13841) - fix(toml): On 2024 Edition, disallow ignored `default-features` when inheriting (rust-lang/cargo#13839) - chore(ci): Ignore openssl deps (rust-lang/cargo#13840) - fix(lints): Remove ability to specify `-` in lint name (rust-lang/cargo#13837) - fix(resolver): Treat unset MSRV as compatible (rust-lang/cargo#13791) - fix(toml): Don't lose 'public' when inheriting a dep (rust-lang/cargo#13836) - chore(deps): update compatible (rust-lang/cargo#13834) - Error when unstable lints are specified but not enabled (rust-lang/cargo#13805) - fix(lint): Warn not Error on unsupported lint tool (rust-lang/cargo#13833) r? ghost Note: this includes the fix that was beta backported in rust-lang#124647
Update cargo 18 commits in 6087566b3fa73bfda29702632493e938b12d19e5..05364cb2f61a2c2b091e061c1f42b207dfb5f81f 2024-04-30 20:45:20 +0000 to 2024-05-03 16:48:59 +0000 - chore(deps): update msrv (3 versions) to v1.76 (rust-lang/cargo#13857) - Stabilize `-Zcheck-cfg` as always enabled (rust-lang/cargo#13571) - fix(lints): Prevent inheritance from bring exposed for published packages (rust-lang/cargo#13852) - refactor: remove unnecessary branch for link binary on macOS (rust-lang/cargo#13851) - perf(toml): Avoid inferring when targets are known (rust-lang/cargo#13849) - Update continuous-integration.md: Include CircleCI reference (rust-lang/cargo#13850) - chore(deps): update msrv (1 version) to v1.78 (rust-lang/cargo#13848) - Workaround copying file returning EAGAIN on ZFS on mac OS (rust-lang/cargo#13845) - Clean package perf improvements (rust-lang/cargo#13818) - fix(toml): Validate crates_types/proc-macro for bin like others (rust-lang/cargo#13841) - fix(toml): On 2024 Edition, disallow ignored `default-features` when inheriting (rust-lang/cargo#13839) - chore(ci): Ignore openssl deps (rust-lang/cargo#13840) - fix(lints): Remove ability to specify `-` in lint name (rust-lang/cargo#13837) - fix(resolver): Treat unset MSRV as compatible (rust-lang/cargo#13791) - fix(toml): Don't lose 'public' when inheriting a dep (rust-lang/cargo#13836) - chore(deps): update compatible (rust-lang/cargo#13834) - Error when unstable lints are specified but not enabled (rust-lang/cargo#13805) - fix(lint): Warn not Error on unsupported lint tool (rust-lang/cargo#13833) r? ghost Note: this includes the fix that was beta backported in rust-lang#124647
Update cargo 18 commits in 6087566b3fa73bfda29702632493e938b12d19e5..05364cb2f61a2c2b091e061c1f42b207dfb5f81f 2024-04-30 20:45:20 +0000 to 2024-05-03 16:48:59 +0000 - chore(deps): update msrv (3 versions) to v1.76 (rust-lang/cargo#13857) - Stabilize `-Zcheck-cfg` as always enabled (rust-lang/cargo#13571) - fix(lints): Prevent inheritance from bring exposed for published packages (rust-lang/cargo#13852) - refactor: remove unnecessary branch for link binary on macOS (rust-lang/cargo#13851) - perf(toml): Avoid inferring when targets are known (rust-lang/cargo#13849) - Update continuous-integration.md: Include CircleCI reference (rust-lang/cargo#13850) - chore(deps): update msrv (1 version) to v1.78 (rust-lang/cargo#13848) - Workaround copying file returning EAGAIN on ZFS on mac OS (rust-lang/cargo#13845) - Clean package perf improvements (rust-lang/cargo#13818) - fix(toml): Validate crates_types/proc-macro for bin like others (rust-lang/cargo#13841) - fix(toml): On 2024 Edition, disallow ignored `default-features` when inheriting (rust-lang/cargo#13839) - chore(ci): Ignore openssl deps (rust-lang/cargo#13840) - fix(lints): Remove ability to specify `-` in lint name (rust-lang/cargo#13837) - fix(resolver): Treat unset MSRV as compatible (rust-lang/cargo#13791) - fix(toml): Don't lose 'public' when inheriting a dep (rust-lang/cargo#13836) - chore(deps): update compatible (rust-lang/cargo#13834) - Error when unstable lints are specified but not enabled (rust-lang/cargo#13805) - fix(lint): Warn not Error on unsupported lint tool (rust-lang/cargo#13833) r? ghost Note: this includes the fix that was beta backported in #124647
What does this PR try to resolve?
Have the resolver treat no-MSRV as
rust-version = "*"
, likecargo add
does for version-requirement selectionHow should we test and review this PR?
We last tweaked this logic in #13066.
However, we noticed this was inconsistent with
cargo add
in automatically selecting version requirements.It looks like this is a revert of #13066, taking us back to the behavior in #12950.
In #12950 there was a concern about the proliferation of no-MSRV and whether we should de-prioritize those to make the chance of success more likely.
There are no right answes here, only which wrong answer is ok enough.
rust-version = "*"
as some people expect or do we try to be smart?rust-version
, how should that affect the priority?One piece of new information is that the RFC for this has us trying to fill the no-MSRV gap with
rust-version = some-value-representing-the-current-toolchain>
.See also #9930 (comment)
r? @Eh2406
Additional information