-
Notifications
You must be signed in to change notification settings - Fork 984
Description
Verification
- I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue+is%3Aopen%2Cclosed 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
In 2020Q4 support for installing a toolchain defined in rust-toolchain.toml with a new profile key was added to rustup: #2586
While this works, when the profile key is not set, there is no fallback to the global profile setting for rustup. Thus if rust-toolchain.toml exists, despite rustup being configured for a minimal profile, the toolchain will be downloaded with the default profile bringing in over 600MB of HTML docs and additional components.
This took a while to trackdown/confirm why the rustup profile wasn't being respected 😅 While a little surprising, I tried searching for any existing issues and came up empty.
Steps
- Install rustup and set the profile to
minimal. - Add a
rust-toolchain.tomlfile in an empty directory, with contents:[toolchain] channel = "1.70" # should be a toolchain version that is not installed
- Run
cargo --version, rustup will download the toolchain. - Check the toolchain install, and notice that there is over 600MB of docs installed despite the
minimalprofile:$ du --bytes -sh ~/.rustup/toolchains/1.77-x86_64-unknown-linux-gnu/share/doc/rust/html 587M /root/.rustup/toolchains/1.77-x86_64-unknown-linux-gnu/share/doc/rust/html
If you repeat these steps but add profile = "minimal" to the rust-toolchain.toml file with a different toolchain version, the HTML docs won't be present, the share/ directory itself will now be about 500KB.
Possible Solution(s)
- If
profileis not defined, use the rustup configured profile setting to align with installing a toolchain viarustupexplicitly. - Document that a
rust-toolchain.tomlwithout aprofilekey will not fallback to the global rustup profile, which can result in excessive disk usage.
Notes
Past issues requesting the feature support prior to the 2020 PR:
- Installing a major.minor channel includes documentation even when profile is minimal #2593
- rust-toolchain should allow setting the equivalent of
--profile minimal#2579 - Related historical issue (landed here first when trying to find why docs were installed): Making docs optional again #998
Discussion regarding interoperability across config layers, including better documenting precedence:
- Issue: Document (and perhaps change) interaction between
rust-toolchain.tomland other override sources for components and targets #3483 - PR introducing related changes: Make the toolchain overriding config hierarchical #3492
Rustup version
$ rustup --version
rustup 1.27.0 (bbb9276d2 2024-03-08)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.75.0 (82e1608df 2023-12-21)`Installed toolchains
$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /root/.rustup
installed toolchains
--------------------
1.75-x86_64-unknown-linux-gnu (default)
1.76-x86_64-unknown-linux-gnu
1.77-x86_64-unknown-linux-gnu
1.78-x86_64-unknown-linux-gnu
active toolchain
----------------
1.75-x86_64-unknown-linux-gnu (default)
rustc 1.75.0 (82e1608df 2023-12-21)OS version
Windows 11 with WSL2, running rustup via a Docker container (Ubuntu 24.04):
$ cat /etc/os-release | grep PRETTY_NAME
PRETTY_NAME="Ubuntu 24.04 LTS"
$ uname -a
Linux 3d586f91b6a2 5.15.123.1-microsoft-standard-WSL2 #1 SMP Mon Aug 7 19:01:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux