about summary refs log tree commit diff
diff options
context:
space:
mode:
authorXimin Luo <infinity0@pwned.gg>2021-05-14 19:22:41 +0100
committerXimin Luo <infinity0@pwned.gg>2021-05-14 19:22:41 +0100
commit15aad5fcdb33a75e495a3d427228df62b6eadd5b (patch)
tree3bed883bf23e036dca3b7b333ba8446265a4b8de
parent75da570d784a798a34ff1e5048cd9a6a2fb23170 (diff)
downloadrust-15aad5fcdb33a75e495a3d427228df62b6eadd5b.tar.gz
rust-15aad5fcdb33a75e495a3d427228df62b6eadd5b.zip
bootstrap: build cargo only if requested in tools
-rw-r--r--src/bootstrap/tool.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 4f2426648fd..6fc06896257 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -593,7 +593,14 @@ impl Step for Cargo {
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         let builder = run.builder;
-        run.path("src/tools/cargo").default_condition(builder.config.extended)
+        run.path("src/tools/cargo").default_condition(
+            builder.config.extended
+                && builder.config.tools.as_ref().map_or(
+                    true,
+                    // If `tools` is set, search list for this tool.
+                    |tools| tools.iter().any(|tool| tool == "cargo"),
+                ),
+        )
     }
 
     fn make_run(run: RunConfig<'_>) {