about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2023-06-08 09:53:01 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2023-06-12 09:34:13 +0200
commit6fd0d1ba149a7049f2acb78ed4a93570ce36e3e4 (patch)
tree351c98a350df0fa2b894cd02152d912aeef2487f
parent9de3c29319a42bbfdf3c61f1bced9e2e79373452 (diff)
downloadrust-6fd0d1ba149a7049f2acb78ed4a93570ce36e3e4.tar.gz
rust-6fd0d1ba149a7049f2acb78ed4a93570ce36e3e4.zip
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.
-rw-r--r--library/std/build.rs2
-rw-r--r--src/bootstrap/compile.rs5
2 files changed, 7 insertions, 0 deletions
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 @@ impl Step for Std {
             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,