Skip to content

Commit ef028d7

Browse files
committed
do not build additional stage on compiler paths
When calling `x build compiler (or rustc) --stage N` bootstrap builds stage N+1 compiler, which is clearly not what we requested. This doesn't happen when running `x build --stage N` without explicitly targeting the compiler. The changes applied fix this issue. Signed-off-by: onur-ozkan <[email protected]>
1 parent ad27045 commit ef028d7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/bootstrap/src/core/build_steps/compile.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,9 @@ impl Step for Rustc {
993993
fn make_run(run: RunConfig<'_>) {
994994
let crates = run.cargo_crates_in_set();
995995
run.builder.ensure(Rustc {
996-
compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),
996+
compiler: run
997+
.builder
998+
.compiler(run.builder.top_stage.saturating_sub(1), run.build_triple()),
997999
target: run.target,
9981000
crates,
9991001
});
@@ -1902,7 +1904,7 @@ impl Step for Assemble {
19021904

19031905
fn make_run(run: RunConfig<'_>) {
19041906
run.builder.ensure(Assemble {
1905-
target_compiler: run.builder.compiler(run.builder.top_stage + 1, run.target),
1907+
target_compiler: run.builder.compiler(run.builder.top_stage, run.target),
19061908
});
19071909
}
19081910

src/bootstrap/src/core/builder/tests.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -664,15 +664,13 @@ mod dist {
664664
std!(TEST_TRIPLE_1 => TEST_TRIPLE_3, stage = 2),
665665
]
666666
);
667-
assert_eq!(builder.cache.all::<compile::Assemble>().len(), 5);
667+
assert_eq!(builder.cache.all::<compile::Assemble>().len(), 4);
668668
assert_eq!(
669669
first(builder.cache.all::<compile::Rustc>()),
670670
&[
671671
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
672672
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
673-
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
674673
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
675-
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
676674
]
677675
);
678676
}

0 commit comments

Comments
 (0)