diff options
| author | Loïc BRANSTETT <lolo.branstett@numericable.fr> | 2022-03-08 16:29:41 +0100 |
|---|---|---|
| committer | Loïc BRANSTETT <lolo.branstett@numericable.fr> | 2022-03-09 00:30:17 +0100 |
| commit | 17397934d3ab9385c439e6001f561aff4f9a7110 (patch) | |
| tree | fe8b12ef3d7006cc670fb9943a65841cad37294f | |
| parent | e3ea59ada5fdac7bc88ced97b88d0c6675e94783 (diff) | |
| download | rust-17397934d3ab9385c439e6001f561aff4f9a7110.tar.gz rust-17397934d3ab9385c439e6001f561aff4f9a7110.zip | |
Enable conditional checking of values in the Rust codebase
| -rw-r--r-- | src/bootstrap/builder.rs | 7 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index fc55c8626d9..4f40d9cafd8 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1101,7 +1101,12 @@ impl<'a> Builder<'a> { // cargo.arg("-Zcheck-cfg-features"); // Enable cfg checking of rustc well-known names - rustflags.arg("-Zunstable-options").arg("--check-cfg=names()"); + rustflags + .arg("-Zunstable-options") + // Enable checking of well known names + .arg("--check-cfg=names()") + // Enable checking of well known values + .arg("--check-cfg=values()"); // Add extra cfg not defined in rustc for (restricted_mode, name, values) in EXTRA_CHECK_CFGS { diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index ccc8516a89a..b9cfc9bef32 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -199,6 +199,15 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)] (Some(Mode::Std), "no_global_oom_handling", None), (Some(Mode::Std), "freebsd12", None), (Some(Mode::Std), "backtrace_in_libstd", None), + /* Extra values not defined in the built-in targets yet, but used in std */ + (Some(Mode::Std), "target_env", Some(&["libnx"])), + (Some(Mode::Std), "target_os", Some(&["watchos"])), + ( + Some(Mode::Std), + "target_arch", + Some(&["asmjs", "spirv", "nvptx", "nvptx64", "le32", "xtensa"]), + ), + /* Extra names used by dependencies */ // FIXME: Used by rustfmt is their test but is invalid (neither cargo nor bootstrap ever set // this config) should probably by removed or use a allow attribute. (Some(Mode::ToolRustc), "release", None), |
