Skip to content

Commit 3b4c960

Browse files
onur-ozkanLorrensP-2158466
authored andcommitted
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 1e2493b commit 3b4c960

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,9 @@ impl Step for Rustc {
994994
fn make_run(run: RunConfig<'_>) {
995995
let crates = run.cargo_crates_in_set();
996996
run.builder.ensure(Rustc {
997-
compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),
997+
compiler: run
998+
.builder
999+
.compiler(run.builder.top_stage.saturating_sub(1), run.build_triple()),
9981000
target: run.target,
9991001
crates,
10001002
});
@@ -1911,7 +1913,7 @@ impl Step for Assemble {
19111913

19121914
fn make_run(run: RunConfig<'_>) {
19131915
run.builder.ensure(Assemble {
1914-
target_compiler: run.builder.compiler(run.builder.top_stage + 1, run.target),
1916+
target_compiler: run.builder.compiler(run.builder.top_stage, run.target),
19151917
});
19161918
}
19171919

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

Lines changed: 1 addition & 3 deletions
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)