X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_borrowck%2Fsrc%2Ftype_check%2Fmod.rs;h=814bc275019ca0109e4e3d265406630f2cf07398;hb=39b2a41b39b445bf7efab02f6eade16135d7df85;hp=6d4ec6b726eb027f6e330b084370048445bce315;hpb=fbfc5ada029dd7892cbdb64a7f6cffee7f898385;p=rust.git diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 6d4ec6b726e..814bc275019 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -1360,25 +1360,10 @@ fn check_terminator( ); } } - TerminatorKind::SwitchInt { discr, switch_ty, .. } => { + TerminatorKind::SwitchInt { discr, .. } => { self.check_operand(discr, term_location); - let discr_ty = discr.ty(body, tcx); - if let Err(terr) = self.sub_types( - discr_ty, - *switch_ty, - term_location.to_locations(), - ConstraintCategory::Assignment, - ) { - span_mirbug!( - self, - term, - "bad SwitchInt ({:?} on {:?}): {:?}", - switch_ty, - discr_ty, - terr - ); - } + let switch_ty = discr.ty(body, tcx); if !switch_ty.is_integral() && !switch_ty.is_char() && !switch_ty.is_bool() { span_mirbug!(self, term, "bad SwitchInt discr ty {:?}", switch_ty); }