Skip to content

Commit a11abc6

Browse files
committed
Simplify return block computation
1 parent a0fa287 commit a11abc6

File tree

1 file changed

+4
-6
lines changed
  • compiler/rustc_mir_build/src/build/matches

1 file changed

+4
-6
lines changed

compiler/rustc_mir_build/src/build/matches/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13151315

13161316
let mut next_prebinding = start_block;
13171317
let mut reachable = true;
1318-
let mut last_reachable_candidate = None;
1318+
let mut return_block = None;
13191319

13201320
for candidate in matched_candidates.iter_mut() {
13211321
assert!(candidate.otherwise_block.is_none());
@@ -1327,19 +1327,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13271327
// pre-binding block for the next candidate.
13281328
next_prebinding = self.cfg.start_new_block();
13291329
candidate.otherwise_block = Some(next_prebinding);
1330+
return_block = Some(next_prebinding);
13301331
} else {
13311332
reachable = false;
1333+
return_block = Some(self.cfg.start_new_block());
13321334
}
1333-
last_reachable_candidate = Some(candidate);
13341335
} else {
13351336
candidate.pre_binding_block = Some(self.cfg.start_new_block());
13361337
}
13371338
}
13381339

1339-
last_reachable_candidate
1340-
.unwrap()
1341-
.otherwise_block
1342-
.unwrap_or_else(|| self.cfg.start_new_block())
1340+
return_block.unwrap()
13431341
}
13441342

13451343
/// Tests a candidate where there are only or-patterns left to test, or

0 commit comments

Comments
 (0)