Explain how we get to skip checking for cleanup blocks in the visitor

This commit is contained in:
Ben Kimock 2023-03-25 13:58:49 -04:00
parent 06e674313b
commit 88e78aba82

View file

@ -273,6 +273,8 @@ pub fn remove_duplicate_unreachable_blocks<'tcx>(tcx: TyCtxt<'tcx>, body: &mut B
fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Location) {
for target in terminator.successors_mut() {
// We don't have to check whether `target` is a cleanup block, because have
// entirely excluded cleanup blocks in building the set of duplicates.
if self.duplicates.contains(target) {
*target = self.duplicates[0];
}