From 6fd0d1ba149a7049f2acb78ed4a93570ce36e3e4 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 8 Jun 2023 09:53:01 +0200 Subject: [PATCH] make sure the standard library compiles properly with synthetic targets It might happen that a synthetic target name does not match one of the hardcoded ones in std's build script, causing std to fail to build. This commit changes the std build script avoid including the restricted-std feature unconditionally when a synthetic target is being built. --- library/std/build.rs | 2 ++ src/bootstrap/compile.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/library/std/build.rs b/library/std/build.rs index 0fb03c8e88a..d0b37940936 100644 --- a/library/std/build.rs +++ b/library/std/build.rs @@ -36,6 +36,8 @@ fn main() { || target.contains("nintendo-3ds") || target.contains("vita") || target.contains("nto") + // See src/bootstrap/synthetic_targets.rs + || env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok() { // These platforms don't have any special requirements. } else { diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 8f2e7d75523..14c3ef79a78 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -169,6 +169,11 @@ fn run(self, builder: &Builder<'_>) { cargo.arg("-p").arg(krate); } + // See src/bootstrap/synthetic_targets.rs + if target.is_synthetic() { + cargo.env("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET", "1"); + } + let _guard = builder.msg( Kind::Build, compiler.stage,