rustup icon indicating copy to clipboard operation
rustup copied to clipboard

Unknown keys in rust-toolchain.toml are silently ignored

Open sfackler opened this issue 4 years ago • 4 comments

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.

sfackler avatar Oct 21 '21 17:10 sfackler

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.

kinnison avatar Nov 08 '21 11:11 kinnison

@rustbot claim

Aelerinya avatar Nov 27 '21 19:11 Aelerinya

@kinnison and I have discussed this and decided what we want to do is:

  1. 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.
  2. 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

rbtcollins avatar Nov 29 '21 20:11 rbtcollins

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.

shprdchris avatar Sep 07 '22 13:09 shprdchris