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.
There was a problem hiding this comment.
Agreed.
Is there anywhere I should look regarding the XDG paths in the code, or should I leave this refactoring (i.e., settings.toml -> XDG) until after the XDG patch lands?
Happy to collaborate with @Cloud0310 on this!
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?
There was a problem hiding this comment.
Moreover, I just realized that subcmd is consumed by the following match statement (i.e., let exit_code = match subcmd), so I can't use it afterward.
This comment has been minimized.
This comment has been minimized.
f9a9d91 to
bebc2bf
Compare
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: