@@ -21,9 +21,9 @@ use crate::ty::{
2121 self , AdtDef , AdtDefData , AdtKind , Binder , BindingMode , BoundVar , CanonicalPolyFnSig ,
2222 ClosureSizeProfileData , Const , ConstS , DefIdTree , FloatTy , FloatVar , FloatVid ,
2323 GenericParamDefKind , InferTy , IntTy , IntVar , IntVid , List , ParamConst , ParamTy ,
24- PolyExistentialPredicate , PolyFnSig , Predicate , PredicateKind , PredicateS , ProjectionTy ,
25- Region , RegionKind , ReprOptions , TraitObjectVisitor , Ty , TyKind , TyVar , TyVid , TypeAndMut ,
26- UintTy , Visibility ,
24+ PolyExistentialPredicate , PolyFnSig , Predicate , PredicateKind , ProjectionTy , Region ,
25+ RegionKind , ReprOptions , TraitObjectVisitor , Ty , TyKind , TyVar , TyVid , TypeAndMut , UintTy ,
26+ Visibility ,
2727} ;
2828use crate :: ty:: { GenericArg , GenericArgKind , InternalSubsts , SubstsRef , UserSubsts } ;
2929use rustc_ast as ast;
@@ -145,7 +145,7 @@ pub struct CtxtInterners<'tcx> {
145145 canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo < ' tcx > > > ,
146146 region : InternedSet < ' tcx , RegionKind < ' tcx > > ,
147147 poly_existential_predicates : InternedSet < ' tcx , List < PolyExistentialPredicate < ' tcx > > > ,
148- predicate : InternedSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > > ,
148+ predicate : InternedSet < ' tcx , WithCachedTypeInfo < ty :: Binder < ' tcx , PredicateKind < ' tcx > > > > ,
149149 predicates : InternedSet < ' tcx , List < Predicate < ' tcx > > > ,
150150 projs : InternedSet < ' tcx , List < ProjectionKind > > ,
151151 place_elems : InternedSet < ' tcx , List < PlaceElem < ' tcx > > > ,
@@ -245,16 +245,12 @@ impl<'tcx> CtxtInterners<'tcx> {
245245 let stable_hash =
246246 self . stable_hash ( & flags, sess, definitions, cstore, source_span, & kind) ;
247247
248- let predicate_struct = PredicateS {
249- kind,
248+ InternedInSet ( self . arena . alloc ( WithCachedTypeInfo {
249+ internee : kind,
250+ stable_hash,
250251 flags : flags. flags ,
251252 outer_exclusive_binder : flags. outer_exclusive_binder ,
252- } ;
253-
254- InternedInSet (
255- self . arena
256- . alloc ( WithCachedTypeInfo { internee : predicate_struct, stable_hash } ) ,
257- )
253+ } ) )
258254 } )
259255 . 0 ,
260256 ) )
@@ -2191,27 +2187,32 @@ impl<'tcx> Hash for InternedInSet<'tcx, WithCachedTypeInfo<TyKind<'tcx>>> {
21912187}
21922188
21932189impl < ' tcx > Borrow < Binder < ' tcx , PredicateKind < ' tcx > > >
2194- for InternedInSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > >
2190+ for InternedInSet < ' tcx , WithCachedTypeInfo < ty :: Binder < ' tcx , PredicateKind < ' tcx > > > >
21952191{
21962192 fn borrow < ' a > ( & ' a self ) -> & ' a Binder < ' tcx , PredicateKind < ' tcx > > {
2197- & self . 0 . kind
2193+ & self . 0 . internee
21982194 }
21992195}
22002196
2201- impl < ' tcx > PartialEq for InternedInSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > > {
2202- fn eq ( & self , other : & InternedInSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > > ) -> bool {
2197+ impl < ' tcx > PartialEq
2198+ for InternedInSet < ' tcx , WithCachedTypeInfo < ty:: Binder < ' tcx , PredicateKind < ' tcx > > > >
2199+ {
2200+ fn eq (
2201+ & self ,
2202+ other : & InternedInSet < ' tcx , WithCachedTypeInfo < ty:: Binder < ' tcx , PredicateKind < ' tcx > > > > ,
2203+ ) -> bool {
22032204 // The `Borrow` trait requires that `x.borrow() == y.borrow()` equals
22042205 // `x == y`.
2205- self . 0 . kind == other. 0 . kind
2206+ self . 0 . internee == other. 0 . internee
22062207 }
22072208}
22082209
2209- impl < ' tcx > Eq for InternedInSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > > { }
2210+ impl < ' tcx > Eq for InternedInSet < ' tcx , WithCachedTypeInfo < ty :: Binder < ' tcx , PredicateKind < ' tcx > > > > { }
22102211
2211- impl < ' tcx > Hash for InternedInSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > > {
2212+ impl < ' tcx > Hash for InternedInSet < ' tcx , WithCachedTypeInfo < ty :: Binder < ' tcx , PredicateKind < ' tcx > > > > {
22122213 fn hash < H : Hasher > ( & self , s : & mut H ) {
22132214 // The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`.
2214- self . 0 . kind . hash ( s)
2215+ self . 0 . internee . hash ( s)
22152216 }
22162217}
22172218
0 commit comments