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.
This commit is contained in:
Pietro Albini 2023-06-08 09:53:01 +02:00
parent 9de3c29319
commit 6fd0d1ba14
No known key found for this signature in database
GPG Key ID: CD76B35F7734769E
2 changed files with 7 additions and 0 deletions

View File

@ -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 {

View File

@ -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,