diff options
| author | klensy <klensy@users.noreply.github.com> | 2022-02-11 23:25:14 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2022-03-28 08:41:12 +0300 |
| commit | 008fc79dcd821b08a1ab64f5fba40dcc4bcd3aee (patch) | |
| tree | b3968ac6b5ed27b001ac7d29b9123c23b7bdb6da /src | |
| parent | 78fbcca3e10b6671ca54bd4c01cb84b3f6f13cf3 (diff) | |
| download | rust-008fc79dcd821b08a1ab64f5fba40dcc4bcd3aee.tar.gz rust-008fc79dcd821b08a1ab64f5fba40dcc4bcd3aee.zip | |
Propagate `parallel_compiler` feature through rustc crates. Turned off feature gives change of builded crates: 238 -> 224.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/compile.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index e030e0bc1cf..00fc1f04342 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -689,6 +689,8 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS } 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"); } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 41e2e976162..8f076ad914d 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -729,12 +729,16 @@ impl Build { /// Gets the space-separated set of activated features for the compiler. fn rustc_features(&self, kind: Kind) -> String { - let mut features = String::new(); + let mut features = vec![]; if self.config.jemalloc { - features.push_str("jemalloc"); + features.push("jemalloc"); } if self.config.llvm_enabled() || kind == Kind::Check { - features.push_str(" llvm"); + features.push("llvm"); + } + // keep in sync with `bootstrap/compile.rs:rustc_cargo_env` + if self.config.rustc_parallel { + features.push("rustc_use_parallel_compiler"); } // If debug logging is on, then we want the default for tracing: @@ -743,10 +747,10 @@ impl Build { // if its unset, if debug_assertions is on, then debug_logging will also be on // as well as tracing *ignoring* this feature when debug_assertions is on if !self.config.rust_debug_logging { - features.push_str(" max_level_info"); + features.push("max_level_info"); } - features + features.join(" ") } /// Component directory that Cargo will produce output into (e.g. |
