Skip to content

Commit 288daeb

Browse files
committed
move parallel_compiler handling into prepare_tool_cargo so that it is done everywhere
1 parent 7ac5f60 commit 288daeb

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

src/bootstrap/src/core/build_steps/compile.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1130,12 +1130,6 @@ pub fn rustc_cargo_env(
11301130
cargo.env("CFG_DEFAULT_LINKER", s);
11311131
}
11321132

1133-
if builder.config.rustc_parallel {
1134-
// keep in sync with `bootstrap/lib.rs:Build::rustc_features`
1135-
// `cfg` option for rustc, `features` option for cargo, for conditional compilation
1136-
cargo.rustflag("--cfg=parallel_compiler");
1137-
cargo.rustdocflag("--cfg=parallel_compiler");
1138-
}
11391133
if builder.config.rust_verify_llvm_ir {
11401134
cargo.env("RUSTC_VERIFY_LLVM_IR", "1");
11411135
}

src/bootstrap/src/core/build_steps/tool.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ impl Step for Rustdoc {
469469
features.push("jemalloc".to_string());
470470
}
471471

472-
let mut cargo = prepare_tool_cargo(
472+
let cargo = prepare_tool_cargo(
473473
builder,
474474
build_compiler,
475475
Mode::ToolRustc,
@@ -480,10 +480,6 @@ impl Step for Rustdoc {
480480
features.as_slice(),
481481
);
482482

483-
if builder.config.rustc_parallel {
484-
cargo.rustflag("--cfg=parallel_compiler");
485-
}
486-
487483
let _guard = builder.msg_tool(
488484
Mode::ToolRustc,
489485
"rustdoc",
@@ -732,7 +728,7 @@ impl Step for LlvmBitcodeLinker {
732728
builder.ensure(compile::Std::new(self.compiler, self.compiler.host));
733729
builder.ensure(compile::Rustc::new(self.compiler, self.target));
734730

735-
let mut cargo = prepare_tool_cargo(
731+
let cargo = prepare_tool_cargo(
736732
builder,
737733
self.compiler,
738734
Mode::ToolRustc,
@@ -743,10 +739,6 @@ impl Step for LlvmBitcodeLinker {
743739
&self.extra_features,
744740
);
745741

746-
if builder.config.rustc_parallel {
747-
cargo.rustflag("--cfg=parallel_compiler");
748-
}
749-
750742
builder.run(&mut cargo.into());
751743

752744
let tool_out = builder

src/bootstrap/src/core/builder.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2100,6 +2100,15 @@ impl<'a> Builder<'a> {
21002100
rustflags.arg("-Zinline-mir");
21012101
}
21022102

2103+
if builder.config.rustc_parallel
2104+
&& matches!(mode, Mode::ToolRustc | Mode::Rustc | Mode::Codegen)
2105+
{
2106+
// keep in sync with `bootstrap/lib.rs:Build::rustc_features`
2107+
// `cfg` option for rustc, `features` option for cargo, for conditional compilation
2108+
rustflags.arg("--cfg=parallel_compiler");
2109+
rustdocflags.arg("--cfg=parallel_compiler");
2110+
}
2111+
21032112
// set rustc args passed from command line
21042113
let rustc_args =
21052114
self.config.cmd.rustc_args().iter().map(|s| s.to_string()).collect::<Vec<_>>();

0 commit comments

Comments
 (0)