Rollup merge of #136472 - jieyouxu:pass-stage, r=Mark-Simulacrum

[`compiletest`-related cleanups 2/7] Feed stage number to compiletest directly

Reference for overall changes: https://github.com/rust-lang/rust/pull/136437
Part **2** of **7** of the *`compiletest`-related cleanups* PR series.

### Summary

- Pass stage number via new `--stage` compiletest flag directly from bootstrap, instead of deriving that info in compiletest by doing gymnastics on `--stage-id`.
- Just a cleanup, should have no functional changes.

r? bootstrap
This commit is contained in:
Jubilee 2025-02-10 00:51:52 -08:00 committed by GitHub
commit 2a608f009e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 41 additions and 38 deletions

View file

@ -1648,16 +1648,17 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
// bootstrap compiler.
// NOTE: Only stage 1 is special cased because we need the rustc_private artifacts to match the
// running compiler in stage 2 when plugins run.
let stage_id = if suite == "ui-fulldeps" && compiler.stage == 1 {
// At stage 0 (stage - 1) we are using the beta compiler. Using `self.target` can lead finding
// an incorrect compiler path on cross-targets, as the stage 0 beta compiler is always equal
// to `build.build` in the configuration.
let (stage, stage_id) = if suite == "ui-fulldeps" && compiler.stage == 1 {
// At stage 0 (stage - 1) we are using the beta compiler. Using `self.target` can lead
// finding an incorrect compiler path on cross-targets, as the stage 0 beta compiler is
// always equal to `build.build` in the configuration.
let build = builder.build.build;
compiler = builder.compiler(compiler.stage - 1, build);
format!("stage{}-{}", compiler.stage + 1, build)
let test_stage = compiler.stage + 1;
(test_stage, format!("stage{}-{}", test_stage, build))
} else {
format!("stage{}-{}", compiler.stage, target)
let stage = compiler.stage;
(stage, format!("stage{}-{}", stage, target))
};
if suite.ends_with("fulldeps") {
@ -1699,6 +1700,9 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
// compiletest currently has... a lot of arguments, so let's just pass all
// of them!
cmd.arg("--stage").arg(stage.to_string());
cmd.arg("--stage-id").arg(stage_id);
cmd.arg("--compile-lib-path").arg(builder.rustc_libdir(compiler));
cmd.arg("--run-lib-path").arg(builder.sysroot_target_libdir(compiler, target));
cmd.arg("--rustc-path").arg(builder.rustc(compiler));
@ -1767,8 +1771,9 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
} else {
builder.sysroot(compiler).to_path_buf()
};
cmd.arg("--sysroot-base").arg(sysroot);
cmd.arg("--stage-id").arg(stage_id);
cmd.arg("--suite").arg(suite);
cmd.arg("--mode").arg(mode);
cmd.arg("--target").arg(target.rustc_target_arg());