@@ -593,8 +593,8 @@ enum Constructor<'tcx> {
593593 ConstantValue ( & ' tcx ty:: Const < ' tcx > ) ,
594594 /// Ranges of integer literal values (`2`, `2..=5` or `2..5`).
595595 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 ) ,
598598 /// Array patterns of length `n`.
599599 FixedLenSlice ( u64 ) ,
600600 /// Slice patterns. Captures any array constructor of `length >= i + j`.
@@ -632,7 +632,7 @@ impl<'tcx> Constructor<'tcx> {
632632 fn subtract_ctors ( & self , other_ctors : & Vec < Constructor < ' tcx > > ) -> Vec < Constructor < ' tcx > > {
633633 match self {
634634 // Those constructors can only match themselves.
635- Single | Variant ( _) | ConstantValue ( ..) | ConstantRange ( ..) => {
635+ Single | Variant ( _) | ConstantValue ( ..) | FloatRange ( ..) => {
636636 if other_ctors. iter ( ) . any ( |c| c == self ) { vec ! [ ] } else { vec ! [ self . clone( ) ] }
637637 }
638638 & FixedLenSlice ( self_len) => {
@@ -727,7 +727,7 @@ impl<'tcx> Constructor<'tcx> {
727727 }
728728 }
729729
730- // Convert the ranges back into constructors
730+ // Convert the ranges back into constructors.
731731 remaining_ranges. into_iter ( ) . map ( IntRange ) . collect ( )
732732 }
733733 // This constructor is never covered by anything else
@@ -805,7 +805,7 @@ impl<'tcx> Constructor<'tcx> {
805805 }
806806 _ => bug ! ( "bad slice pattern {:?} {:?}" , self , ty) ,
807807 } ,
808- ConstantValue ( ..) | ConstantRange ( ..) | IntRange ( ..) | NonExhaustive => vec ! [ ] ,
808+ ConstantValue ( ..) | FloatRange ( ..) | IntRange ( ..) | NonExhaustive => vec ! [ ] ,
809809 }
810810 }
811811
@@ -830,7 +830,7 @@ impl<'tcx> Constructor<'tcx> {
830830 } ,
831831 FixedLenSlice ( length) => * length,
832832 VarLenSlice ( prefix, suffix) => prefix + suffix,
833- ConstantValue ( ..) | ConstantRange ( ..) | IntRange ( ..) | NonExhaustive => 0 ,
833+ ConstantValue ( ..) | FloatRange ( ..) | IntRange ( ..) | NonExhaustive => 0 ,
834834 }
835835 }
836836
@@ -894,10 +894,8 @@ impl<'tcx> Constructor<'tcx> {
894894 PatKind :: Slice { prefix, slice : Some ( wild) , suffix }
895895 }
896896 & 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 ) ,
901899 NonExhaustive => PatKind :: Wild ,
902900 } ;
903901
@@ -1297,7 +1295,7 @@ impl<'tcx> IntRange<'tcx> {
12971295 let ( lo, hi) = ( lo ^ bias, hi ^ bias) ;
12981296 let offset = ( * end == RangeEnd :: Excluded ) as u128 ;
12991297 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.
13011299 bug ! ( "malformed range pattern: {}..={}" , lo, ( hi - offset) ) ;
13021300 }
13031301 Some ( IntRange { range : lo..=( hi - offset) , ty, span } )
@@ -1692,7 +1690,7 @@ fn pat_constructor<'tcx>(
16921690 ) {
16931691 Some ( IntRange ( int_range) )
16941692 } else {
1695- Some ( ConstantRange ( lo, hi, end) )
1693+ Some ( FloatRange ( lo, hi, end) )
16961694 }
16971695 }
16981696 PatKind :: Array { .. } => match pat. ty . kind {
@@ -2091,7 +2089,7 @@ fn constructor_covered_by_range<'tcx>(
20912089 } ;
20922090 let ( ctor_from, ctor_to, ctor_end) = match * ctor {
20932091 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) ,
20952093 _ => bug ! ( "`constructor_covered_by_range` called with {:?}" , ctor) ,
20962094 } ;
20972095 trace ! ( "constructor_covered_by_range {:#?}, {:#?}, {:#?}, {}" , ctor, pat_from, pat_to, ty) ;
0 commit comments