X0006 cargo-msrv¶
Rule: Every crate builds with the toolchain of its declared rust-version.
| Code | X0006 (stable, never reused) |
| Id | cargo-msrv |
| Category | build |
| Source | cargo (run as an executable) |
| Fix | by hand |
| Needs | cargo installed |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | warn |
the declared rust-version is built, so it stays true |
| big | deny |
the declared rust-version is built, so it stays true |
| ai | off | |
| embedded | off | |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Parameters¶
| Name | Type | Default | Meaning |
|---|---|---|---|
args |
list of strings | [] |
more arguments to cargo check (features, targets) |
Why¶
rust-version is a promise: the crate builds with that compiler. Without a build on it the promise breaks silently, through a new std API or a dependency that raised its own minimum. This lint runs cargo check with the toolchain of each crate's rust-version (the crates that share one are built together).
How to fix¶
Fix the code the compiler points at, or raise rust-version to the oldest compiler the code really builds with. A dependency that needs a newer compiler is pinned to an older version, or rust-version is raised.
The toolchain must be installed (rustup toolchain install 1.88 --profile minimal); without it the lint does not run and says so. rustup's auto-install is turned off for this build, so nothing is downloaded behind your back.
Configure¶
Allow one finding in the code with // spirit-level: allow(cargo-msrv) <reason> (waivers); the code works there too, as in [lints.X0006].