TerminatorKind::Goto { target } => {
self.check_edge(location, *target, EdgeKind::Normal);
}
- TerminatorKind::SwitchInt { targets, values, switch_ty, discr } => {
+ TerminatorKind::SwitchInt { targets, switch_ty, discr } => {
let ty = discr.ty(&self.body.local_decls, self.tcx);
if ty != *switch_ty {
self.fail(
),
);
}
- if targets.len() != values.len() + 1 {
- self.fail(
- location,
- format!(
- "encountered `SwitchInt` terminator with {} values, but {} targets (should be values+1)",
- values.len(),
- targets.len(),
- ),
- );
- }
- for target in targets {
- self.check_edge(location, *target, EdgeKind::Normal);
+ for (_, target) in targets.iter() {
+ self.check_edge(location, target, EdgeKind::Normal);
}
+ self.check_edge(location, targets.otherwise(), EdgeKind::Normal);
}
TerminatorKind::Drop { target, unwind, .. } => {
self.check_edge(location, *target, EdgeKind::Normal);