about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-28 20:41:49 +0200
committerGitHub <noreply@github.com>2022-03-28 20:41:49 +0200
commit72770efcb0e04cb645911dc194d10d216e5968c1 (patch)
tree94219aaff9cea5c105689fdf9e36d395f17b491c /src/bootstrap
parent600ec284838c52d1f6657c2cf0097b58970b133b (diff)
parent008fc79dcd821b08a1ab64f5fba40dcc4bcd3aee (diff)
downloadrust-72770efcb0e04cb645911dc194d10d216e5968c1.tar.gz
rust-72770efcb0e04cb645911dc194d10d216e5968c1.zip
Rollup merge of #93787 - klensy:really-not-a-features, r=wesleywiser
parallel_compiler: hide dependencies behind feature

Separate dependencies for `parallel_compiler` feature, so they will not be compiled if feature not selected, reducing number of compiled crates from 238 to 224.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/compile.rs2
-rw-r--r--src/bootstrap/lib.rs14
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.