rust
install_error
ai_generated
true
error: the package `crate_name` requires rustc >= X.Y.Z, but the current rustc version is A.B.C
ID: rust/cargo-msrv-version-conflict
90%Fix Rate
89%Confidence
1Evidence
2024-03-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| rustc 1.70.0 | active | — | — | — |
| rustc 1.71.0 | active | — | — | — |
| rustc 1.72.0 | active | — | — | — |
| cargo 1.70.0 | active | — | — | — |
Root Cause
A dependency or the package itself specifies a minimum supported Rust version (MSRV) higher than the currently installed Rust compiler version, causing a build failure.
generic中文
依赖项或包本身指定的最低支持 Rust 版本(MSRV)高于当前安装的 Rust 编译器版本,导致构建失败。
Official Documentation
https://doc.rust-lang.org/cargo/reference/rust-version.htmlWorkarounds
-
95% success Update Rust to the required version using `rustup`: `rustup update stable` to get the latest stable, or `rustup install X.Y.Z && rustup default X.Y.Z` for a specific version.
Update Rust to the required version using `rustup`: `rustup update stable` to get the latest stable, or `rustup install X.Y.Z && rustup default X.Y.Z` for a specific version.
-
85% success If you cannot update Rust, find an older version of the dependency that supports your Rust version by specifying an exact version in `Cargo.toml`: `crate_name = "=1.2.3"` where `1.2.3` is known to work.
If you cannot update Rust, find an older version of the dependency that supports your Rust version by specifying an exact version in `Cargo.toml`: `crate_name = "=1.2.3"` where `1.2.3` is known to work.
-
75% success Use `cargo +nightly build` to temporarily use a nightly toolchain if the MSRV requirement is for stable, but note nightly may have other issues; better to use the specific required version.
Use `cargo +nightly build` to temporarily use a nightly toolchain if the MSRV requirement is for stable, but note nightly may have other issues; better to use the specific required version.
中文步骤
Update Rust to the required version using `rustup`: `rustup update stable` to get the latest stable, or `rustup install X.Y.Z && rustup default X.Y.Z` for a specific version.
If you cannot update Rust, find an older version of the dependency that supports your Rust version by specifying an exact version in `Cargo.toml`: `crate_name = "=1.2.3"` where `1.2.3` is known to work.
Use `cargo +nightly build` to temporarily use a nightly toolchain if the MSRV requirement is for stable, but note nightly may have other issues; better to use the specific required version.
Dead Ends
Common approaches that don't work:
-
90% fail
This only affects the local package's MSRV, not the dependency's MSRV; the error comes from the dependency's requirement, which is enforced by Cargo.
-
70% fail
If all compatible versions of the dependency have the same or higher MSRV, `cargo update` won't resolve the issue; it may even pull a version with an even higher MSRV.
-
80% fail
This is fragile, requires maintaining a fork, and may break if the dependency uses features only available in newer Rust versions.