Skip to content

Commit 1eef811

Browse files
authored
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: #149558 r? `@jieyouxu`
2 parents 3d4d195 + 7fdf066 commit 1eef811

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,10 +2818,15 @@ fn run_cargo_test<'a>(
28182818
builder: &Builder<'_>,
28192819
) -> bool {
28202820
let compiler = cargo.compiler();
2821+
let stage = match cargo.mode() {
2822+
Mode::Std => compiler.stage,
2823+
_ => compiler.stage + 1,
2824+
};
2825+
28212826
let mut cargo = prepare_cargo_test(cargo, libtest_args, crates, target, builder);
28222827
let _time = helpers::timeit(builder);
2823-
let _group =
2824-
description.into().and_then(|what| builder.msg_test(what, target, compiler.stage + 1));
2828+
2829+
let _group = description.into().and_then(|what| builder.msg_test(what, target, stage));
28252830

28262831
#[cfg(feature = "build-metrics")]
28272832
builder.metrics.begin_test_suite(

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ pub struct Cargo {
9898
command: BootstrapCommand,
9999
args: Vec<OsString>,
100100
compiler: Compiler,
101+
mode: Mode,
101102
target: TargetSelection,
102103
rustflags: Rustflags,
103104
rustdocflags: Rustflags,
@@ -141,6 +142,10 @@ impl Cargo {
141142
self.compiler
142143
}
143144

145+
pub fn mode(&self) -> Mode {
146+
self.mode
147+
}
148+
144149
pub fn into_cmd(self) -> BootstrapCommand {
145150
self.into()
146151
}
@@ -1404,6 +1409,7 @@ impl Builder<'_> {
14041409
command: cargo,
14051410
args: vec![],
14061411
compiler,
1412+
mode,
14071413
target,
14081414
rustflags,
14091415
rustdocflags,

0 commit comments

Comments
 (0)