Skip to content

Commit edcdb80

Browse files
committed
Add compiler_for_std
1 parent 31e900b commit edcdb80

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl Step for Std {
150150
trace!(force_recompile);
151151

152152
run.builder.ensure(Std {
153-
build_compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),
153+
build_compiler: run.builder.compiler_for_std(run.builder.top_stage, run.target),
154154
target: run.target,
155155
crates,
156156
force_recompile,

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl Step for JsonDocs {
115115

116116
fn make_run(run: RunConfig<'_>) {
117117
run.builder.ensure(JsonDocs {
118-
build_compiler: run.builder.compiler(run.builder.top_stage, run.builder.host_target),
118+
build_compiler: run.builder.compiler_for_std(run.builder.top_stage, run.target),
119119
target: run.target,
120120
});
121121
}

src/bootstrap/src/core/build_steps/doc.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,9 @@ impl Step for Std {
616616
return;
617617
}
618618
run.builder.ensure(Std {
619-
build_compiler: run.builder.compiler(run.builder.top_stage, run.builder.host_target),
619+
build_compiler: run
620+
.builder
621+
.compiler_for_std(run.builder.top_stage, run.builder.host_target),
620622
target: run.target,
621623
format: if run.builder.config.cmd.json() {
622624
DocumentationFormat::Json

src/bootstrap/src/core/builder/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,14 @@ impl<'a> Builder<'a> {
13601360
self.ensure(compile::Assemble { target_compiler: Compiler::new(stage, host) })
13611361
}
13621362

1363+
pub fn compiler_for_std(&self, stage: u32, target: TargetSelection) -> Compiler {
1364+
if compile::Std::should_be_uplifted_from_stage_1(self, stage, target) {
1365+
self.compiler(1, self.host_target)
1366+
} else {
1367+
self.compiler(stage, self.host_target)
1368+
}
1369+
}
1370+
13631371
/// Similar to `compiler`, except handles the full-bootstrap option to
13641372
/// silently use the stage1 compiler instead of a stage2 compiler if one is
13651373
/// requested.

0 commit comments

Comments
 (0)