Description
Based on RFC 2495 Rust now supports the rust-version
field, which currently works as:
If the currently selected version of the Rust compiler is older than the stated version, cargo will exit with an error, telling the user what version is require
This behavior is not ideal. If a project depends on crate foo v0.1.0
with MSRV 1.56, then releasing crate foo v0.1.1
with MSRV 1.60 will break build of the project on older toolchains after simple cargo update
. Ideally Cargo would select foo v0.1.0
on older tolchains, thus preventing the breakage.
RFC 2495 has described MSRV-dependent version resolution as a potential future extension. This issue is intended for design discussions and tracking implementation progress of this feature.
Third-party support
- Take
rust-version
into account when updating lock file / manifest dependabot/dependabot-core#5423 - Update cargo dependencies based on `rust-version` renovatebot/renovate#26060
This has been approved as RFC #3537.
Implementation by stabilization milestone
- Improve the
cargo install
error (fix(install): Suggest an alternative version on MSRV failure #12798) - Improve documentation around
rust-version
(docs: Provide pointers for MSRV #13056) - cargo-add (feat(add): Stabilize MSRV-aware version req selection #13608)
-
cargo add
support (cargo add
takespackage.rust-version
into account when no version-req is specified #10653) - Infer users rust-version from
rustc -V
(feat(add): Fallback torustc -v
when no MSRV is set #13516)
-
- Attempt to report the MSRV error top-down, rather than bottom up (fix(msrv): Report all incompatible packages, not just a random one #13514)
-
cargo update
keeps user informed when using old versions (feat(update): Tell users when they are still behind #13372) - Report newly held back dependencies on all commands #13539
- Resolver (feat: Stabilize MSRV-aware resolver config #14639, feat(resolver): Stabilize resolver v3 #14754)
- Prototype (feat(resolver): **Very** preliminary MSRV resolver support #12560)
- Switch resolver to "prefer" rather than "enforce" (fix(resolver): Prefer MSRV, rather than ignore incompatible #12950)
- De-prioritize dep versions without
rust-version
(fix(resolver): De-prioritize no-rust-version in MSRV resolver #13066) - Infer users rust-version from
rustc -V
(feat(resolve): Fallback to 'rustc -V' for MSRV resolving #13743) - Existing
--ignore-rust-version
support (feat(reslve): Respect '--ignore-rust-version' #13738) -
--ignore-rust-version
support forcargo update
/cargo-generate-lockfile
(feat(cli): Add --ignore-rust-version to update/generate-lockfile #13742) - Config support for controlling MSRV-aware resolver #13540
- Add resolver v3 (feat(resolver): Add v3 resolver for MSRV-aware resolving #13776)
- Verify resolver 3 doesn't change cargo-install (fix(msrv): Put MSRV-aware resolver behind a config #13769, fix(install): Don't respect MSRV for non-local installs #13790)
- Verify
cargo update --precise
can select incompatible versions (fix(msrv): Put MSRV-aware resolver behind a config #13769) - Enable resolver v3 with Edition 2024 (feat(resolver): Add default Edition2024 to resolver v3 #13785)
- fix(resolve): Improve multi-MSRV workspaces #14569
- test(install): Verify 2024 edition / resolver=3 doesn't affect resolution #14724
- Have lockfile format version respect
--ignore-rust-version
(see feat: respectrust-version
when generating lockfile #12861) -
--update-rust-version
supportcargo add
cargo update
cargo generate-lockfile
- Turn MSRV error into a lint (blocked on User control over cargo warnings #12235)
- "auto": Add field with cargo-publish behavior (see also Cargo should set "rust-version" for me #11451)
- Update
cargo new
template
Changes from RFC
Unresolved questions
cargo add
and the resolver have different behavior for unsetrust-version
, see fix(resolver): Treat unset MSRV as compatible #13791
Deferred
- Determination for what
cargo install
should do, see also Respectrust-version
when selecting a version forcargo install
#10903
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status