rustup
rustup copied to clipboard
`rust-toolchain.toml`: support multiple channels, or rather support nightly AND stable version.
Problem
My team prefers cargo +nightly fmt for formatting over stable.
I have a different nightly installed locally than we have in CI, causing CI checks to fail. A solution would be to use rust-tooolchain.toml, alas we only want to use nightly for fmt.
Today rust-tooolchain.toml does not support this, but I would like it to be supported.
What do you think?
Proposed Solution
Bikeshedding syntax/overall idea:
[toolchain]
nightly = "2024-12-14"
stable = "1.87.0"
And then when I run cargo +nightly the "2024-12-14" version will be used. But for non-nightly commands "1.87.0" is used.
Notes
We can also omit either or, i.e. both:
[toolchain]
nightly = "2024-12-14"
and
[toolchain]
stable = "1.87.0"
are valid.
@rustbot transfer rustup
See also:
- https://github.com/rust-lang/rustup/issues/3546
Thanks for your report.
I believe the X problem here is that the current toolchain file mostly expresses an obligation (a "build dependency"), but some might want to use it to express a recommendation (a "dev dependency"), and it's not clear which is the case under what circumstances.
In this case it's even more peculiar: that particular nightly version is installed for formatting purposes only, so specifying "nightly" will never work, because "nightly" is a moving target, and actually I don't think anyone would want to pin their project to a moving target because that's not really pinning. The new rustup toolchain install command in v1.28+ has made this situation even clearer.
My conclusion is that this system might need a redesign to allow better expression of intent.