Skip to content

fix(completions): account for +toolchain override in target completions - #5163

Open
14elias wants to merge 1 commit into
rust-lang:mainfrom
14elias:fix/toolchain-aware-target-completion
Open

14elias wants to merge 1 commit into
rust-lang:mainfrom
14elias:fix/toolchain-aware-target-completion

Conversation

@14elias

@14elias 14elias commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #5144

Currently, rustup target add always pulls targets from the first installed channel toolchain alphabetically, ignoring any +toolchain override passed on the command line.

This causes a couple of issues:

  • If you use a custom toolchain like rustup +stage1 target add , it still suggests targets even though custom toolchains don't have rustup-managed targets.
  • If you specify a toolchain like +nightly, it might end up suggesting targets from another installed toolchain instead of nightly.

This changes fixes this by resolving the toolchain in this order:

  1. Check if a +toolchain override was passed (if it's a custom toolchain, suggest nothing).
  2. If not, check the active toolchain for the directory/default.
  3. Fall back to the first installed toolchain if no active toolchain is set.

@14elias
14elias force-pushed the fix/toolchain-aware-target-completion branch from c7492bd to 54ab6c3 Compare October 24, 2026 20:34

This branch has not been deployed

No deployments
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.

Wrong completions when using the +toolchain syntax

1 participant