Skip to content

Commit 7a57d88

Browse files
authored
Rollup merge of rust-lang#109295 - ozkanonur:issue-109286, r=ozkanonur
refactor `fn bootstrap::builder::Builder::compiler_for` logic - check compiler stage before forcing for stage2. - check if download_rustc is not set before forcing for stage1. resolves rust-lang#109286
2 parents 70918ec + 2ec7f6c commit 7a57d88

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/bootstrap/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,9 @@ impl<'a> Builder<'a> {
919919
host: TargetSelection,
920920
target: TargetSelection,
921921
) -> Compiler {
922-
if self.build.force_use_stage2() {
922+
if self.build.force_use_stage2(stage) {
923923
self.compiler(2, self.config.build)
924-
} else if self.build.force_use_stage1(Compiler { stage, host }, target) {
924+
} else if self.build.force_use_stage1(stage, target) {
925925
self.compiler(1, self.config.build)
926926
} else {
927927
self.compiler(stage, host)

src/bootstrap/lib.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1204,19 +1204,20 @@ impl Build {
12041204
///
12051205
/// When all of these conditions are met the build will lift artifacts from
12061206
/// the previous stage forward.
1207-
fn force_use_stage1(&self, compiler: Compiler, target: TargetSelection) -> bool {
1207+
fn force_use_stage1(&self, stage: u32, target: TargetSelection) -> bool {
12081208
!self.config.full_bootstrap
1209-
&& compiler.stage >= 2
1209+
&& !self.config.download_rustc()
1210+
&& stage >= 2
12101211
&& (self.hosts.iter().any(|h| *h == target) || target == self.build)
12111212
}
12121213

12131214
/// Checks whether the `compiler` compiling for `target` should be forced to
12141215
/// use a stage2 compiler instead.
12151216
///
1216-
/// When we download the pre-compiled version of rustc it should be forced to
1217-
/// use a stage2 compiler.
1218-
fn force_use_stage2(&self) -> bool {
1219-
self.config.download_rustc()
1217+
/// When we download the pre-compiled version of rustc and compiler stage is >= 2,
1218+
/// it should be forced to use a stage2 compiler.
1219+
fn force_use_stage2(&self, stage: u32) -> bool {
1220+
self.config.download_rustc() && stage >= 2
12201221
}
12211222

12221223
/// Given `num` in the form "a.b.c" return a "release string" which

0 commit comments

Comments
 (0)