@@ -20,7 +20,7 @@ use crate::ty::{
2020 self , AdtDef , AdtKind , Binder , BindingMode , BoundVar , CanonicalPolyFnSig ,
2121 ClosureSizeProfileData , Const , ConstVid , DefIdTree , ExistentialPredicate , FloatTy , FloatVar ,
2222 FloatVid , GenericParamDefKind , InferConst , InferTy , IntTy , IntVar , IntVid , List , ParamConst ,
23- ParamTy , PolyFnSig , Predicate , PredicateInner , PredicateKind , ProjectionTy , Region , RegionKind ,
23+ ParamTy , PolyFnSig , Predicate , PredicateKind , PredicateS , ProjectionTy , Region , RegionKind ,
2424 ReprOptions , TraitObjectVisitor , Ty , TyKind , TyS , TyVar , TyVid , TypeAndMut , UintTy ,
2525} ;
2626use rustc_ast as ast;
@@ -107,7 +107,7 @@ pub struct CtxtInterners<'tcx> {
107107 region : InternedSet < ' tcx , RegionKind > ,
108108 poly_existential_predicates :
109109 InternedSet < ' tcx , List < ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > > > ,
110- predicate : InternedSet < ' tcx , PredicateInner < ' tcx > > ,
110+ predicate : InternedSet < ' tcx , PredicateS < ' tcx > > ,
111111 predicates : InternedSet < ' tcx , List < Predicate < ' tcx > > > ,
112112 projs : InternedSet < ' tcx , List < ProjectionKind > > ,
113113 place_elems : InternedSet < ' tcx , List < PlaceElem < ' tcx > > > ,
@@ -170,23 +170,22 @@ impl<'tcx> CtxtInterners<'tcx> {
170170 }
171171
172172 #[ inline( never) ]
173- fn intern_predicate (
174- & self ,
175- kind : Binder < ' tcx , PredicateKind < ' tcx > > ,
176- ) -> & ' tcx PredicateInner < ' tcx > {
177- self . predicate
178- . intern ( kind, |kind| {
179- let flags = super :: flags:: FlagComputation :: for_predicate ( kind) ;
180-
181- let predicate_struct = PredicateInner {
182- kind,
183- flags : flags. flags ,
184- outer_exclusive_binder : flags. outer_exclusive_binder ,
185- } ;
173+ fn intern_predicate ( & self , kind : Binder < ' tcx , PredicateKind < ' tcx > > ) -> Predicate < ' tcx > {
174+ Predicate ( Interned :: new_unchecked (
175+ self . predicate
176+ . intern ( kind, |kind| {
177+ let flags = super :: flags:: FlagComputation :: for_predicate ( kind) ;
186178
187- InternedInSet ( self . arena . alloc ( predicate_struct) )
188- } )
189- . 0
179+ let predicate_struct = PredicateS {
180+ kind,
181+ flags : flags. flags ,
182+ outer_exclusive_binder : flags. outer_exclusive_binder ,
183+ } ;
184+
185+ InternedInSet ( self . arena . alloc ( predicate_struct) )
186+ } )
187+ . 0 ,
188+ ) )
190189 }
191190}
192191
@@ -1684,7 +1683,7 @@ nop_lift! {type_; Ty<'a> => Ty<'tcx>}
16841683nop_lift_old ! { region; Region <' a> => Region <' tcx>}
16851684nop_lift_old ! { const_; & ' a Const <' a> => & ' tcx Const <' tcx>}
16861685nop_lift_old ! { const_allocation; & ' a Allocation => & ' tcx Allocation }
1687- nop_lift_old ! { predicate; & ' a PredicateInner <' a> => & ' tcx PredicateInner <' tcx>}
1686+ nop_lift ! { predicate; Predicate <' a> => Predicate <' tcx>}
16881687
16891688nop_list_lift ! { type_list; Ty <' a> => Ty <' tcx>}
16901689nop_list_lift ! { poly_existential_predicates; ty:: Binder <' a, ExistentialPredicate <' a>> => ty:: Binder <' tcx, ExistentialPredicate <' tcx>>}
@@ -2040,23 +2039,23 @@ impl<'tcx> Hash for InternedInSet<'tcx, TyS<'tcx>> {
20402039 }
20412040}
20422041
2043- impl < ' tcx > Borrow < Binder < ' tcx , PredicateKind < ' tcx > > > for InternedInSet < ' tcx , PredicateInner < ' tcx > > {
2042+ impl < ' tcx > Borrow < Binder < ' tcx , PredicateKind < ' tcx > > > for InternedInSet < ' tcx , PredicateS < ' tcx > > {
20442043 fn borrow < ' a > ( & ' a self ) -> & ' a Binder < ' tcx , PredicateKind < ' tcx > > {
20452044 & self . 0 . kind
20462045 }
20472046}
20482047
2049- impl < ' tcx > PartialEq for InternedInSet < ' tcx , PredicateInner < ' tcx > > {
2050- fn eq ( & self , other : & InternedInSet < ' tcx , PredicateInner < ' tcx > > ) -> bool {
2048+ impl < ' tcx > PartialEq for InternedInSet < ' tcx , PredicateS < ' tcx > > {
2049+ fn eq ( & self , other : & InternedInSet < ' tcx , PredicateS < ' tcx > > ) -> bool {
20512050 // The `Borrow` trait requires that `x.borrow() == y.borrow()` equals
20522051 // `x == y`.
20532052 self . 0 . kind == other. 0 . kind
20542053 }
20552054}
20562055
2057- impl < ' tcx > Eq for InternedInSet < ' tcx , PredicateInner < ' tcx > > { }
2056+ impl < ' tcx > Eq for InternedInSet < ' tcx , PredicateS < ' tcx > > { }
20582057
2059- impl < ' tcx > Hash for InternedInSet < ' tcx , PredicateInner < ' tcx > > {
2058+ impl < ' tcx > Hash for InternedInSet < ' tcx , PredicateS < ' tcx > > {
20602059 fn hash < H : Hasher > ( & self , s : & mut H ) {
20612060 // The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`.
20622061 self . 0 . kind . hash ( s)
@@ -2237,8 +2236,7 @@ impl<'tcx> TyCtxt<'tcx> {
22372236
22382237 #[ inline]
22392238 pub fn mk_predicate ( self , binder : Binder < ' tcx , PredicateKind < ' tcx > > ) -> Predicate < ' tcx > {
2240- let inner = self . interners . intern_predicate ( binder) ;
2241- Predicate { inner }
2239+ self . interners . intern_predicate ( binder)
22422240 }
22432241
22442242 #[ inline]
0 commit comments