@@ -1107,8 +1107,7 @@ fn all_constructors<'a, 'tcx>(
1107
1107
debug ! ( "all_constructors({:?})" , pcx. ty) ;
1108
1108
let make_range = |start, end| {
1109
1109
IntRange (
1110
- // `unwrap()` is ok because we know the type is an integer and the range is
1111
- // well-formed.
1110
+ // `unwrap()` is ok because we know the type is an integer.
1112
1111
IntRange :: from_range ( cx. tcx , start, end, pcx. ty , & RangeEnd :: Included , pcx. span )
1113
1112
. unwrap ( ) ,
1114
1113
)
@@ -1265,13 +1264,12 @@ impl<'tcx> IntRange<'tcx> {
1265
1264
// which makes the interval arithmetic simpler.
1266
1265
let bias = IntRange :: signed_bias ( tcx, ty) ;
1267
1266
let ( lo, hi) = ( lo ^ bias, hi ^ bias) ;
1268
- // Make sure the interval is well-formed.
1269
- if lo > hi || lo == hi && * end == RangeEnd :: Excluded {
1270
- None
1271
- } else {
1272
- let offset = ( * end == RangeEnd :: Excluded ) as u128 ;
1273
- Some ( IntRange { range : lo..=( hi - offset) , ty, span } )
1267
+ let offset = ( * end == RangeEnd :: Excluded ) as u128 ;
1268
+ if lo > hi || ( lo == hi && * end == RangeEnd :: Excluded ) {
1269
+ // This hould have been caught earlier by E0030
1270
+ bug ! ( "malformed range pattern: {}..={}" , lo, ( hi - offset) ) ;
1274
1271
}
1272
+ Some ( IntRange { range : lo..=( hi - offset) , ty, span } )
1275
1273
} else {
1276
1274
None
1277
1275
}
0 commit comments