Skip to content

Commit b0ca3cd

Browse files
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
2 parents 0d5ee65 + 199589d commit b0ca3cd

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/bootstrap/src/core/builder.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -2084,12 +2084,10 @@ impl<'a> Builder<'a> {
20842084
rustdocflags.arg("--cfg=parallel_compiler");
20852085
}
20862086

2087-
// set rustc args passed from command line
2088-
let rustc_args =
2089-
self.config.cmd.rustc_args().iter().map(|s| s.to_string()).collect::<Vec<_>>();
2090-
if !rustc_args.is_empty() {
2091-
cargo.env("RUSTFLAGS", &rustc_args.join(" "));
2092-
}
2087+
// Pass the value of `--rustc-args` from test command. If it's not a test command, this won't set anything.
2088+
self.config.cmd.rustc_args().iter().for_each(|v| {
2089+
rustflags.arg(v);
2090+
});
20932091

20942092
Cargo {
20952093
command: cargo,

0 commit comments

Comments
 (0)