Skip to content

Commit 2a3776d

Browse files
committed
It's fine to assign otherwise_blocks to unreachable candidates
1 parent 6993e19 commit 2a3776d

File tree

1 file changed

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

1 file changed

+4
-11
lines changed

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,24 +1314,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13141314
}
13151315

13161316
let mut next_prebinding = start_block;
1317-
let mut reachable = true;
1318-
13191317
for candidate in matched_candidates.iter_mut() {
13201318
assert!(candidate.otherwise_block.is_none());
13211319
assert!(candidate.pre_binding_block.is_none());
13221320
candidate.pre_binding_block = Some(next_prebinding);
13231321
next_prebinding = self.cfg.start_new_block();
1324-
if reachable {
1325-
if candidate.has_guard {
1326-
// Create the otherwise block for this candidate, which is the
1327-
// pre-binding block for the next candidate.
1328-
candidate.otherwise_block = Some(next_prebinding);
1329-
} else {
1330-
reachable = false;
1331-
}
1322+
if candidate.has_guard {
1323+
// Create the otherwise block for this candidate, which is the
1324+
// pre-binding block for the next candidate.
1325+
candidate.otherwise_block = Some(next_prebinding);
13321326
}
13331327
}
1334-
13351328
next_prebinding
13361329
}
13371330

0 commit comments

Comments
 (0)