From 6d132d9a5d526ca74db4ca4396e7e5f8c88573ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Mon, 23 Sep 2024 07:41:58 +0000 Subject: [PATCH] Pass bootstrap cargo when `--stage 0` and `COMPILETST_FORCE_STAGE0` And stop passing `BOOTSTRAP_CARGO` as an env var, instead the provided cargo should go through `--cargo-path.` --- src/bootstrap/src/core/build_steps/test.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 8f076e5554e..dcbaf20796f 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1730,8 +1730,15 @@ fn run(self, builder: &Builder<'_>) { let is_rustdoc = suite.ends_with("rustdoc-ui") || suite.ends_with("rustdoc-js"); if mode == "run-make" { - let cargo = builder.ensure(tool::Cargo { compiler, target: compiler.host }); - cmd.arg("--cargo-path").arg(cargo); + let cargo_path = if builder.top_stage == 0 { + // If we're using `--stage 0`, we should provide the bootstrap cargo. + builder.initial_cargo.clone() + } else { + // We need to properly build cargo using the suitable stage compiler. + builder.ensure(tool::Cargo { compiler, target: compiler.host }) + }; + + cmd.arg("--cargo-path").arg(cargo_path); } // Avoid depending on rustdoc when we don't need it. @@ -2088,8 +2095,6 @@ fn run(self, builder: &Builder<'_>) { cmd.arg("--rustfix-coverage"); } - cmd.env("BOOTSTRAP_CARGO", &builder.initial_cargo); - cmd.arg("--channel").arg(&builder.config.channel); if !builder.config.omit_git_hash {