@@ -1156,6 +1156,7 @@ fn all_constructors<'a, 'tcx>(
1156
1156
pcx : PatCtxt < ' tcx > ,
1157
1157
) -> Vec < Constructor < ' tcx > > {
1158
1158
debug ! ( "all_constructors({:?})" , pcx. ty) ;
1159
+ let make_range = |start, end| ConstantRange ( start, end, pcx. ty , RangeEnd :: Included , pcx. span ) ;
1159
1160
match pcx. ty . kind {
1160
1161
ty:: Bool => [ true , false ]
1161
1162
. iter ( )
@@ -1219,20 +1220,8 @@ fn all_constructors<'a, 'tcx>(
1219
1220
ty:: Char => {
1220
1221
vec ! [
1221
1222
// The valid Unicode Scalar Value ranges.
1222
- ConstantRange (
1223
- '\u{0000}' as u128 ,
1224
- '\u{D7FF}' as u128 ,
1225
- cx. tcx. types. char ,
1226
- RangeEnd :: Included ,
1227
- pcx. span,
1228
- ) ,
1229
- ConstantRange (
1230
- '\u{E000}' as u128 ,
1231
- '\u{10FFFF}' as u128 ,
1232
- cx. tcx. types. char ,
1233
- RangeEnd :: Included ,
1234
- pcx. span,
1235
- ) ,
1223
+ make_range( '\u{0000}' as u128 , '\u{D7FF}' as u128 ) ,
1224
+ make_range( '\u{E000}' as u128 , '\u{10FFFF}' as u128 ) ,
1236
1225
]
1237
1226
}
1238
1227
ty:: Int ( _) | ty:: Uint ( _)
@@ -1248,12 +1237,12 @@ fn all_constructors<'a, 'tcx>(
1248
1237
let bits = Integer :: from_attr ( & cx. tcx , SignedInt ( ity) ) . size ( ) . bits ( ) as u128 ;
1249
1238
let min = 1u128 << ( bits - 1 ) ;
1250
1239
let max = min - 1 ;
1251
- vec ! [ ConstantRange ( min, max, pcx . ty , RangeEnd :: Included , pcx . span ) ]
1240
+ vec ! [ make_range ( min, max) ]
1252
1241
}
1253
1242
ty:: Uint ( uty) => {
1254
1243
let size = Integer :: from_attr ( & cx. tcx , UnsignedInt ( uty) ) . size ( ) ;
1255
1244
let max = truncate ( u128:: max_value ( ) , size) ;
1256
- vec ! [ ConstantRange ( 0 , max, pcx . ty , RangeEnd :: Included , pcx . span ) ]
1245
+ vec ! [ make_range ( 0 , max) ]
1257
1246
}
1258
1247
_ => {
1259
1248
if cx. is_uninhabited ( pcx. ty ) {
0 commit comments