@@ -99,10 +99,6 @@ fn expand_or_pat<'p, 'tcx>(pat: &'p Pat<'tcx>) -> Vec<&'p Pat<'tcx>> {
9999#[ derive( Clone , PartialEq , Eq ) ]
100100pub ( crate ) struct IntRange {
101101 range : RangeInclusive < u128 > ,
102- /// Keeps the bias used for encoding the range. It depends on the type of the range and
103- /// possibly the pointer size of the current architecture. The algorithm ensures we never
104- /// compare `IntRange`s with different types/architectures.
105- bias : u128 ,
106102}
107103
108104impl IntRange {
@@ -150,7 +146,7 @@ impl IntRange {
150146 } ?;
151147
152148 let val = val ^ bias;
153- Some ( IntRange { range : val..=val, bias } )
149+ Some ( IntRange { range : val..=val } )
154150 }
155151
156152 #[ inline]
@@ -171,7 +167,7 @@ impl IntRange {
171167 // This should have been caught earlier by E0030.
172168 bug ! ( "malformed range pattern: {}..={}" , lo, ( hi - offset) ) ;
173169 }
174- IntRange { range : lo..=( hi - offset) , bias }
170+ IntRange { range : lo..=( hi - offset) }
175171 } )
176172 }
177173
@@ -194,7 +190,7 @@ impl IntRange {
194190 let ( lo, hi) = self . boundaries ( ) ;
195191 let ( other_lo, other_hi) = other. boundaries ( ) ;
196192 if lo <= other_hi && other_lo <= hi {
197- Some ( IntRange { range : max ( lo, other_lo) ..=min ( hi, other_hi) , bias : self . bias } )
193+ Some ( IntRange { range : max ( lo, other_lo) ..=min ( hi, other_hi) } )
198194 } else {
199195 None
200196 }
@@ -221,7 +217,7 @@ impl IntRange {
221217 fn to_pat < ' tcx > ( & self , tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > ) -> Pat < ' tcx > {
222218 let ( lo, hi) = self . boundaries ( ) ;
223219
224- let bias = self . bias ;
220+ let bias = IntRange :: signed_bias ( tcx , ty ) ;
225221 let ( lo, hi) = ( lo ^ bias, hi ^ bias) ;
226222
227223 let env = ty:: ParamEnv :: empty ( ) . and ( ty) ;
@@ -304,8 +300,6 @@ impl IntRange {
304300impl fmt:: Debug for IntRange {
305301 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
306302 let ( lo, hi) = self . boundaries ( ) ;
307- let bias = self . bias ;
308- let ( lo, hi) = ( lo ^ bias, hi ^ bias) ;
309303 write ! ( f, "{lo}" ) ?;
310304 write ! ( f, "{}" , RangeEnd :: Included ) ?;
311305 write ! ( f, "{hi}" )
@@ -402,7 +396,7 @@ impl SplitIntRange {
402396 ( JustBefore ( n) , AfterMax ) => n..=u128:: MAX ,
403397 _ => unreachable ! ( ) , // Ruled out by the sorting and filtering we did
404398 } ;
405- IntRange { range, bias : self . range . bias }
399+ IntRange { range }
406400 } )
407401 }
408402}
0 commit comments