@@ -1216,23 +1216,28 @@ pub struct ParamEnv<'tcx> {
1216
1216
/// want `Reveal::All`.
1217
1217
///
1218
1218
/// Note: This is packed, use the reveal() method to access it.
1219
- packed : CopyTaggedPtr < & ' tcx List < Predicate < ' tcx > > , traits :: Reveal , true > ,
1219
+ packed : CopyTaggedPtr < & ' tcx List < Predicate < ' tcx > > , ParamTag , true > ,
1220
1220
}
1221
1221
1222
- unsafe impl rustc_data_structures:: tagged_ptr:: Tag for traits:: Reveal {
1222
+ #[ derive( Copy , Clone ) ]
1223
+ struct ParamTag {
1224
+ reveal : traits:: Reveal ,
1225
+ }
1226
+
1227
+ unsafe impl rustc_data_structures:: tagged_ptr:: Tag for ParamTag {
1223
1228
const BITS : usize = 1 ;
1224
1229
#[ inline]
1225
1230
fn into_usize ( self ) -> usize {
1226
1231
match self {
1227
- traits:: Reveal :: UserFacing => 0 ,
1228
- traits:: Reveal :: All => 1 ,
1232
+ Self { reveal : traits:: Reveal :: UserFacing } => 0 ,
1233
+ Self { reveal : traits:: Reveal :: All } => 1 ,
1229
1234
}
1230
1235
}
1231
1236
#[ inline]
1232
1237
unsafe fn from_usize ( ptr : usize ) -> Self {
1233
1238
match ptr {
1234
- 0 => traits:: Reveal :: UserFacing ,
1235
- 1 => traits:: Reveal :: All ,
1239
+ 0 => Self { reveal : traits:: Reveal :: UserFacing } ,
1240
+ 1 => Self { reveal : traits:: Reveal :: All } ,
1236
1241
_ => std:: hint:: unreachable_unchecked ( ) ,
1237
1242
}
1238
1243
}
@@ -1282,7 +1287,7 @@ impl<'tcx> ParamEnv<'tcx> {
1282
1287
1283
1288
#[ inline]
1284
1289
pub fn reveal ( self ) -> traits:: Reveal {
1285
- self . packed . tag ( )
1290
+ self . packed . tag ( ) . reveal
1286
1291
}
1287
1292
1288
1293
/// Construct a trait environment with no where-clauses in scope
@@ -1300,11 +1305,11 @@ impl<'tcx> ParamEnv<'tcx> {
1300
1305
/// Construct a trait environment with the given set of predicates.
1301
1306
#[ inline]
1302
1307
pub fn new ( caller_bounds : & ' tcx List < Predicate < ' tcx > > , reveal : Reveal ) -> Self {
1303
- ty:: ParamEnv { packed : CopyTaggedPtr :: new ( caller_bounds, reveal) }
1308
+ ty:: ParamEnv { packed : CopyTaggedPtr :: new ( caller_bounds, ParamTag { reveal } ) }
1304
1309
}
1305
1310
1306
1311
pub fn with_user_facing ( mut self ) -> Self {
1307
- self . packed . set_tag ( Reveal :: UserFacing ) ;
1312
+ self . packed . set_tag ( ParamTag { reveal : Reveal :: UserFacing , .. self . packed . tag ( ) } ) ;
1308
1313
self
1309
1314
}
1310
1315
@@ -1318,7 +1323,7 @@ impl<'tcx> ParamEnv<'tcx> {
1318
1323
/// will be normalized to their underlying types.
1319
1324
/// See PR #65989 and issue #65918 for more details
1320
1325
pub fn with_reveal_all_normalized ( self , tcx : TyCtxt < ' tcx > ) -> Self {
1321
- if self . packed . tag ( ) == traits:: Reveal :: All {
1326
+ if self . packed . tag ( ) . reveal == traits:: Reveal :: All {
1322
1327
return self ;
1323
1328
}
1324
1329
0 commit comments