Skip to content

Show setup hint when rustup has no default toolchain#4912

Merged
rami3l merged 2 commits into
rust-lang:mainfrom
0xEgao:hint-for-no-toolchain
Jun 17, 2026
Merged

Show setup hint when rustup has no default toolchain#4912
rami3l merged 2 commits into
rust-lang:mainfrom
0xEgao:hint-for-no-toolchain

Conversation

@0xEgao

@0xEgao 0xEgao commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

It intends to fix #4901

This adds in rustup to print the default stable setup hint when a rustup command finishes in an empty setup state: no installed toolchains and no configured default toolchain.

The hint reuses DEFAULT_STABLE_HINT:

help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.

Changes:

  1. Extracted the default stable hint into DEFAULT_STABLE_HINT.
  2. Added RustupSubcmd::should_warn_empty_setup() to decide which rustup commands may show the empty setup warning.
  3. Added the warning after subcommand execution, so rustup checks the final state before printing the hint.
  4. Skipped the warning for DumpTestament, Self_, and Completion as those commands are not related to toolchain state.
  5. Updated CLI test expectations.

@0xEgao 0xEgao force-pushed the hint-for-no-toolchain branch from bcc19b9 to 8adcd9b Compare June 16, 2026 15:53

@rami3l rami3l left a comment

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.

Thanks a lot for the patch!

However I don't believe we can merge this patch as-is. I have added some review comments, please don't hesitate to tell me if you have any questions.

Many thanks in advance 🙏

View changes since this review

Comment thread src/cli/common.rs Outdated
Comment thread src/cli/common.rs Outdated
Comment thread src/cli/common.rs Outdated
Comment thread src/cli/common.rs Outdated
@0xEgao 0xEgao force-pushed the hint-for-no-toolchain branch from 8adcd9b to f0ad2cf Compare June 16, 2026 19:26
@0xEgao

0xEgao commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@rami3l Thanks for reviewing!!,
I have patched the changes and history as you suggested.

Happy to contribute :D

Comment thread src/cli/rustup_mode.rs Outdated
@rami3l rami3l self-assigned this Jun 16, 2026
@0xEgao 0xEgao requested a review from rami3l June 17, 2026 06:09
@0xEgao 0xEgao force-pushed the hint-for-no-toolchain branch 2 times, most recently from c8870df to e3c5a4d Compare June 17, 2026 09:38
Comment thread src/cli/rustup_mode.rs Outdated

@rami3l rami3l left a comment

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.

@0xEgao Thanks for the patch! I've left some small nits but looks pretty good overall :)

Also please don't forget to update the PR description to reflect the latest changes.

View changes since this review

@0xEgao 0xEgao force-pushed the hint-for-no-toolchain branch from e3c5a4d to 9743424 Compare June 17, 2026 09:56
@rami3l

rami3l commented Jun 17, 2026

Copy link
Copy Markdown
Member

update the PR description to reflect the latest changes.

@0xEgao LGTM :) Once you've done that I can merge it.

@0xEgao

0xEgao commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

update the PR description to reflect the latest changes.

@0xEgao LGTM :) Once you've done that I can merge it.

Done i have update the pr description
Happy to contribute :)

@rami3l rami3l enabled auto-merge June 17, 2026 10:06
@rami3l rami3l added this pull request to the merge queue Jun 17, 2026
Merged via the queue into rust-lang:main with commit f9282c9 Jun 17, 2026
29 checks passed
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.

Print special hints on rustup when rustup-init is skipped by the packager

2 participants