about summary refs log tree commit diff
path: root/compiler/rustc_mir_build
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-06-30 12:29:46 +0200
committerNadrieril <nadrieril+git@gmail.com>2024-07-09 22:47:35 +0200
commit8a222ffd6bb37a79bf517b3552008d9695cc8ae1 (patch)
tree1add839dd64c124ad90ace068f2db062c1487853 /compiler/rustc_mir_build
parentc5062f73181778af278321827ceedf1682ee0a8b (diff)
downloadrust-8a222ffd6bb37a79bf517b3552008d9695cc8ae1.tar.gz
rust-8a222ffd6bb37a79bf517b3552008d9695cc8ae1.zip
Don't try to save an extra block
This is preparation for the next commit.
Diffstat (limited to 'compiler/rustc_mir_build')
-rw-r--r--compiler/rustc_mir_build/src/build/matches/mod.rs22
1 files changed, 9 insertions, 13 deletions
diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs
index cc8a0e4b038..458e2c5c406 100644
--- a/compiler/rustc_mir_build/src/build/matches/mod.rs
+++ b/compiler/rustc_mir_build/src/build/matches/mod.rs
@@ -2021,19 +2021,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
 
         // The block that we should branch to if none of the
         // `target_candidates` match.
-        let remainder_start = if !remaining_candidates.is_empty() {
-            let remainder_start = self.cfg.start_new_block();
-            self.match_candidates(
-                span,
-                scrutinee_span,
-                remainder_start,
-                otherwise_block,
-                remaining_candidates,
-            );
-            remainder_start
-        } else {
-            otherwise_block
-        };
+        let remainder_start = self.cfg.start_new_block();
 
         // For each outcome of test, process the candidates that still apply.
         let target_blocks: FxIndexMap<_, _> = target_candidates
@@ -2061,6 +2049,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
             &test,
             target_blocks,
         );
+
+        self.match_candidates(
+            span,
+            scrutinee_span,
+            remainder_start,
+            otherwise_block,
+            remaining_candidates,
+        );
     }
 }