target json file contains unused fields unaffected by -Dwarnings · Issue #91262 · rust-lang/rust (original) (raw)

I tried this:

t.json is a target spec file with an unknown field

$ cat t.json | grep foo "foo": "bar", $ rustc -Dwarnings --target=t.json < /dev/null

I expected to see this happen: the warning: target json file contains unused fields: foo diagnostic to be an error.

Instead, this happened: the warning is still a warning, even with -Dwarnings.

If this is intended (i.e. if -Dwarnings is only intended for code-related diagnostics), then this issue would be a feature request: a way to control whether non-code warnings are (or not) errors for CI purposes.

Meta

Happens in both stable (1.56.1) and the latest nightly:

rustc 1.58.0-nightly (dd549dcab 2021-11-25)
binary: rustc
commit-hash: dd549dcab404ec4c7d07b5a83aca5bdd7171138f
commit-date: 2021-11-25
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0