Rollup merge of #149724 - Kobzol:libstd-text-staging, r=jieyouxu

Fix off-by-one staging output when testing the library

It seems generally useful to store the `Mode` in `Cargo`, I remember thinking a few times that it would be useful in other places.

Fixes: https://github.com/rust-lang/rust/issues/149558

r? `@jieyouxu`
This commit is contained in:
Matthias Krüger 2025-12-07 08:26:51 +01:00 committed by GitHub
commit 1eef811747
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View file

@ -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(

View file

@ -98,6 +98,7 @@ pub struct Cargo {
command: BootstrapCommand,
args: Vec<OsString>,
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,