@@ -1219,18 +1219,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
12191219 debug ! ( "match_candidates: {:?} candidates fully matched" , fully_matched) ;
12201220 let ( matched_candidates, unmatched_candidates) = candidates. split_at_mut ( fully_matched) ;
12211221
1222- let block = if !matched_candidates. is_empty ( ) {
1223- let otherwise_block =
1224- self . select_matched_candidates ( matched_candidates, start_block, fake_borrows) ;
1225-
1226- if let Some ( last_otherwise_block) = otherwise_block {
1227- last_otherwise_block
1228- } else {
1229- self . cfg . start_new_block ( )
1230- }
1231- } else {
1232- start_block
1233- } ;
1222+ let block = self . select_matched_candidates ( matched_candidates, start_block, fake_borrows) ;
12341223
12351224 // If there are no candidates that still need testing, we're
12361225 // done. Since all matches are exhaustive, execution should
@@ -1282,11 +1271,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
12821271 matched_candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
12831272 start_block : BasicBlock ,
12841273 fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1285- ) -> Option < BasicBlock > {
1286- debug_assert ! (
1287- !matched_candidates. is_empty( ) ,
1288- "select_matched_candidates called with no candidates" ,
1289- ) ;
1274+ ) -> BasicBlock {
1275+ if matched_candidates. is_empty ( ) {
1276+ return start_block;
1277+ }
12901278 debug_assert ! (
12911279 matched_candidates. iter( ) . all( |c| c. subcandidates. is_empty( ) ) ,
12921280 "subcandidates should be empty in select_matched_candidates" ,
@@ -1356,7 +1344,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13561344 candidate. pre_binding_block = Some ( self . cfg . start_new_block ( ) ) ;
13571345 }
13581346
1359- reachable_candidates. last_mut ( ) . unwrap ( ) . otherwise_block
1347+ reachable_candidates
1348+ . last_mut ( )
1349+ . unwrap ( )
1350+ . otherwise_block
1351+ . unwrap_or_else ( || self . cfg . start_new_block ( ) )
13601352 }
13611353
13621354 /// Tests a candidate where there are only or-patterns left to test, or
0 commit comments