Replace fake "restricted-std" Cargo feature by custom cfg

This commit is contained in:
Urgau 2024-05-23 15:30:46 +02:00
parent 324b66c553
commit a59589b1cc
3 changed files with 5 additions and 3 deletions

View File

@ -10,6 +10,7 @@ fn main() {
if target_os == "netbsd" && env::var("RUSTC_STD_NETBSD10").is_ok() { if target_os == "netbsd" && env::var("RUSTC_STD_NETBSD10").is_ok() {
println!("cargo:rustc-cfg=netbsd10"); println!("cargo:rustc-cfg=netbsd10");
} }
println!("cargo:rustc-check-cfg=cfg(restricted_std)");
if target_os == "linux" if target_os == "linux"
|| target_os == "android" || target_os == "android"
|| target_os == "netbsd" || target_os == "netbsd"
@ -59,7 +60,7 @@ fn main() {
// - arch=avr // - arch=avr
// - JSON targets // - JSON targets
// - Any new targets that have not been explicitly added above. // - Any new targets that have not been explicitly added above.
println!("cargo:rustc-cfg=feature=\"restricted-std\""); println!("cargo:rustc-cfg=restricted_std");
} }
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap()); println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
println!("cargo:rustc-cfg=backtrace_in_libstd"); println!("cargo:rustc-cfg=backtrace_in_libstd");

View File

@ -213,9 +213,9 @@
//! [array]: prim@array //! [array]: prim@array
//! [slice]: prim@slice //! [slice]: prim@slice
#![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))] #![cfg_attr(not(restricted_std), stable(feature = "rust1", since = "1.0.0"))]
#![cfg_attr( #![cfg_attr(
feature = "restricted-std", restricted_std,
unstable( unstable(
feature = "restricted_std", feature = "restricted_std",
issue = "none", issue = "none",

View File

@ -94,6 +94,7 @@
(Some(Mode::Std), "no_sync", None), (Some(Mode::Std), "no_sync", None),
(Some(Mode::Std), "netbsd10", None), (Some(Mode::Std), "netbsd10", None),
(Some(Mode::Std), "backtrace_in_libstd", None), (Some(Mode::Std), "backtrace_in_libstd", None),
(Some(Mode::Std), "restricted_std", None),
/* Extra values not defined in the built-in targets yet, but used in std */ /* Extra values not defined in the built-in targets yet, but used in std */
(Some(Mode::Std), "target_env", Some(&["libnx", "p2"])), (Some(Mode::Std), "target_env", Some(&["libnx", "p2"])),
(Some(Mode::Std), "target_os", Some(&["visionos"])), (Some(Mode::Std), "target_os", Some(&["visionos"])),