Remove unneeded field from SwitchTargets

This commit is contained in:
Jakob Degen
2022-12-03 16:03:27 -08:00
parent 14ca83a04b
commit 9fb8da8f8f
131 changed files with 304 additions and 388 deletions

View File

@@ -76,7 +76,7 @@ where
let terminator = match terminator_kind {
// This will unconditionally run into an unreachable and is therefore unreachable as well.
TerminatorKind::Goto { target } if is_unreachable(*target) => TerminatorKind::Unreachable,
TerminatorKind::SwitchInt { targets, discr, switch_ty } => {
TerminatorKind::SwitchInt { targets, discr } => {
let otherwise = targets.otherwise();
// If all targets are unreachable, we can be unreachable as well.
@@ -110,11 +110,7 @@ where
return None;
}
TerminatorKind::SwitchInt {
discr: discr.clone(),
switch_ty: *switch_ty,
targets: new_targets,
}
TerminatorKind::SwitchInt { discr: discr.clone(), targets: new_targets }
} else {
// If the otherwise branch is reachable, we don't want to delete any unreachable branches.
return None;