@@ -587,7 +587,7 @@ enum Constructor<'tcx> {
587
587
/// Ranges of integer literal values (`2`, `2..=5` or `2..5`).
588
588
IntRange ( IntRange < ' tcx > ) ,
589
589
/// Ranges of non-integer literal values (`2.0..=5.2`).
590
- ConstantRange ( u128 , u128 , Ty < ' tcx > , RangeEnd , Span ) ,
590
+ ConstantRange ( & ' tcx ty :: Const < ' tcx > , & ' tcx ty :: Const < ' tcx > , Ty < ' tcx > , RangeEnd , Span ) ,
591
591
/// Array patterns of length `n`.
592
592
FixedLenSlice ( u64 ) ,
593
593
/// Slice patterns. Captures any array constructor of `length >= i + j`.
@@ -926,11 +926,7 @@ impl<'tcx> Constructor<'tcx> {
926
926
927
927
_ => match * self {
928
928
ConstantValue ( value, _) => PatKind :: Constant { value } ,
929
- ConstantRange ( lo, hi, ty, end, _) => PatKind :: Range ( PatRange {
930
- lo : ty:: Const :: from_bits ( cx. tcx , lo, ty:: ParamEnv :: empty ( ) . and ( ty) ) ,
931
- hi : ty:: Const :: from_bits ( cx. tcx , hi, ty:: ParamEnv :: empty ( ) . and ( ty) ) ,
932
- end,
933
- } ) ,
929
+ ConstantRange ( lo, hi, _, end, _) => PatKind :: Range ( PatRange { lo, hi, end } ) ,
934
930
IntRange ( ref range) => {
935
931
return range. to_pat ( cx. tcx ) ;
936
932
}
@@ -1719,9 +1715,14 @@ fn pat_constructor<'tcx>(
1719
1715
}
1720
1716
PatKind :: Range ( PatRange { lo, hi, end } ) => {
1721
1717
let ty = lo. ty ;
1722
- let lo = lo. eval_bits ( tcx, param_env, lo. ty ) ;
1723
- let hi = hi. eval_bits ( tcx, param_env, hi. ty ) ;
1724
- if let Some ( int_range) = IntRange :: from_range ( tcx, lo, hi, ty, & end, pat. span ) {
1718
+ if let Some ( int_range) = IntRange :: from_range (
1719
+ tcx,
1720
+ lo. eval_bits ( tcx, param_env, lo. ty ) ,
1721
+ hi. eval_bits ( tcx, param_env, hi. ty ) ,
1722
+ ty,
1723
+ & end,
1724
+ pat. span ,
1725
+ ) {
1725
1726
Some ( IntRange ( int_range) )
1726
1727
} else {
1727
1728
Some ( ConstantRange ( lo, hi, ty, end, pat. span ) )
@@ -2108,10 +2109,9 @@ fn constructor_covered_by_range<'tcx>(
2108
2109
PatKind :: Range ( PatRange { lo, hi, end } ) => ( lo, hi, end, lo. ty ) ,
2109
2110
_ => bug ! ( "`constructor_covered_by_range` called with {:?}" , pat) ,
2110
2111
} ;
2111
- let from_bits = |bits| ty:: Const :: from_bits ( tcx, bits, ty:: ParamEnv :: empty ( ) . and ( ty) ) ;
2112
2112
let ( ctor_from, ctor_to, ctor_end) = match * ctor {
2113
2113
ConstantValue ( value, _) => ( value, value, RangeEnd :: Included ) ,
2114
- ConstantRange ( from, to, _, ctor_end, _) => ( from_bits ( from) , from_bits ( to ) , ctor_end) ,
2114
+ ConstantRange ( from, to, _, ctor_end, _) => ( from, to , ctor_end) ,
2115
2115
_ => bug ! ( "`constructor_covered_by_range` called with {:?}" , ctor) ,
2116
2116
} ;
2117
2117
trace ! ( "constructor_covered_by_range {:#?}, {:#?}, {:#?}, {}" , ctor, pat_from, pat_to, ty) ;
0 commit comments