@@ -593,8 +593,8 @@ enum Constructor<'tcx> {
593
593
ConstantValue ( & ' tcx ty:: Const < ' tcx > ) ,
594
594
/// Ranges of integer literal values (`2`, `2..=5` or `2..5`).
595
595
IntRange ( IntRange < ' tcx > ) ,
596
- /// Ranges of non-integer literal values (`2.0..=5.2`).
597
- ConstantRange ( & ' tcx ty:: Const < ' tcx > , & ' tcx ty:: Const < ' tcx > , RangeEnd ) ,
596
+ /// Ranges of floating-point literal values (`2.0..=5.2`).
597
+ FloatRange ( & ' tcx ty:: Const < ' tcx > , & ' tcx ty:: Const < ' tcx > , RangeEnd ) ,
598
598
/// Array patterns of length `n`.
599
599
FixedLenSlice ( u64 ) ,
600
600
/// Slice patterns. Captures any array constructor of `length >= i + j`.
@@ -632,7 +632,7 @@ impl<'tcx> Constructor<'tcx> {
632
632
fn subtract_ctors ( & self , other_ctors : & Vec < Constructor < ' tcx > > ) -> Vec < Constructor < ' tcx > > {
633
633
match self {
634
634
// Those constructors can only match themselves.
635
- Single | Variant ( _) | ConstantValue ( ..) | ConstantRange ( ..) => {
635
+ Single | Variant ( _) | ConstantValue ( ..) | FloatRange ( ..) => {
636
636
if other_ctors. iter ( ) . any ( |c| c == self ) { vec ! [ ] } else { vec ! [ self . clone( ) ] }
637
637
}
638
638
& FixedLenSlice ( self_len) => {
@@ -727,7 +727,7 @@ impl<'tcx> Constructor<'tcx> {
727
727
}
728
728
}
729
729
730
- // Convert the ranges back into constructors
730
+ // Convert the ranges back into constructors.
731
731
remaining_ranges. into_iter ( ) . map ( IntRange ) . collect ( )
732
732
}
733
733
// This constructor is never covered by anything else
@@ -805,7 +805,7 @@ impl<'tcx> Constructor<'tcx> {
805
805
}
806
806
_ => bug ! ( "bad slice pattern {:?} {:?}" , self , ty) ,
807
807
} ,
808
- ConstantValue ( ..) | ConstantRange ( ..) | IntRange ( ..) | NonExhaustive => vec ! [ ] ,
808
+ ConstantValue ( ..) | FloatRange ( ..) | IntRange ( ..) | NonExhaustive => vec ! [ ] ,
809
809
}
810
810
}
811
811
@@ -830,7 +830,7 @@ impl<'tcx> Constructor<'tcx> {
830
830
} ,
831
831
FixedLenSlice ( length) => * length,
832
832
VarLenSlice ( prefix, suffix) => prefix + suffix,
833
- ConstantValue ( ..) | ConstantRange ( ..) | IntRange ( ..) | NonExhaustive => 0 ,
833
+ ConstantValue ( ..) | FloatRange ( ..) | IntRange ( ..) | NonExhaustive => 0 ,
834
834
}
835
835
}
836
836
@@ -894,10 +894,8 @@ impl<'tcx> Constructor<'tcx> {
894
894
PatKind :: Slice { prefix, slice : Some ( wild) , suffix }
895
895
}
896
896
& ConstantValue ( value) => PatKind :: Constant { value } ,
897
- & ConstantRange ( lo, hi, end) => PatKind :: Range ( PatRange { lo, hi, end } ) ,
898
- IntRange ( range) => {
899
- return range. to_pat ( cx. tcx ) ;
900
- }
897
+ & FloatRange ( lo, hi, end) => PatKind :: Range ( PatRange { lo, hi, end } ) ,
898
+ IntRange ( range) => return range. to_pat ( cx. tcx ) ,
901
899
NonExhaustive => PatKind :: Wild ,
902
900
} ;
903
901
@@ -1297,7 +1295,7 @@ impl<'tcx> IntRange<'tcx> {
1297
1295
let ( lo, hi) = ( lo ^ bias, hi ^ bias) ;
1298
1296
let offset = ( * end == RangeEnd :: Excluded ) as u128 ;
1299
1297
if lo > hi || ( lo == hi && * end == RangeEnd :: Excluded ) {
1300
- // This hould have been caught earlier by E0030
1298
+ // This should have been caught earlier by E0030.
1301
1299
bug ! ( "malformed range pattern: {}..={}" , lo, ( hi - offset) ) ;
1302
1300
}
1303
1301
Some ( IntRange { range : lo..=( hi - offset) , ty, span } )
@@ -1692,7 +1690,7 @@ fn pat_constructor<'tcx>(
1692
1690
) {
1693
1691
Some ( IntRange ( int_range) )
1694
1692
} else {
1695
- Some ( ConstantRange ( lo, hi, end) )
1693
+ Some ( FloatRange ( lo, hi, end) )
1696
1694
}
1697
1695
}
1698
1696
PatKind :: Array { .. } => match pat. ty . kind {
@@ -2091,7 +2089,7 @@ fn constructor_covered_by_range<'tcx>(
2091
2089
} ;
2092
2090
let ( ctor_from, ctor_to, ctor_end) = match * ctor {
2093
2091
ConstantValue ( value) => ( value, value, RangeEnd :: Included ) ,
2094
- ConstantRange ( from, to, ctor_end) => ( from, to, ctor_end) ,
2092
+ FloatRange ( from, to, ctor_end) => ( from, to, ctor_end) ,
2095
2093
_ => bug ! ( "`constructor_covered_by_range` called with {:?}" , ctor) ,
2096
2094
} ;
2097
2095
trace ! ( "constructor_covered_by_range {:#?}, {:#?}, {:#?}, {}" , ctor, pat_from, pat_to, ty) ;
0 commit comments