Hint that a new Rust release may be available#4869
Conversation
| return Ok(()); | ||
| } | ||
|
|
||
| cfg.settings_file.with_mut(|s| { |
There was a problem hiding this comment.
I still think it might be harmful to write this in settings_file; I'd suggest if we were to write the timestamp to a file, it should be an individual one so that under XDG we can put it under ~/.local/state/rustup/ whereas the settings file should clearly be under ~/.config/rustup/.
cc @Cloud0310 for potential interaction/collaboration regarding XDG.
0679b12 to
f9a9d91
Compare
| let should_notify = !matches.quiet | ||
| && !matches!( | ||
| subcmd, | ||
| RustupSubcmd::Update { .. } | RustupSubcmd::Install { .. } | ||
| ); |
There was a problem hiding this comment.
I think we could just inline this into its usage site? Splitting the logic this way is confusing.
There was a problem hiding this comment.
Hmm, I thought it would be better to split this out so that the logic for deciding when to notify is explicit through a named binding, which possibly should be closer to its usage site.
Before correcting it, could you please give your thoughts on keeping it, but right before the usage site?
|
☔ The latest upstream changes (possibly #4912) made this pull request unmergeable. Please resolve the merge conflicts. |
Closes #4846.
After a rustup command completes (excluding proxy commands), rustup checks whether a new Rust release is available.
To avoid introducing any additional overhead, this feature does not communicate with the release server.
Instead, it checks whether the stable toolchain manifest date is more than six weeks old.
Since Rust follows a regular and predictable release cadence, this should provide a sufficiently accurate indication that a new release is available.
When an outdated stable toolchain is detected, rustup prints a hint suggesting that the user may update their stable toolchain; this hint is shown at most once per day.
Users who prefer not to receive these hints can opt out by setting the
RUSTUP_NO_RELEASE_HINTenvironment variable.I have run some benchmarks (100 iterations) for the
rustup showcommand and observed no significant slowdown (1.1x) when we do not show the hint.However, due to manifest parsing, there is a 1.4x slowdown when the hint is shown (once per day).
Feedback is appreciated on: