diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-03-23 00:00:33 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-23 00:00:33 +0530 |
| commit | 7a57d8883e97bf66cf7dbfd05c43c7355db20e0a (patch) | |
| tree | 550129ad9d565b72d20b0096b0f66f5336890edf | |
| parent | 70918ecf06ff8b5da15e7e4793a5a4e8a433eb1a (diff) | |
| parent | 2ec7f6c8d54e821303ba5a3da31858dbe009e283 (diff) | |
| download | rust-7a57d8883e97bf66cf7dbfd05c43c7355db20e0a.tar.gz rust-7a57d8883e97bf66cf7dbfd05c43c7355db20e0a.zip | |
Rollup merge of #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 #109286
| -rw-r--r-- | src/bootstrap/builder.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 13 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index cbf0f1c37a2..83a6d0ad292 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -919,9 +919,9 @@ impl<'a> Builder<'a> { host: TargetSelection, target: TargetSelection, ) -> Compiler { - if self.build.force_use_stage2() { + if self.build.force_use_stage2(stage) { self.compiler(2, self.config.build) - } else if self.build.force_use_stage1(Compiler { stage, host }, target) { + } else if self.build.force_use_stage1(stage, target) { self.compiler(1, self.config.build) } else { self.compiler(stage, host) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 47a970c782e..54aa5a585bb 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1204,19 +1204,20 @@ impl Build { /// /// When all of these conditions are met the build will lift artifacts from /// the previous stage forward. - fn force_use_stage1(&self, compiler: Compiler, target: TargetSelection) -> bool { + fn force_use_stage1(&self, stage: u32, target: TargetSelection) -> bool { !self.config.full_bootstrap - && compiler.stage >= 2 + && !self.config.download_rustc() + && stage >= 2 && (self.hosts.iter().any(|h| *h == target) || target == self.build) } /// Checks whether the `compiler` compiling for `target` should be forced to /// use a stage2 compiler instead. /// - /// When we download the pre-compiled version of rustc it should be forced to - /// use a stage2 compiler. - fn force_use_stage2(&self) -> bool { - self.config.download_rustc() + /// When we download the pre-compiled version of rustc and compiler stage is >= 2, + /// it should be forced to use a stage2 compiler. + fn force_use_stage2(&self, stage: u32) -> bool { + self.config.download_rustc() && stage >= 2 } /// Given `num` in the form "a.b.c" return a "release string" which |
