Skip to content

Commit 6fd0d1b

Browse files
committed
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.
1 parent 9de3c29 commit 6fd0d1b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

library/std/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ fn main() {
3636
|| target.contains("nintendo-3ds")
3737
|| target.contains("vita")
3838
|| target.contains("nto")
39+
// See src/bootstrap/synthetic_targets.rs
40+
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()
3941
{
4042
// These platforms don't have any special requirements.
4143
} else {

src/bootstrap/compile.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ impl Step for Std {
169169
cargo.arg("-p").arg(krate);
170170
}
171171

172+
// See src/bootstrap/synthetic_targets.rs
173+
if target.is_synthetic() {
174+
cargo.env("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET", "1");
175+
}
176+
172177
let _guard = builder.msg(
173178
Kind::Build,
174179
compiler.stage,

0 commit comments

Comments
 (0)