Skip to content

Commit 1705668

Browse files
authored
Rollup merge of #47836 - Mark-Simulacrum:stage-flags, r=alexcrichton
Add per-stage RUSTFLAGS: RUSTFLAGS_STAGE_{0,1,2} and RUSTFLAGS_STAGE_NOT_0 Fixes #47658. r? @alexcrichton
2 parents a07de32 + e09a8bd commit 1705668

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/bootstrap/builder.rs

+12
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,18 @@ impl<'a> Builder<'a> {
469469
stage = compiler.stage;
470470
}
471471

472+
let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default();
473+
if stage != 0 {
474+
let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default();
475+
extra_args.push_str(" ");
476+
extra_args.push_str(&s);
477+
}
478+
479+
if !extra_args.is_empty() {
480+
cargo.env("RUSTFLAGS",
481+
format!("{} {}", env::var("RUSTFLAGS").unwrap_or_default(), extra_args));
482+
}
483+
472484
// Customize the compiler we're running. Specify the compiler to cargo
473485
// as our shim and then pass it some various options used to configure
474486
// how the actual compiler itself is called.

0 commit comments

Comments
 (0)