@@ -21,9 +21,9 @@ use crate::ty::{
21
21
self , AdtDef , AdtDefData , AdtKind , Binder , BindingMode , BoundVar , CanonicalPolyFnSig ,
22
22
ClosureSizeProfileData , Const , ConstS , DefIdTree , FloatTy , FloatVar , FloatVid ,
23
23
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 ,
27
27
} ;
28
28
use crate :: ty:: { GenericArg , GenericArgKind , InternalSubsts , SubstsRef , UserSubsts } ;
29
29
use rustc_ast as ast;
@@ -145,7 +145,7 @@ pub struct CtxtInterners<'tcx> {
145
145
canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo < ' tcx > > > ,
146
146
region : InternedSet < ' tcx , RegionKind < ' tcx > > ,
147
147
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 > > > > ,
149
149
predicates : InternedSet < ' tcx , List < Predicate < ' tcx > > > ,
150
150
projs : InternedSet < ' tcx , List < ProjectionKind > > ,
151
151
place_elems : InternedSet < ' tcx , List < PlaceElem < ' tcx > > > ,
@@ -245,16 +245,12 @@ impl<'tcx> CtxtInterners<'tcx> {
245
245
let stable_hash =
246
246
self . stable_hash ( & flags, sess, definitions, cstore, source_span, & kind) ;
247
247
248
- let predicate_struct = PredicateS {
249
- kind,
248
+ InternedInSet ( self . arena . alloc ( WithCachedTypeInfo {
249
+ internee : kind,
250
+ stable_hash,
250
251
flags : flags. flags ,
251
252
outer_exclusive_binder : flags. outer_exclusive_binder ,
252
- } ;
253
-
254
- InternedInSet (
255
- self . arena
256
- . alloc ( WithCachedTypeInfo { internee : predicate_struct, stable_hash } ) ,
257
- )
253
+ } ) )
258
254
} )
259
255
. 0 ,
260
256
) )
@@ -2191,27 +2187,32 @@ impl<'tcx> Hash for InternedInSet<'tcx, WithCachedTypeInfo<TyKind<'tcx>>> {
2191
2187
}
2192
2188
2193
2189
impl < ' tcx > Borrow < Binder < ' tcx , PredicateKind < ' tcx > > >
2194
- for InternedInSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > >
2190
+ for InternedInSet < ' tcx , WithCachedTypeInfo < ty :: Binder < ' tcx , PredicateKind < ' tcx > > > >
2195
2191
{
2196
2192
fn borrow < ' a > ( & ' a self ) -> & ' a Binder < ' tcx , PredicateKind < ' tcx > > {
2197
- & self . 0 . kind
2193
+ & self . 0 . internee
2198
2194
}
2199
2195
}
2200
2196
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 {
2203
2204
// The `Borrow` trait requires that `x.borrow() == y.borrow()` equals
2204
2205
// `x == y`.
2205
- self . 0 . kind == other. 0 . kind
2206
+ self . 0 . internee == other. 0 . internee
2206
2207
}
2207
2208
}
2208
2209
2209
- impl < ' tcx > Eq for InternedInSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > > { }
2210
+ impl < ' tcx > Eq for InternedInSet < ' tcx , WithCachedTypeInfo < ty :: Binder < ' tcx , PredicateKind < ' tcx > > > > { }
2210
2211
2211
- impl < ' tcx > Hash for InternedInSet < ' tcx , WithCachedTypeInfo < PredicateS < ' tcx > > > {
2212
+ impl < ' tcx > Hash for InternedInSet < ' tcx , WithCachedTypeInfo < ty :: Binder < ' tcx , PredicateKind < ' tcx > > > > {
2212
2213
fn hash < H : Hasher > ( & self , s : & mut H ) {
2213
2214
// The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`.
2214
- self . 0 . kind . hash ( s)
2215
+ self . 0 . internee . hash ( s)
2215
2216
}
2216
2217
}
2217
2218
0 commit comments