about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2018-01-28 17:09:47 -0700
committerMark Simulacrum <mark.simulacrum@gmail.com>2018-01-29 07:02:09 -0700
commite09a8bd70c4804234af900f19fbb883045ba8d0d (patch)
treecc1c856e9eba6d9c884f091a8248e43c6b66d84d /src/bootstrap
parent21882aad7299e8e859785845ac12374990f24dae (diff)
downloadrust-e09a8bd70c4804234af900f19fbb883045ba8d0d.tar.gz
rust-e09a8bd70c4804234af900f19fbb883045ba8d0d.zip
Add per-stage RUSTFLAGS: RUSTFLAGS_STAGE_{0,1,2} and RUSTFLAGS_STAGE_NOT_0
Fixes #47658.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 79058984b13..1272643edd2 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -469,6 +469,18 @@ impl<'a> Builder<'a> {
             stage = compiler.stage;
         }
 
+        let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default();
+        if stage != 0 {
+            let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default();
+            extra_args.push_str(" ");
+            extra_args.push_str(&s);
+        }
+
+        if !extra_args.is_empty() {
+            cargo.env("RUSTFLAGS",
+                format!("{} {}", env::var("RUSTFLAGS").unwrap_or_default(), extra_args));
+        }
+
         // Customize the compiler we're running. Specify the compiler to cargo
         // as our shim and then pass it some various options used to configure
         // how the actual compiler itself is called.