about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-22 19:04:49 +0000
committerbors <bors@rust-lang.org>2023-03-22 19:04:49 +0000
commita266f11990d9544ee408e213e1eec8cc9eb032b7 (patch)
tree8047ee2a1679b107542e980b2ffb2f1f9daf91b5 /src/bootstrap
parent439292bc7913399e406d9bb7e8da0f70c6317c6e (diff)
parenteda88a30c767d1933aaf82a83d679a245b7d26b8 (diff)
downloadrust-a266f11990d9544ee408e213e1eec8cc9eb032b7.tar.gz
rust-a266f11990d9544ee408e213e1eec8cc9eb032b7.zip
Auto merge of #109496 - Dylan-DPC:rollup-u8rsi3h, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #100311 (Fix handling of trailing bare CR in str::lines)
 - #108997 (Change text -> rust highlighting in sanitizer.md)
 - #109179 (move Option::as_slice to intrinsic)
 - #109187 (Render source page layout with Askama)
 - #109280 (Remove `VecMap`)
 - #109295 (refactor `fn bootstrap::builder::Builder::compiler_for` logic)
 - #109312 (rustdoc: Cleanup parent module tracking for doc links)
 - #109317 (Update links for custom discriminants.)
 - #109405 (RPITITs are `DefKind::Opaque` with new lowering strategy)
 - #109414 (Do not consider synthesized RPITITs on missing items checks)
 - #109435 (Detect uninhabited types early in const eval)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs4
-rw-r--r--src/bootstrap/lib.rs13
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