Files
cargo/tests
Weihang Lo e5de173a30 feat(compile): Stabilize build.warnings (#16796)
*[View all
comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/cargo/pull/16796)*

### What does this PR try to resolve?

This allows users to either
- hide warnings (#14258)
- error on warnings (#8424)

`build.warnings` serves a similar purpose as `RUSTFLAGS=-Dwarnings` /
`RUSTFLAGS=-Awarnings` but without invalidation caches.

`build.warnings = "deny"` will
- only errors for lint warnings and not hard warnings
- only errors for local warnings and not non-local warnings visible with
`--verbose --verbose`
- stop the build without `--keep-going`

(this matches `RUSTFLAGS=-Dwarnings`)

These conditions were not originally met and also came as feedback from
rust-lang/rust which has been dogfooding this since the merge of
rust-lang/rust#148332.

`build.warnings = "allow"` will
- only hide lint warnings and not hard warnings
  - Note: `RUSTFLAGS=-Awarnings` will suppress rustc hard warnings
- hide non-local warnings for `--verbose --verbose`
- hide the warning summary line (number of warnings per crate)

Closes #14802

### How to test and review this PR?

My main concern over this was how the naming scheme would extend to
https://github.com/rust-lang/rfcs/pull/3730 but that RFC has not gained
much interest

`build` seems as good of a home as any.
2026-04-24 20:35:58 +00:00
..