1
Fork 0

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 <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2025-03-02 08:27:40 +00:00
parent ad27045c31
commit ef028d79d6
2 changed files with 5 additions and 5 deletions

View file

@ -993,7 +993,9 @@ impl Step for Rustc {
fn make_run(run: RunConfig<'_>) {
let crates = run.cargo_crates_in_set();
run.builder.ensure(Rustc {
compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),
compiler: run
.builder
.compiler(run.builder.top_stage.saturating_sub(1), run.build_triple()),
target: run.target,
crates,
});
@ -1902,7 +1904,7 @@ impl Step for Assemble {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Assemble {
target_compiler: run.builder.compiler(run.builder.top_stage + 1, run.target),
target_compiler: run.builder.compiler(run.builder.top_stage, run.target),
});
}

View file

@ -664,15 +664,13 @@ mod dist {
std!(TEST_TRIPLE_1 => TEST_TRIPLE_3, stage = 2),
]
);
assert_eq!(builder.cache.all::<compile::Assemble>().len(), 5);
assert_eq!(builder.cache.all::<compile::Assemble>().len(), 4);
assert_eq!(
first(builder.cache.all::<compile::Rustc>()),
&[
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 2),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 2),
]
);
}