Add compiler_for_std

This commit is contained in:
Jakub Beránek 2025-08-26 10:13:55 +02:00
parent 31e900b78f
commit edcdb80914
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
4 changed files with 13 additions and 3 deletions

View file

@ -150,7 +150,7 @@ impl Step for Std {
trace!(force_recompile);
run.builder.ensure(Std {
build_compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),
build_compiler: run.builder.compiler_for_std(run.builder.top_stage, run.target),
target: run.target,
crates,
force_recompile,

View file

@ -115,7 +115,7 @@ impl Step for JsonDocs {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(JsonDocs {
build_compiler: run.builder.compiler(run.builder.top_stage, run.builder.host_target),
build_compiler: run.builder.compiler_for_std(run.builder.top_stage, run.target),
target: run.target,
});
}

View file

@ -616,7 +616,9 @@ impl Step for Std {
return;
}
run.builder.ensure(Std {
build_compiler: run.builder.compiler(run.builder.top_stage, run.builder.host_target),
build_compiler: run
.builder
.compiler_for_std(run.builder.top_stage, run.builder.host_target),
target: run.target,
format: if run.builder.config.cmd.json() {
DocumentationFormat::Json

View file

@ -1360,6 +1360,14 @@ impl<'a> Builder<'a> {
self.ensure(compile::Assemble { target_compiler: Compiler::new(stage, host) })
}
pub fn compiler_for_std(&self, stage: u32, target: TargetSelection) -> Compiler {
if compile::Std::should_be_uplifted_from_stage_1(self, stage, target) {
self.compiler(1, self.host_target)
} else {
self.compiler(stage, self.host_target)
}
}
/// Similar to `compiler`, except handles the full-bootstrap option to
/// silently use the stage1 compiler instead of a stage2 compiler if one is
/// requested.