about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-04-05 16:38:52 +0200
committerGitHub <noreply@github.com>2024-04-05 16:38:52 +0200
commitb0ca3cd9d42d797ccf8a2b172a237921d721dfed (patch)
tree4511e63c5fa9bfd5ccf63c4a79539ae846ae4c24
parent0d5ee650f8619021635e255447a036b2e98d42b8 (diff)
parent199589d81466a4b436bd41cc0dfd2f35c908a951 (diff)
downloadrust-b0ca3cd9d42d797ccf8a2b172a237921d721dfed.tar.gz
rust-b0ca3cd9d42d797ccf8a2b172a237921d721dfed.zip
Rollup merge of #123489 - onur-ozkan:handle-rustc-args-properly, r=clubby789
handle rustc args properly in bootstrap

Because `RUSTFLAGS` gets overwritten during the conversion from `Cargo` to `Command`, the passed rustc args were being lost. This change combines the rustc args with the values that override `RUSTFLAGS`.

Fixes #123228
-rw-r--r--src/bootstrap/src/core/builder.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
index 0cce5130f64..1b33e4ea600 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -2084,12 +2084,10 @@ impl<'a> Builder<'a> {
             rustdocflags.arg("--cfg=parallel_compiler");
         }
 
-        // set rustc args passed from command line
-        let rustc_args =
-            self.config.cmd.rustc_args().iter().map(|s| s.to_string()).collect::<Vec<_>>();
-        if !rustc_args.is_empty() {
-            cargo.env("RUSTFLAGS", &rustc_args.join(" "));
-        }
+        // Pass the value of `--rustc-args` from test command. If it's not a test command, this won't set anything.
+        self.config.cmd.rustc_args().iter().for_each(|v| {
+            rustflags.arg(v);
+        });
 
         Cargo {
             command: cargo,