@@ -99,10 +99,6 @@ fn expand_or_pat<'p, 'tcx>(pat: &'p Pat<'tcx>) -> Vec<&'p Pat<'tcx>> {
99
99
#[ derive( Clone , PartialEq , Eq ) ]
100
100
pub ( crate ) struct IntRange {
101
101
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 ,
106
102
}
107
103
108
104
impl IntRange {
@@ -150,7 +146,7 @@ impl IntRange {
150
146
} ?;
151
147
152
148
let val = val ^ bias;
153
- Some ( IntRange { range : val..=val, bias } )
149
+ Some ( IntRange { range : val..=val } )
154
150
}
155
151
156
152
#[ inline]
@@ -171,7 +167,7 @@ impl IntRange {
171
167
// This should have been caught earlier by E0030.
172
168
bug ! ( "malformed range pattern: {}..={}" , lo, ( hi - offset) ) ;
173
169
}
174
- IntRange { range : lo..=( hi - offset) , bias }
170
+ IntRange { range : lo..=( hi - offset) }
175
171
} )
176
172
}
177
173
@@ -194,7 +190,7 @@ impl IntRange {
194
190
let ( lo, hi) = self . boundaries ( ) ;
195
191
let ( other_lo, other_hi) = other. boundaries ( ) ;
196
192
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) } )
198
194
} else {
199
195
None
200
196
}
@@ -221,7 +217,7 @@ impl IntRange {
221
217
fn to_pat < ' tcx > ( & self , tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > ) -> Pat < ' tcx > {
222
218
let ( lo, hi) = self . boundaries ( ) ;
223
219
224
- let bias = self . bias ;
220
+ let bias = IntRange :: signed_bias ( tcx , ty ) ;
225
221
let ( lo, hi) = ( lo ^ bias, hi ^ bias) ;
226
222
227
223
let env = ty:: ParamEnv :: empty ( ) . and ( ty) ;
@@ -304,8 +300,6 @@ impl IntRange {
304
300
impl fmt:: Debug for IntRange {
305
301
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
306
302
let ( lo, hi) = self . boundaries ( ) ;
307
- let bias = self . bias ;
308
- let ( lo, hi) = ( lo ^ bias, hi ^ bias) ;
309
303
write ! ( f, "{lo}" ) ?;
310
304
write ! ( f, "{}" , RangeEnd :: Included ) ?;
311
305
write ! ( f, "{hi}" )
@@ -402,7 +396,7 @@ impl SplitIntRange {
402
396
( JustBefore ( n) , AfterMax ) => n..=u128:: MAX ,
403
397
_ => unreachable ! ( ) , // Ruled out by the sorting and filtering we did
404
398
} ;
405
- IntRange { range, bias : self . range . bias }
399
+ IntRange { range }
406
400
} )
407
401
}
408
402
}
0 commit comments