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

@FranciscoTGouveia FranciscoTGouveia commented May 24, 2026

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 with rustup set release-hint false.

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
- `RUSTUP_NO_BACKTRACE`. Disables backtraces on non-panic errors even when
`RUST_BACKTRACE` is set.

- `RUSTUP_RELEASE_HINT` (default: `1`). When set to `0`, suppresses the hint

@djc djc Jun 23, 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.

Do we have a strong reason to add this in addition to filesystem-based configuration? I am not a fan of the proliferation of environment variables that change rustup behavior.

View changes since the review

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.

@djc I don't think #4869 (comment) is considered "configuration" because it just notes the last timestamp the routine is run...

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.

I mean the overall disabling via the environment variable; that feels like it should be configuration rather than environment variable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Something like rustup set release-hint false?

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.

Yes.

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.

What duplication do you mean? Perhaps an inline comment would make this clearer?

@rami3l rami3l Jul 7, 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.

@FranciscoTGouveia Sorry, but may I ask what you meant by #4869 (comment)? Looking at this thread I am afraid that we haven't fully addressed all the concerns but please feel free to dismiss me if I missed something.

@FranciscoTGouveia FranciscoTGouveia Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Whilst changing the approach from an env var, I created a new ReleaseHintMode enum for the rustup set command. Such an enum is somewhat redundant, since we already have AutoInstallMode, which is basically the same, hence my "duplication" comment.

Apologies for not making this clearer from the start, @rami3l.
My idea was to, after this PR, send a simplification patch to address said duplication.

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.

What's the rationale for not just fixing it in this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My idea was to not elongate this PR further.

I have already fixed it and merged the ReleaseHintMode and AutoInstallMode.

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
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 3 times, most recently from 4400790 to b4a55d1 Compare July 2, 2026 17: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 Outdated
Comment thread src/cli/rustup_mode.rs Outdated
@FranciscoTGouveia

Copy link
Copy Markdown
Contributor Author

I believe all review comments are now addressed.
Should I update the initial PR message to reflect the changes done during the review process (i.e., using rustup set release-hint instead of an environment variable)?

@rami3l

rami3l commented Jul 7, 2026

Copy link
Copy Markdown
Member

@FranciscoTGouveia I think we can merge this first and see how it goes. Many thanks for making this patch :)

PS: I won't backport this patch to 1.29 yet to give it more confidence WRT stability; if we hit #4942 in the process I think it's safe to just remove the state file. The more important thing here is that @Cloud0310 has a new file to migrate for XDG.

@rami3l rami3l added this pull request to the merge queue Jul 7, 2026
@rami3l rami3l removed this pull request from the merge queue due to a manual request Jul 7, 2026
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