Skip to content

Commit a59589b

Browse files
committed
Replace fake "restricted-std" Cargo feature by custom cfg
1 parent 324b66c commit a59589b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

library/std/build.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ fn main() {
1010
if target_os == "netbsd" && env::var("RUSTC_STD_NETBSD10").is_ok() {
1111
println!("cargo:rustc-cfg=netbsd10");
1212
}
13+
println!("cargo:rustc-check-cfg=cfg(restricted_std)");
1314
if target_os == "linux"
1415
|| target_os == "android"
1516
|| target_os == "netbsd"
@@ -59,7 +60,7 @@ fn main() {
5960
// - arch=avr
6061
// - JSON targets
6162
// - Any new targets that have not been explicitly added above.
62-
println!("cargo:rustc-cfg=feature=\"restricted-std\"");
63+
println!("cargo:rustc-cfg=restricted_std");
6364
}
6465
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
6566
println!("cargo:rustc-cfg=backtrace_in_libstd");

library/std/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@
213213
//! [array]: prim@array
214214
//! [slice]: prim@slice
215215
216-
#![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))]
216+
#![cfg_attr(not(restricted_std), stable(feature = "rust1", since = "1.0.0"))]
217217
#![cfg_attr(
218-
feature = "restricted-std",
218+
restricted_std,
219219
unstable(
220220
feature = "restricted_std",
221221
issue = "none",

src/bootstrap/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
9494
(Some(Mode::Std), "no_sync", None),
9595
(Some(Mode::Std), "netbsd10", None),
9696
(Some(Mode::Std), "backtrace_in_libstd", None),
97+
(Some(Mode::Std), "restricted_std", None),
9798
/* Extra values not defined in the built-in targets yet, but used in std */
9899
(Some(Mode::Std), "target_env", Some(&["libnx", "p2"])),
99100
(Some(Mode::Std), "target_os", Some(&["visionos"])),

0 commit comments

Comments
 (0)