diff options
| author | Ralf Jung <post@ralfj.de> | 2024-03-30 13:52:32 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-03-31 19:44:54 +0200 |
| commit | 288daeb14f70192d53d2331b4c43a8c6d90d9d7e (patch) | |
| tree | df2c375c2485942ba13037a78e163c651303271f | |
| parent | 7ac5f604c1601c0c43cd305ae43c78795c1eac2b (diff) | |
| download | rust-288daeb14f70192d53d2331b4c43a8c6d90d9d7e.tar.gz rust-288daeb14f70192d53d2331b4c43a8c6d90d9d7e.zip | |
move parallel_compiler handling into prepare_tool_cargo so that it is done everywhere
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 6 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/tool.rs | 12 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder.rs | 9 |
3 files changed, 11 insertions, 16 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index d40a3ea4c88..5bb7dc5b482 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1130,12 +1130,6 @@ pub fn rustc_cargo_env( cargo.env("CFG_DEFAULT_LINKER", s); } - if builder.config.rustc_parallel { - // keep in sync with `bootstrap/lib.rs:Build::rustc_features` - // `cfg` option for rustc, `features` option for cargo, for conditional compilation - cargo.rustflag("--cfg=parallel_compiler"); - cargo.rustdocflag("--cfg=parallel_compiler"); - } if builder.config.rust_verify_llvm_ir { cargo.env("RUSTC_VERIFY_LLVM_IR", "1"); } diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index deab3fce54c..1edf65d28b7 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -469,7 +469,7 @@ impl Step for Rustdoc { features.push("jemalloc".to_string()); } - let mut cargo = prepare_tool_cargo( + let cargo = prepare_tool_cargo( builder, build_compiler, Mode::ToolRustc, @@ -480,10 +480,6 @@ impl Step for Rustdoc { features.as_slice(), ); - if builder.config.rustc_parallel { - cargo.rustflag("--cfg=parallel_compiler"); - } - let _guard = builder.msg_tool( Mode::ToolRustc, "rustdoc", @@ -732,7 +728,7 @@ impl Step for LlvmBitcodeLinker { builder.ensure(compile::Std::new(self.compiler, self.compiler.host)); builder.ensure(compile::Rustc::new(self.compiler, self.target)); - let mut cargo = prepare_tool_cargo( + let cargo = prepare_tool_cargo( builder, self.compiler, Mode::ToolRustc, @@ -743,10 +739,6 @@ impl Step for LlvmBitcodeLinker { &self.extra_features, ); - if builder.config.rustc_parallel { - cargo.rustflag("--cfg=parallel_compiler"); - } - builder.run(&mut cargo.into()); let tool_out = builder diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index c97d8121e0c..4b2ee1d050a 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -2100,6 +2100,15 @@ impl<'a> Builder<'a> { rustflags.arg("-Zinline-mir"); } + if builder.config.rustc_parallel + && matches!(mode, Mode::ToolRustc | Mode::Rustc | Mode::Codegen) + { + // keep in sync with `bootstrap/lib.rs:Build::rustc_features` + // `cfg` option for rustc, `features` option for cargo, for conditional compilation + rustflags.arg("--cfg=parallel_compiler"); + 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<_>>(); |
