Skip to content

Commit 339f749

Browse files
committed
Move some expected cfgs to std build.rs as per Cargo recommandation
1 parent fb68dc3 commit 339f749

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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

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
}

0 commit comments

Comments
 (0)