Skip to content

Commit 18f9868

Browse files
committed
Fix restricted_std flag for custom platforms
1 parent 1855440 commit 18f9868

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

library/std/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use std::env;
22

33
fn main() {
4+
let is_custom_os = || env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("custom");
5+
46
println!("cargo:rerun-if-changed=build.rs");
57
let target = env::var("TARGET").expect("TARGET was not set");
68
if target.contains("freebsd") {
@@ -37,6 +39,7 @@ fn main() {
3739
|| target.contains("nintendo-3ds")
3840
|| target.contains("vita")
3941
|| target.contains("nto")
42+
|| is_custom_os()
4043
// See src/bootstrap/synthetic_targets.rs
4144
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()
4245
{

library/std/src/env.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ pub mod consts {
926926
/// - dragonfly
927927
/// - netbsd
928928
/// - openbsd
929+
/// - custom
929930
/// - solaris
930931
/// - android
931932
/// - windows

library/std/src/sys_common/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ cfg_if::cfg_if! {
4444

4545
cfg_if::cfg_if! {
4646
if #[cfg(any(target_os = "l4re",
47+
target_os = "custom",
4748
feature = "restricted-std",
4849
all(target_family = "wasm", not(target_os = "emscripten")),
4950
all(target_vendor = "fortanix", target_env = "sgx")))] {

0 commit comments

Comments
 (0)