]> git.proxmox.com Git - cargo.git/commit - src/etc/man/cargo-rustc.1
Auto merge of #10408 - Urgau:check-cfg-features, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 22 Feb 2022 19:12:30 +0000 (19:12 +0000)
committerbors <bors@rust-lang.org>
Tue, 22 Feb 2022 19:12:30 +0000 (19:12 +0000)
commitdcb288805a3af2a7d32e7e91ccf24bd59e690c64
treebf7f86fdaa664f7b208ab519e5b721a5d3023b77
parente46a9ec29fd850c4a3f2912ddb98684155cbaf44
parent4ac4f3d9ab4889e9d8031c9ed1a9584cc9e69064
Auto merge of #10408 - Urgau:check-cfg-features, r=alexcrichton

Add -Z check-cfg-features to enable compile-time checking of features

This pull-request implements the "[Cargo support](https://rust-lang.github.io/rfcs/3013-conditional-compilation-checking.html#cargo-support)" section of [RFC 3013: Checking conditional compilation at compile time](https://rust-lang.github.io/rfcs/3013-conditional-compilation-checking.html#checking-conditional-compilation-at-compile-time).

The support is added in the form of an new unstable flags: `-Z check-cfg-features` that pass all possible features of a package to
`rustc` unstable `--check-cfg` command line as `--check-cfg=values(feature, ...)`. This enables compile time checking of `feature` values in `#[cfg]`, `cfg!` and `#[cfg_attr]`.

This new flag currently only affects `rustc` but `rustdoc` support will be added as soon as [it's support](https://github.com/rust-lang/rust/pull/94154) is merged.

Note than the intent is that this command line options become the default when stabilizing as suggested in the RFC:
> [..] it seems uncontroversial for Cargo to enable checking for feature = "..." values immediately [..]
src/cargo/core/compiler/mod.rs
src/cargo/core/features.rs
src/doc/src/reference/unstable.md