Repository navigation
docs(user-guide): Clarify that channels are not automatically updated - #5259
Marcono1234 wants to merge 1 commit into
Conversation
|
Welcome, and thank you for contributing to rustup! A reviewer will take a look at your PR, typically within a week or two. Please see the contribution instructions and our LLM policy for more information. |
| Forge]. `rustup` assists with installing different channels, keeping them | ||
| up-to-date, and easily switching between them. | ||
|
|
||
| After a release channel has been installed, `rustup` can be used to update the |
There was a problem hiding this comment.
I think maybe just changing rustup to rustup update is enough for clarification.
There was a problem hiding this comment.
Hmm, I think it would be useful to explicitly mention that channels are not updated automatically, and that the user has to run rustup update manually if they want to update the channel.
Otherwise even when replacing rustup with rustup update here, there might still be uncertainty. For example a user could assume an automatic update check happens every X weeks, but rustup update forces an update check.
Similar to how rustup self-update works, where rustup self update forces an update check.
| update the channel when new releases become available. Instead, | ||
| `rustup update` can be used to update to the latest release of that channel, | ||
| see the [Keeping Rust up to date] section for more information. | ||
|
|
There was a problem hiding this comment.
Yes, the presence of rustup on your filesystem does not mean there is some process in the background constantly checking for updates and automatically installing them when available. But this isn't desirable behavior or what (I think) most developers would expect anyway.
However, rustup update does exactly what (I believe) you are wanting. If you rustup toolchain install stable when Rust 1.100 is the stable release, and then run rustup update when 1.101 is released, you will get 1.101.
To keep your teams CI in sync, all you need to do is run rustup update prior to the build and you will all be on the same build.
There was a problem hiding this comment.
does not mean there is some process in the background constantly checking for updates and automatically installing them when available
It might rather be conceivable that similar to how for rust-toolchain.toml it already automatically installs a missing toolchain when invoking cargo ..., it might also perform an update check.
Either way I am not asking for that behavior here in this PR.
My main point is that the user should not have to guess what it means to "install stable / nightly"; the documentation should clearly state that it installs the latest version at that point of time, and then afterwards the user is responsible for updating it manually (through rustup update).
To keep your teams CI in sync, all you need to do is run
rustup updateprior to the build and you will all be on the same build.
Except this is not guaranteed? You only make sure that this way CI always uses the latest release. But
- locally on your developer machine you might by accident still run on an older version
- now CI might break when rebuilding the same commit, just because a new Rust version was released in the meantime1
- you have now split toolchain configuration into at least 2 places: the
rust-toolchain.tomland the CI workflow2
To clarify, I am not saying that fixing such issues is necessarily difficult or much work; maybe just running rustup update locally on your development machine is enough to solve it.
But it is a disruption nonetheless.
And for users who are looking into rust-toolchain.toml to pin to a certain Rust version (which the documentation explicitly mentions as one use case), I think the documentation should point out that channel = "stable" is in fact not actually pinning to a specific version but rather to whatever version CI has pre-installed / cached (if any).3
For example searching for channel = "stable" on GitHub shows multiple cases where a comment says "pin for local and CI", "pinned to stable so versions don't drift", "current stable", "latest stable", and none of this is guaranteed by rust-toolchain.toml itself. Either the comment is just wrong (?) or there is additional setup needed (both locally and for CI) such as rustup update you mentioned.
And especially with Dependabot and Renovate supporting rust-toolchain.toml, it is not that inconvenient anymore to specify an exact version instead of stable.
Footnotes
-
As mentioned in the doc changes, this might not be a problem in many setups, but it can be for nightly or for
build.warnings = "deny". ↩ -
Or in the worst case into "all CI workflows", because they all need to run
rustup updatenow before they can start. ↩ -
For example just compare the images on https://github.com/actions/runner-images (as of writing): macos-15: Rust 1.98.0, macos-15-arm64: Rust 1.100.0, xcode-27-arm64: Rust 1.99.1. I am not blaming GitHub here; my point is that relying on the pre-installed
stablecan make make troubleshooting quite cumbersome. ↩
There was a problem hiding this comment.
From my personal experience, if you are looking at using stable then you probably should not put the channel at all (so that beta can be used at the same time, actually this is encouraged by the toolchain teams IIRC)... and when using nightly you almost certainly want to put a particular nightly because nothing on nightly is stable enough for you to pin on "any nightly".
The nightly case has some clear exceptions e.g. for running nightly rustfmt or miri, but I think that'll just be ergonomics improvement and could be covered by something like #4636.
| > When collaborating with other people on a project or when running Continuous | ||
| > Integration on a separate machine this can lead to different Rust versions | ||
| > being used. This is usually not a problem though due to Rust's stability | ||
| > guarnatees (and its features such as [Editions] and [Cargo `rust-version`]).\ | ||
| > However, there are cases where mismatches between Rust versions can lead to | ||
| > unexpected build failures, for example when using nightly features or when | ||
| > running Continuous Integration with [`build.warnings = "deny"`]. |
There was a problem hiding this comment.
Now that we are at it, I'd advise against particularly locking unversioned channels in rust-toolchain.toml... Would that make sense?
There was a problem hiding this comment.
Personally I also think specifying an unversioned channel is problematic (though my Rust usage is limited mainly to public library development, so it might not apply to all use cases), but in the above mentioned forum discussion some users did not consider unversioned channels a problem for their use case.
That is why I tried to keep this here rather neutral (and only mention the cases where it is more likely a problem, nightly and build.warnings = "deny").
This PR tries to make it clearer that once a channel such as
stableornightlyhas been installed,rustupwill not automatically update it. Especially in the context ofrust-toolchain.tomlthis can be undesired in some use cases.See also my discussion Is
rust-toolchain.tomlwith non-versioned channel such asstablea code smell? on the Rust forum.I tried to keep the tone rather neutral, because multiple users mentioned in the forum discussion that specifying unversioned
stableornightlyinrust-toolchain.tomlcan be desired.Please let me know if you want anything changed, have suggestions for better wording, or also if you don't think this is needed or is not helpful.