feat(warnings): add build.warnings option by arlosi · Pull Request #14388 · rust-lang/cargo (original) (raw)

What does this PR try to resolve?

Allows control over warnings via a new Cargo configuration option build.warnings.

The primary use case is wanting CI runs to deny warnings, while keeping them as warnings for local development. While this is currently possible by conditionally setting RUSTFLAGS in CI, that approach is not available for projects that already use another mechanism for setting RUSTFLAGS, since the two would conflict. Additionally, we may in the future make this apply to more than warnings from rustc.

Option values:

The option currently only applies to warnings coming from rustc, however it's documented as allowing additional categories of warnings from Cargo to be added.

Fixes #8424
Fixes #14258

How should we test and review this PR?

Tests are included in the PR. For local testing, after building cargo with this PR, run

CARGO_BUILD_WARNINGS=deny CARGO_UNSTABLE_WARNINGS=true cargo check