Skip to content

Hint that a new Rust release may be available#4869

Open
FranciscoTGouveia wants to merge 2 commits into
rust-lang:mainfrom
FranciscoTGouveia:new-rust-release
Open

Hint that a new Rust release may be available#4869
FranciscoTGouveia wants to merge 2 commits into
rust-lang:mainfrom
FranciscoTGouveia:new-rust-release

Conversation

@FranciscoTGouveia

Copy link
Copy Markdown
Contributor

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_HINT environment variable.

I have run some benchmarks (100 iterations) for the rustup show command 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:

  1. Whether this approach and its associated overhead are acceptable, or if we should take a different direction;
  2. Which rustup commands should display this hint;
  3. Whether relying on Rust’s regular release cadence, instead of contacting the release server, is acceptable;

Comment thread src/cli/common.rs Outdated
Comment thread src/cli/common.rs Outdated

@djc djc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo comments. Please squash the commits?

View changes since this review

Comment thread src/cli/rustup_mode.rs
@rustbot

This comment has been minimized.

@FranciscoTGouveia FranciscoTGouveia marked this pull request as ready for review June 22, 2026 16:14
Comment thread src/cli/common.rs Outdated
Comment thread doc/user-guide/src/environment-variables.md Outdated
Comment thread src/cli/common.rs Outdated
Comment thread src/cli/common.rs Outdated
Comment thread doc/user-guide/src/environment-variables.md Outdated
@FranciscoTGouveia FranciscoTGouveia force-pushed the new-rust-release branch 2 times, most recently from b64ea36 to 33eae97 Compare June 30, 2026 16:18
Comment thread src/state.rs Outdated
if !utils::is_file(&self.path) {
return Ok(State::default());
}
let content = utils::read_file("state", &self.path)?;

@rami3l rami3l Jun 30, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Pre-existing and not directly related to this new feature, but we might need to introduce File::lock*() in this pattern, otherwise this file risks getting corrupted and if that happens, rustup will get crazy.

This doesn't happen yet because the update of settings.toml is not automatic yet.

View changes since the review

Comment thread tests/suite/cli_self_upd.rs Outdated
Comment thread src/state.rs Outdated
Comment thread src/cli/common.rs Outdated
@rustbot

This comment has been minimized.

@FranciscoTGouveia FranciscoTGouveia force-pushed the new-rust-release branch 2 times, most recently from 52c7878 to 4400790 Compare July 1, 2026 21:23
@rustbot

rustbot commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread src/config.rs
#[cfg(unix)]
pub(crate) const UNIX_FALLBACK_SETTINGS: &str = "/etc/rustup/settings.toml";

/// Contrary to `settings.toml`, this file is not intended to be user-facing

@djc djc Jul 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: top-down style, this should go below Cfg.

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notify users when a new stable Rust release is available

4 participants