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.`
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-09-23 07:41:58 +00:00 committed by 许杰友 Jieyou Xu (Joe)
parent 35daf8b8aa
commit 6d132d9a5d

View File

@ -1730,8 +1730,15 @@ fn run(self, builder: &Builder<'_>) {
let is_rustdoc = suite.ends_with("rustdoc-ui") || suite.ends_with("rustdoc-js"); let is_rustdoc = suite.ends_with("rustdoc-ui") || suite.ends_with("rustdoc-js");
if mode == "run-make" { if mode == "run-make" {
let cargo = builder.ensure(tool::Cargo { compiler, target: compiler.host }); let cargo_path = if builder.top_stage == 0 {
cmd.arg("--cargo-path").arg(cargo); // 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. // Avoid depending on rustdoc when we don't need it.
@ -2088,8 +2095,6 @@ fn run(self, builder: &Builder<'_>) {
cmd.arg("--rustfix-coverage"); cmd.arg("--rustfix-coverage");
} }
cmd.env("BOOTSTRAP_CARGO", &builder.initial_cargo);
cmd.arg("--channel").arg(&builder.config.channel); cmd.arg("--channel").arg(&builder.config.channel);
if !builder.config.omit_git_hash { if !builder.config.omit_git_hash {