@@ -20,7 +20,7 @@ use crate::ty::{
20
20
self , AdtDef , AdtKind , Binder , BindingMode , BoundVar , CanonicalPolyFnSig ,
21
21
ClosureSizeProfileData , Const , ConstVid , DefIdTree , ExistentialPredicate , FloatTy , FloatVar ,
22
22
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 ,
24
24
ReprOptions , TraitObjectVisitor , Ty , TyKind , TyS , TyVar , TyVid , TypeAndMut , UintTy ,
25
25
} ;
26
26
use rustc_ast as ast;
@@ -107,7 +107,7 @@ pub struct CtxtInterners<'tcx> {
107
107
region : InternedSet < ' tcx , RegionKind > ,
108
108
poly_existential_predicates :
109
109
InternedSet < ' tcx , List < ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > > > ,
110
- predicate : InternedSet < ' tcx , PredicateInner < ' tcx > > ,
110
+ predicate : InternedSet < ' tcx , PredicateS < ' tcx > > ,
111
111
predicates : InternedSet < ' tcx , List < Predicate < ' tcx > > > ,
112
112
projs : InternedSet < ' tcx , List < ProjectionKind > > ,
113
113
place_elems : InternedSet < ' tcx , List < PlaceElem < ' tcx > > > ,
@@ -170,23 +170,22 @@ impl<'tcx> CtxtInterners<'tcx> {
170
170
}
171
171
172
172
#[ 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) ;
186
178
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
+ ) )
190
189
}
191
190
}
192
191
@@ -1684,7 +1683,7 @@ nop_lift! {type_; Ty<'a> => Ty<'tcx>}
1684
1683
nop_lift_old ! { region; Region <' a> => Region <' tcx>}
1685
1684
nop_lift_old ! { const_; & ' a Const <' a> => & ' tcx Const <' tcx>}
1686
1685
nop_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>}
1688
1687
1689
1688
nop_list_lift ! { type_list; Ty <' a> => Ty <' tcx>}
1690
1689
nop_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>> {
2040
2039
}
2041
2040
}
2042
2041
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 > > {
2044
2043
fn borrow < ' a > ( & ' a self ) -> & ' a Binder < ' tcx , PredicateKind < ' tcx > > {
2045
2044
& self . 0 . kind
2046
2045
}
2047
2046
}
2048
2047
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 {
2051
2050
// The `Borrow` trait requires that `x.borrow() == y.borrow()` equals
2052
2051
// `x == y`.
2053
2052
self . 0 . kind == other. 0 . kind
2054
2053
}
2055
2054
}
2056
2055
2057
- impl < ' tcx > Eq for InternedInSet < ' tcx , PredicateInner < ' tcx > > { }
2056
+ impl < ' tcx > Eq for InternedInSet < ' tcx , PredicateS < ' tcx > > { }
2058
2057
2059
- impl < ' tcx > Hash for InternedInSet < ' tcx , PredicateInner < ' tcx > > {
2058
+ impl < ' tcx > Hash for InternedInSet < ' tcx , PredicateS < ' tcx > > {
2060
2059
fn hash < H : Hasher > ( & self , s : & mut H ) {
2061
2060
// The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`.
2062
2061
self . 0 . kind . hash ( s)
@@ -2237,8 +2236,7 @@ impl<'tcx> TyCtxt<'tcx> {
2237
2236
2238
2237
#[ inline]
2239
2238
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)
2242
2240
}
2243
2241
2244
2242
#[ inline]
0 commit comments