Rollup merge of #85297 - infinity0:master, r=Mark-Simulacrum

bootstrap: build cargo only if requested in tools

In Debian we'd like to build rustfmt and clippy alongside rustc, but we're still excluding cargo from the rustc build and doing that separately. This patch makes that possible.
This commit is contained in:
Jack Huey 2021-05-18 22:36:08 -04:00 committed by GitHub
commit f66b6c2e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<'_>) {