Skip to content

Commit 2868985

Browse files
committed
Move some expected cfgs to std build.rs as per Cargo recommandation
1 parent a59589b commit 2868985

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

library/std/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ test = true
102102
level = "warn"
103103
check-cfg = [
104104
'cfg(bootstrap)',
105-
'cfg(backtrace_in_libstd)',
106-
'cfg(netbsd10)',
107105
'cfg(target_arch, values("xtensa"))',
108106
# std use #[path] imports to portable-simd `std_float` crate
109107
# and to the `backtrace` crate which messes-up with Cargo list

library/std/build.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ fn main() {
77
let target_vendor =
88
env::var("CARGO_CFG_TARGET_VENDOR").expect("CARGO_CFG_TARGET_VENDOR was not set");
99
let target_env = env::var("CARGO_CFG_TARGET_ENV").expect("CARGO_CFG_TARGET_ENV was not set");
10+
11+
println!("cargo:rustc-check-cfg=cfg(netbsd10)");
1012
if target_os == "netbsd" && env::var("RUSTC_STD_NETBSD10").is_ok() {
1113
println!("cargo:rustc-cfg=netbsd10");
1214
}
15+
1316
println!("cargo:rustc-check-cfg=cfg(restricted_std)");
1417
if target_os == "linux"
1518
|| target_os == "android"
@@ -62,6 +65,9 @@ fn main() {
6265
// - Any new targets that have not been explicitly added above.
6366
println!("cargo:rustc-cfg=restricted_std");
6467
}
65-
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
68+
69+
println!("cargo:rustc-check-cfg=cfg(backtrace_in_libstd)");
6670
println!("cargo:rustc-cfg=backtrace_in_libstd");
71+
72+
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
6773
}

src/bootstrap/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
9292
(Some(Mode::Std), "no_global_oom_handling", None),
9393
(Some(Mode::Std), "no_rc", None),
9494
(Some(Mode::Std), "no_sync", None),
95-
(Some(Mode::Std), "netbsd10", None),
96-
(Some(Mode::Std), "backtrace_in_libstd", None),
97-
(Some(Mode::Std), "restricted_std", None),
9895
/* Extra values not defined in the built-in targets yet, but used in std */
9996
(Some(Mode::Std), "target_env", Some(&["libnx", "p2"])),
10097
(Some(Mode::Std), "target_os", Some(&["visionos"])),

0 commit comments

Comments
 (0)