fix: reject unknown toolchain file keys#4953
Conversation
Constraint: Older rustup versions cannot safely interpret future toolchain-file semantics.\nRejected: Warn and continue | Maintainer direction requires a hard error.\nConfidence: high\nScope-risk: narrow\nDirective: Keep the documented key-version table current when extending the schema.\nTested: Focused parser and CLI tests; strict all-target Clippy with test feature; rustfmt; diff check.\nNot-tested: All-feature Clippy exceeded local disk while compiling vendored TLS backends.
|
@ychampion Thanks for working on this! I'm glad to see that this is more in line with However I have a design question to ask here: switching to a hard error immediately is a breaking change, and I wonder if this behavior is already (ab)used in the wild. Do you have any evidence in that regard, in that if it has already been (somewhat widely) abused, we may have to issue a warning first before going straight rejecting? |
|
I found enough public use that a warning-first transition looks safer. At the time of the search, GitHub code search found 13
Those settings are currently ignored, so an immediate error would break files whose channel selection still works today. The original |
|
@ychampion Thanks for the investigation! In that case I suggest leaving this PR as-is or convert it to draft, and instead use another PR to issue a warning first (that should also allow closing the original issue as resolved). |
Summary
[toolchain]keys instead of silently ignoring themWhy
Misspelled or unsupported keys can otherwise leave rustup using a different toolchain configuration than the file appears to request.
Closes #2876
Validation
cargo test --features=test parse_toml_unknown --libcargo test --features=test --test test_bonanza rust_toolchain_tomlcargo clippy --all-targets --features=test -- -D warningscargo fmt --all -- --checkgit diff --check