@@ -1118,8 +1118,7 @@ fn all_constructors<'a, 'tcx>(
1118
1118
debug ! ( "all_constructors({:?})" , pcx. ty) ;
1119
1119
let make_range = |start, end| {
1120
1120
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.
1123
1122
IntRange :: from_range ( cx. tcx , start, end, pcx. ty , & RangeEnd :: Included , pcx. span )
1124
1123
. unwrap ( ) ,
1125
1124
)
@@ -1318,13 +1317,12 @@ impl<'tcx> IntRange<'tcx> {
1318
1317
// which makes the interval arithmetic simpler.
1319
1318
let bias = IntRange :: signed_bias ( tcx, ty) ;
1320
1319
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) ) ;
1327
1324
}
1325
+ Some ( IntRange { range : lo..=( hi - offset) , ty, span } )
1328
1326
} else {
1329
1327
None
1330
1328
}
0 commit comments