rustup icon indicating copy to clipboard operation
rustup copied to clipboard

rust-toolchain.toml rejects profile-only configuration as empty

Open Kaileshwar16 opened this issue 1 month ago • 2 comments

I noticed that rustup rejects a rust-toolchain.toml when profile is the only property specified.

The [official documentation](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file) says that the [toolchain] section requires at least one property, and profile is listed as a supported setting.

However, this configuration fails:

[toolchain]
profile = "minimal"

Running rustup show active-toolchain gives:

missing toolchain properties in toolchain override file

adding components = [] makes it work:

[toolchain]
components = []
profile = "minimal"

Looking at [ToolchainSection::is_empty()](https://github.com/rust-lang/rustup/blob/main/src/config.rs#L65-L73), it checks channel, components, targets, and path, but doesn't include profile.

Is this intentional, or should profile also count as a valid property here?

Environment

  • rustup 1.29.1
  • Linux x86_64

Kaileshwar16 avatar Nov 01 '26 12:11 Kaileshwar16

@Kaileshwar16 Thanks for the issue!

Looking at https://github.com/rust-lang/rustup/commit/2ac9c2fa6fe502f527b4d0f7bd928efd664cd6d8 it seems to me that the original author simply forgot to add this predicate. Would you mind submitting a patch for this, which I believe should be quite simple?

rami3l avatar Nov 02 '26 08:11 rami3l

Make sure to destruct Self in is_empty() to prevent this from happening again.

djc avatar Nov 02 '26 09:11 djc