@@ -1221,23 +1221,28 @@ pub struct ParamEnv<'tcx> {
1221
1221
/// want `Reveal::All`.
1222
1222
///
1223
1223
/// Note: This is packed, use the reveal() method to access it.
1224
- packed : CopyTaggedPtr < & ' tcx List < Predicate < ' tcx > > , traits :: Reveal , true > ,
1224
+ packed : CopyTaggedPtr < & ' tcx List < Predicate < ' tcx > > , ParamTag , true > ,
1225
1225
}
1226
1226
1227
- unsafe impl rustc_data_structures:: tagged_ptr:: Tag for traits:: Reveal {
1227
+ #[ derive( Copy , Clone ) ]
1228
+ struct ParamTag {
1229
+ reveal : traits:: Reveal ,
1230
+ }
1231
+
1232
+ unsafe impl rustc_data_structures:: tagged_ptr:: Tag for ParamTag {
1228
1233
const BITS : usize = 1 ;
1229
1234
#[ inline]
1230
1235
fn into_usize ( self ) -> usize {
1231
1236
match self {
1232
- traits:: Reveal :: UserFacing => 0 ,
1233
- traits:: Reveal :: All => 1 ,
1237
+ Self { reveal : traits:: Reveal :: UserFacing } => 0 ,
1238
+ Self { reveal : traits:: Reveal :: All } => 1 ,
1234
1239
}
1235
1240
}
1236
1241
#[ inline]
1237
1242
unsafe fn from_usize ( ptr : usize ) -> Self {
1238
1243
match ptr {
1239
- 0 => traits:: Reveal :: UserFacing ,
1240
- 1 => traits:: Reveal :: All ,
1244
+ 0 => Self { reveal : traits:: Reveal :: UserFacing } ,
1245
+ 1 => Self { reveal : traits:: Reveal :: All } ,
1241
1246
_ => std:: hint:: unreachable_unchecked ( ) ,
1242
1247
}
1243
1248
}
@@ -1290,7 +1295,7 @@ impl<'tcx> ParamEnv<'tcx> {
1290
1295
1291
1296
#[ inline]
1292
1297
pub fn reveal ( self ) -> traits:: Reveal {
1293
- self . packed . tag ( )
1298
+ self . packed . tag ( ) . reveal
1294
1299
}
1295
1300
1296
1301
/// Construct a trait environment with no where-clauses in scope
@@ -1308,11 +1313,11 @@ impl<'tcx> ParamEnv<'tcx> {
1308
1313
/// Construct a trait environment with the given set of predicates.
1309
1314
#[ inline]
1310
1315
pub fn new ( caller_bounds : & ' tcx List < Predicate < ' tcx > > , reveal : Reveal ) -> Self {
1311
- ty:: ParamEnv { packed : CopyTaggedPtr :: new ( caller_bounds, reveal) }
1316
+ ty:: ParamEnv { packed : CopyTaggedPtr :: new ( caller_bounds, ParamTag { reveal } ) }
1312
1317
}
1313
1318
1314
1319
pub fn with_user_facing ( mut self ) -> Self {
1315
- self . packed . set_tag ( Reveal :: UserFacing ) ;
1320
+ self . packed . set_tag ( ParamTag { reveal : Reveal :: UserFacing , .. self . packed . tag ( ) } ) ;
1316
1321
self
1317
1322
}
1318
1323
@@ -1326,7 +1331,7 @@ impl<'tcx> ParamEnv<'tcx> {
1326
1331
/// will be normalized to their underlying types.
1327
1332
/// See PR #65989 and issue #65918 for more details
1328
1333
pub fn with_reveal_all_normalized ( self , tcx : TyCtxt < ' tcx > ) -> Self {
1329
- if self . packed . tag ( ) == traits:: Reveal :: All {
1334
+ if self . packed . tag ( ) . reveal == traits:: Reveal :: All {
1330
1335
return self ;
1331
1336
}
1332
1337
0 commit comments