Skip to content
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

msrv-policy regression in 1.79.0-nightly (nightly-2024-04-21) #13815

Closed
charles-r-earp opened this issue Apr 28, 2024 · 5 comments
Closed

msrv-policy regression in 1.79.0-nightly (nightly-2024-04-21) #13815

charles-r-earp opened this issue Apr 28, 2024 · 5 comments
Labels
C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@charles-r-earp
Copy link
Contributor

Problem

Cargo no longer respects "package.rust-version" when generating a lockfile with -Zmsrv-policy.

1.78.0-nightly works correctly. The issue appears with nightly-2024-04-21 (80d5b60 2024-04-19).

Steps

Install 1.78.0-nightly, 1.79.0-nightly, 1.70.0:

rustup install nightly-2024-03-15 nightly-2024-04-21 1.70.0

Create a new package with manifest:

[package]
name = "msrv-issue"
version = "0.1.0"
edition = "2021"
rust-version = "1.70.0"
publish = false

[dependencies]
clap = "4"

Succeeds with 1.78.0-nightly:

cargo +nightly-2024-03-15 -Zmsrv-policy generate-lockfile # clap v4.4.18
cargo +1.70.0 check

Fails with 1.79.0-nightly:

cargo +nightly-2024-04-21 -Zmsrv-policy generate-lockfile # clap v4.5.4 (latest)
cargo +1.70.0 check

Error:

error: package `clap_builder v4.5.2` cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.70.0
Either upgrade to rustc 1.74 or newer, or use
cargo update -p clap_builder@4.5.2 --precise ver
where `ver` is the latest version of `clap_builder` supporting rustc 1.70.0

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.79.0-nightly (80d5b607d 2024-04-19)
release: 1.79.0-nightly
commit-hash: 80d5b607dde6ef97dfff4e23923822c01d2bb036
commit-date: 2024-04-19
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 22.4.0 (jammy) [64-bit]
@charles-r-earp charles-r-earp added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Apr 28, 2024
@weihanglo
Copy link
Member

Thanks for the report. This is expected behavior after the change in #13769, which prepares for the upcoming change in Edition 2024.

You should be able to use MSRV-aware resolver in the latest nightly with the following configuration (note that the config name and value are just placeholders for now):

$ cargo +nightly generate-lockfile -Zmsrv-policy --config "resolver.something-like-precedence='something-like-rust-version'"
    Updating crates.io index
     Locking 22 packages to latest Rust 1.70.0 compatible versions
      Adding clap v4.4.18 (latest: v4.5.4)
      Adding clap_builder v4.4.18 (latest: v4.5.2)
      Adding clap_lex v0.6.0 (latest: v0.7.0)
      Adding strsim v0.10.0 (latest: v0.11.1)

See the doc for more details.

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Apr 28, 2024
@compenguy
Copy link
Contributor

To be clear, this isn't even just about respecting rust-version in the Cargo.toml. If I set my rustup toolchain to 1.72 and use this Cargo.toml:

[package]
name = "msrv-resolve-cargo-platform"
version = "0.1.0"

[dependencies]
cargo_metadata = "0.14.2"

I get the following behavior:

$ cargo -V
cargo 1.72.1 (103a7ff2e 2023-08-15)
$ cargo update
    Updating crates.io index
$ cargo check
error: package `cargo-platform v0.1.8` cannot be built because it requires rustc 1.73 or newer, while the currently active rustc version is 1.72.1
Either upgrade to rustc 1.73 or newer, or use
cargo update -p cargo-platform@0.1.8 --precise ver
where `ver` is the latest version of `cargo-platform` supporting rustc 1.72.1

Basic development workflows are completely broken for people developing with non-latest compilers if the wrong component makes it into their dependency tree.

Yes, the msrv-aware resolver corrects this, but this requires mixed stable/nightly toolchains for development, and careful development workflows with complicated command arguments to ensure correct results.

@compenguy
Copy link
Contributor

Apologies - the failure I'm reporting looks similar, but is not new - this has apparently always been broken.

@weihanglo
Copy link
Member

@compenguy, Cargo cannot travel back and add msrv-aware resolver support for 1.72.1. You need to set package.rust-version = "1.72" and the nightly cargo generates a workable lockfile for you.

@weihanglo
Copy link
Member

Going to close this. The behavior of -Zmsrv-policy is unstable and subject to change until stabilization (targeting at Edition 2024). Let us know if there is any other bug in the implementation. Thank you all.

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants