Allow cargo +rust-version build|test|...
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
Problem you are trying to solve
Now that rust-version is stable it makes sense to have a CI task/job that asserts this commitment. In that case, one would need to set up a CI config that runs tests on the selected Rust version. Usually, it means that the specific version will be specified twice
rust-versioninCargo.toml- Somewhere in CI configuration.
And they need to be in sync to make sense. This is where extra work is required and that may be avoided.
Solution you'd like
I suggest teaching cargo to understand the +rust-version parameter, alongside the +stable, +nightly, and friends. When specified it will cause cargo to use the Rust toolchain referenced in the rust-version parameter. (And installing it on demand as it does today when used with other +toolchain parameters).
If used for crates that lack rust-version parameter it will fall back to otherwise default toolchain configured for this crate.
As a result, the potential disagreement between CI and rust-version will be avoided completely, better usability, less time wasted, etc
Notes
This issue was originally opened as rust-lang/cargo#10012, but rustup is the right place to solve it
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing rustup's handling of +stable, +nightly, and other +toolchain parameters, then inspect how the requested rust-version value could be obtained from Cargo.toml. Determine the behavior for crates with and without rust-version, including on-demand installation, and verify the resulting toolchain selection across build and test commands.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100