From 7fdf06693a92d9d781cb794ef5b20e564f8b3eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 6 Dec 2025 22:02:23 +0100 Subject: [PATCH] Fix off-by-one staging output when testing the library --- src/bootstrap/src/core/build_steps/test.rs | 9 +++++++-- src/bootstrap/src/core/builder/cargo.rs | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 7e46b85ff9af3..eb3ea1ab51208 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2818,10 +2818,15 @@ fn run_cargo_test<'a>( builder: &Builder<'_>, ) -> bool { let compiler = cargo.compiler(); + let stage = match cargo.mode() { + Mode::Std => compiler.stage, + _ => compiler.stage + 1, + }; + let mut cargo = prepare_cargo_test(cargo, libtest_args, crates, target, builder); let _time = helpers::timeit(builder); - let _group = - description.into().and_then(|what| builder.msg_test(what, target, compiler.stage + 1)); + + let _group = description.into().and_then(|what| builder.msg_test(what, target, stage)); #[cfg(feature = "build-metrics")] builder.metrics.begin_test_suite( diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index 093a754f1a4b7..2ca52c72e5ec7 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -98,6 +98,7 @@ pub struct Cargo { command: BootstrapCommand, args: Vec, compiler: Compiler, + mode: Mode, target: TargetSelection, rustflags: Rustflags, rustdocflags: Rustflags, @@ -141,6 +142,10 @@ impl Cargo { self.compiler } + pub fn mode(&self) -> Mode { + self.mode + } + pub fn into_cmd(self) -> BootstrapCommand { self.into() } @@ -1404,6 +1409,7 @@ impl Builder<'_> { command: cargo, args: vec![], compiler, + mode, target, rustflags, rustdocflags,