@@ -1118,8 +1118,7 @@ fn all_constructors<'a, 'tcx>(
11181118 debug ! ( "all_constructors({:?})" , pcx. ty) ;
11191119 let make_range = |start, end| {
11201120 IntRange (
1121- // `unwrap()` is ok because we know the type is an integer and the range is
1122- // well-formed.
1121+ // `unwrap()` is ok because we know the type is an integer.
11231122 IntRange :: from_range ( cx. tcx , start, end, pcx. ty , & RangeEnd :: Included , pcx. span )
11241123 . unwrap ( ) ,
11251124 )
@@ -1318,13 +1317,12 @@ impl<'tcx> IntRange<'tcx> {
13181317 // which makes the interval arithmetic simpler.
13191318 let bias = IntRange :: signed_bias ( tcx, ty) ;
13201319 let ( lo, hi) = ( lo ^ bias, hi ^ bias) ;
1321- // Make sure the interval is well-formed.
1322- if lo > hi || lo == hi && * end == RangeEnd :: Excluded {
1323- None
1324- } else {
1325- let offset = ( * end == RangeEnd :: Excluded ) as u128 ;
1326- Some ( IntRange { range : lo..=( hi - offset) , ty, span } )
1320+ let offset = ( * end == RangeEnd :: Excluded ) as u128 ;
1321+ if lo > hi || ( lo == hi && * end == RangeEnd :: Excluded ) {
1322+ // This hould have been caught earlier by E0030
1323+ bug ! ( "malformed range pattern: {}..={}" , lo, ( hi - offset) ) ;
13271324 }
1325+ Some ( IntRange { range : lo..=( hi - offset) , ty, span } )
13281326 } else {
13291327 None
13301328 }
0 commit comments