rustup
rustup copied to clipboard
Unknown keys in rust-toolchain.toml are silently ignored
I was adding a rust-toolchain.toml file to a project, and ended up in a very confusing state where it was clearly being picked up (e.g. rustup show had the overridden by .../rust-toolchain.toml text) but my selected channel wasn't being respected. I eventually realized that I had used channnel = "1.56.0" rather than channel = "1.56.0"!
It seems like rustup should complain more loudly about this kind of misconfiguration. If actually forbidding unknown fields isn't desirable, it'd be great to at least warn about unused keys found when parsing the configuration using serde_ignored.
One issue with not ignoring unknown entries is that if we add a new feature, we'll be locking out users of older rustup versions. If we think that's a minimal issue (since people can "just" update rustup - unless they're in a no-self-update situation e.g. an OS provided rustup package) then I'm all for adding this since it's good for usability.
@rustbot claim
@kinnison and I have discussed this and decided what we want to do is:
- be strict: new features in toolchain.toml should error, because a rustup that doesn't understand the feature cannot do the right thing for users, and older code cannot predict the semantics of newer code.
- error when this situation is encountered with a message that gives people everything they need to fix it - something like this:
error: key 'foo' is not supported in toolchain.toml by this rustup (version 4). https://rust-lang.github.io/rustup/concepts/toolchains.html lists the keys supported in every version of rustup
There doesn't seem to have been much activity on this and I'm thinking of taking the issue on. This will be my first contribution, so I'll probably need some help getting started.