Cargo will silently ignore invalid .cargo/config options
For example, cargo will silently ignore
rustflags = [...]
where it should be under a build subheading like:
[build]
rustflags = [...]
This is related to #4377, so perhaps it could be done at the same time?
Cargo configuration is considered as a kind of environment for Cargo. That said, usually a CLI won't complain to the existence of unrecognized environment variables. However, Cargo could possibly do a bit better — collect unrecognized configs and put a warning there
13 cargo configuration values cannot be recognized.
Run `cargo config get --unrecognized` to reveal.
This does need more discussions and designs. Maybe use --verbose or cargo report instead of unstable cargo config, though starting as an unstable flag is more likely to be accepted.
A linter or cargo config would be a good home for something like this. See also #12235