about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2020-04-24 09:19:58 -0700
committerDylan MacKenzie <ecstaticmorse@gmail.com>2020-04-24 09:19:58 -0700
commit08c8996ff6f152e2ac580fbabce46e97457185e3 (patch)
treef53bfe584675f5f4219b16d03e57694977215af8
parent06582593257ccb0825d14b0740625546eb6bdc3d (diff)
downloadrust-08c8996ff6f152e2ac580fbabce46e97457185e3.tar.gz
rust-08c8996ff6f152e2ac580fbabce46e97457185e3.zip
Only set *FLAGS env vars if they are not empty
-rw-r--r--src/bootstrap/builder.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 466e2d6e799..4a664205bff 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1405,8 +1405,16 @@ impl Cargo {
 
 impl From<Cargo> for Command {
     fn from(mut cargo: Cargo) -> Command {
-        cargo.command.env("RUSTFLAGS", &cargo.rustflags.0);
-        cargo.command.env("RUSTDOCFLAGS", &cargo.rustdocflags.0);
+        let rustflags = &cargo.rustflags.0;
+        if !rustflags.is_empty() {
+            cargo.command.env("RUSTFLAGS", rustflags);
+        }
+
+        let rustdocflags = &cargo.rustdocflags.0;
+        if !rustdocflags.is_empty() {
+            cargo.command.env("RUSTDOCFLAGS", rustdocflags);
+        }
+
         cargo.command
     }
 }