@@ -955,11 +955,10 @@ impl<'tcx> PatRange<'tcx> {
955955 }
956956
957957 #[ inline]
958- pub fn contains ( & self , value : ty:: Value < ' tcx > , tcx : TyCtxt < ' tcx > ) -> Option < bool > {
958+ pub fn contains ( & self , valtree : ty:: ValTree < ' tcx > , tcx : TyCtxt < ' tcx > ) -> Option < bool > {
959959 use Ordering :: * ;
960- debug_assert_eq ! ( self . ty, value. ty) ;
961960 let ty = self . ty ;
962- let value = PatRangeBoundary :: Finite ( value ) ;
961+ let value = PatRangeBoundary :: Finite ( valtree ) ;
963962 // For performance, it's important to only do the second comparison if necessary.
964963 Some (
965964 match self . lo . compare_with ( value, ty, tcx) ? {
@@ -994,11 +993,13 @@ impl<'tcx> PatRange<'tcx> {
994993
995994impl < ' tcx > fmt:: Display for PatRange < ' tcx > {
996995 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
997- if let PatRangeBoundary :: Finite ( value) = & self . lo {
996+ if let & PatRangeBoundary :: Finite ( valtree) = & self . lo {
997+ let value = ty:: Value { ty : self . ty , valtree } ;
998998 write ! ( f, "{value}" ) ?;
999999 }
1000- if let PatRangeBoundary :: Finite ( value ) = & self . hi {
1000+ if let & PatRangeBoundary :: Finite ( valtree ) = & self . hi {
10011001 write ! ( f, "{}" , self . end) ?;
1002+ let value = ty:: Value { ty : self . ty , valtree } ;
10021003 write ! ( f, "{value}" ) ?;
10031004 } else {
10041005 // `0..` is parsed as an inclusive range, we must display it correctly.
@@ -1012,7 +1013,8 @@ impl<'tcx> fmt::Display for PatRange<'tcx> {
10121013/// If present, the const must be of a numeric type.
10131014#[ derive( Copy , Clone , Debug , PartialEq , HashStable , TypeVisitable ) ]
10141015pub enum PatRangeBoundary < ' tcx > {
1015- Finite ( ty:: Value < ' tcx > ) ,
1016+ /// The type if this valtree is stored in the surrounding `PatRange`.
1017+ Finite ( ty:: ValTree < ' tcx > ) ,
10161018 NegInfinity ,
10171019 PosInfinity ,
10181020}
@@ -1023,7 +1025,7 @@ impl<'tcx> PatRangeBoundary<'tcx> {
10231025 matches ! ( self , Self :: Finite ( ..) )
10241026 }
10251027 #[ inline]
1026- pub fn as_finite ( self ) -> Option < ty:: Value < ' tcx > > {
1028+ pub fn as_finite ( self ) -> Option < ty:: ValTree < ' tcx > > {
10271029 match self {
10281030 Self :: Finite ( value) => Some ( value) ,
10291031 Self :: NegInfinity | Self :: PosInfinity => None ,
0 commit comments