@@ -594,7 +594,7 @@ enum Constructor<'tcx> {
594
594
/// Ranges of integer literal values (`2`, `2..=5` or `2..5`).
595
595
IntRange ( IntRange < ' tcx > ) ,
596
596
/// Ranges of non-integer literal values (`2.0..=5.2`).
597
- ConstantRange ( u128 , u128 , Ty < ' tcx > , RangeEnd , Span ) ,
597
+ ConstantRange ( & ' tcx ty :: Const < ' tcx > , & ' tcx ty :: Const < ' tcx > , Ty < ' tcx > , RangeEnd , Span ) ,
598
598
/// Array patterns of length `n`.
599
599
FixedLenSlice ( u64 ) ,
600
600
/// Slice patterns. Captures any array constructor of `length >= i + j`.
@@ -939,11 +939,7 @@ impl<'tcx> Constructor<'tcx> {
939
939
PatKind :: Slice { prefix, slice : Some ( wild) , suffix }
940
940
}
941
941
& ConstantValue ( value, _) => PatKind :: Constant { value } ,
942
- & ConstantRange ( lo, hi, ty, end, _) => PatKind :: Range ( PatRange {
943
- lo : ty:: Const :: from_bits ( cx. tcx , lo, ty:: ParamEnv :: empty ( ) . and ( ty) ) ,
944
- hi : ty:: Const :: from_bits ( cx. tcx , hi, ty:: ParamEnv :: empty ( ) . and ( ty) ) ,
945
- end,
946
- } ) ,
942
+ & ConstantRange ( lo, hi, _, end, _) => PatKind :: Range ( PatRange { lo, hi, end } ) ,
947
943
IntRange ( range) => {
948
944
return range. to_pat ( cx. tcx ) ;
949
945
}
@@ -1730,9 +1726,14 @@ fn pat_constructor<'tcx>(
1730
1726
}
1731
1727
PatKind :: Range ( PatRange { lo, hi, end } ) => {
1732
1728
let ty = lo. ty ;
1733
- let lo = lo. eval_bits ( tcx, param_env, lo. ty ) ;
1734
- let hi = hi. eval_bits ( tcx, param_env, hi. ty ) ;
1735
- if let Some ( int_range) = IntRange :: from_range ( tcx, lo, hi, ty, & end, pat. span ) {
1729
+ if let Some ( int_range) = IntRange :: from_range (
1730
+ tcx,
1731
+ lo. eval_bits ( tcx, param_env, lo. ty ) ,
1732
+ hi. eval_bits ( tcx, param_env, hi. ty ) ,
1733
+ ty,
1734
+ & end,
1735
+ pat. span ,
1736
+ ) {
1736
1737
Some ( IntRange ( int_range) )
1737
1738
} else {
1738
1739
Some ( ConstantRange ( lo, hi, ty, end, pat. span ) )
@@ -2132,10 +2133,9 @@ fn constructor_covered_by_range<'tcx>(
2132
2133
PatKind :: Range ( PatRange { lo, hi, end } ) => ( lo, hi, end, lo. ty ) ,
2133
2134
_ => bug ! ( "`constructor_covered_by_range` called with {:?}" , pat) ,
2134
2135
} ;
2135
- let from_bits = |bits| ty:: Const :: from_bits ( tcx, bits, ty:: ParamEnv :: empty ( ) . and ( ty) ) ;
2136
2136
let ( ctor_from, ctor_to, ctor_end) = match * ctor {
2137
2137
ConstantValue ( value, _) => ( value, value, RangeEnd :: Included ) ,
2138
- ConstantRange ( from, to, _, ctor_end, _) => ( from_bits ( from) , from_bits ( to ) , ctor_end) ,
2138
+ ConstantRange ( from, to, _, ctor_end, _) => ( from, to , ctor_end) ,
2139
2139
_ => bug ! ( "`constructor_covered_by_range` called with {:?}" , ctor) ,
2140
2140
} ;
2141
2141
trace ! ( "constructor_covered_by_range {:#?}, {:#?}, {:#?}, {}" , ctor, pat_from, pat_to, ty) ;
0 commit comments