Rustup installs required toolchain when cargo-completion called
Open
Nobody has claimed this yet.
bug
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
Verification
- I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue and found no duplicates.
- I am on the latest version of Rustup according to https://github.com/rust-lang/rustup/tags and am still able to reproduce my issue.
Problem
- Cargo has dynamic completions for shells.
- Rustup respects
rust-toolchain(.toml). - ☝🏻this is conflict
rustup default nightly; rustup uninstall stable;
echo "toolchain.channel = \"stable\"" > rust-toolchain.toml
CARGO_COMPLETE=fish cargo -
# then rustup installs stable toolchain :(
# my shell (fish) completion function: `source (CARGO_COMPLETE=fish cargo | psub)`
Steps
rustup default nightlyecho "toolchain.channel = \"not-yet-installed-toolchain\"" > rust-toolchain.tomlCARGO_COMPLETE=fish cargo -
Possible Solution(s)
My workaround:
source (CARGO_COMPLETE=fish RUSTUP_TOOLCHAIN="nightly" cargo +nightly | psub)
Notes
I suppose rustup should not respects overrides (rust-toolchain(.toml)) if called with non-empty env CARGO_COMPLETE.
Update (thanks, @djc): source (RUSTUP_AUTO_INSTALL=0 CARGO_COMPLETE=fish cargo | psub)
Rustup version
rustup 1.29.0 (28d1352db 2026-03-05)
Installed toolchains
nightly only
OS version
macOs 15.7.7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with rust-toolchain.toml, an uninstalled toolchain, and CARGO_COMPLETE=fish cargo -. Start by tracing how rustup handles toolchain overrides during cargo completion, including the RUSTUP_AUTO_INSTALL workaround. Done means completion works without installing the toolchain selected by rust-toolchain.toml.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fish, rust
- Domain
- cli, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100