I tried some older versions to do some testing and then uninstall it.
rustup install <old_version>
rustup default <old_version>
When I uninstall the toolchain using rustup uninstall <old_version>
and then view the list using rustup toolchain list
, it automatically starts downloading and installing the toolchain I just uninstalled.
Is it normal behavior that the rustup toolchain list
command will download and install toolchains? I think it's better to ask first than to start the download automatically.
The rustup team recently made it possible to disable the automatic installation, but it is still enabled by default because not doing so broke lots of CI configurations depending on that behavior. Provided you are using rustup 1.28.2 or later, you can disable it with rustup set auto-install disable
.
(See the links in the changelog for versions 1.28.0 through 1.28.2 to learn more about the history of this situation.)
The reason why rustup
installed that particular toolchain is probably because you didn't reset the default — e.g. rustup default stable
— before uninstalling. In general, what toolchain is “active” is determined by several levels of configuration of which rustup default
is the last, and is not determined by whether a given toolchain is already installed.
7 Likes
It will also install a toolchain if the directory you are in, or one of its parents, has a rust-toolchain file with a channel that is not installed.
This is a little bit at odds with what I read in the docs.
In these cases the toolchain can be named in the project’s directory in a file called rust-toolchain.toml or rust-toolchain.
You do not need to be anywhere near a cargo project for a rust-toolchain file to change rustup's behavior.
Yes, I didn't use the rustup default <version>
command first.
I'd like to take a look at the toolchain list with the rustup toolchain list
command first.Then uninstall all the unwanted versions before setting the default toolchain.
I thought rustup toolchain list
was just a command to view information with no other effect, but I didn't expect it to automatically install the default toolchain.I thought it was commands like rustup update
or something like that that would automatically download and install the toolchain.
No, the command I executed at the root of the disk.