Remove unneeded field from SwitchTargets
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user