@@ -1221,23 +1221,28 @@ pub struct ParamEnv<'tcx> {
12211221 /// want `Reveal::All`.
12221222 ///
12231223 /// 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 > ,
12251225}
12261226
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 {
12281233 const BITS : usize = 1 ;
12291234 #[ inline]
12301235 fn into_usize ( self ) -> usize {
12311236 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 ,
12341239 }
12351240 }
12361241 #[ inline]
12371242 unsafe fn from_usize ( ptr : usize ) -> Self {
12381243 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 } ,
12411246 _ => std:: hint:: unreachable_unchecked ( ) ,
12421247 }
12431248 }
@@ -1290,7 +1295,7 @@ impl<'tcx> ParamEnv<'tcx> {
12901295
12911296 #[ inline]
12921297 pub fn reveal ( self ) -> traits:: Reveal {
1293- self . packed . tag ( )
1298+ self . packed . tag ( ) . reveal
12941299 }
12951300
12961301 /// Construct a trait environment with no where-clauses in scope
@@ -1308,11 +1313,11 @@ impl<'tcx> ParamEnv<'tcx> {
13081313 /// Construct a trait environment with the given set of predicates.
13091314 #[ inline]
13101315 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 } ) }
13121317 }
13131318
13141319 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 ( ) } ) ;
13161321 self
13171322 }
13181323
@@ -1326,7 +1331,7 @@ impl<'tcx> ParamEnv<'tcx> {
13261331 /// will be normalized to their underlying types.
13271332 /// See PR #65989 and issue #65918 for more details
13281333 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 {
13301335 return self ;
13311336 }
13321337
0 commit comments