about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2024-04-05 10:52:36 +0300
committeronur-ozkan <work@onurozkan.dev>2024-04-05 11:45:31 +0300
commit199589d81466a4b436bd41cc0dfd2f35c908a951 (patch)
tree4e57170e0491a6085960477afc56bc996785f5ff
parent3d5528c287860b918e178a34f04ff903325571b3 (diff)
downloadrust-199589d81466a4b436bd41cc0dfd2f35c908a951.tar.gz
rust-199589d81466a4b436bd41cc0dfd2f35c908a951.zip
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`.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
-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 c051b818328..23a5a954e62 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -2093,12 +2093,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,