@@ -17,9 +17,10 @@ use crate::ty::TyKind::*;
1717use crate :: ty:: {
1818 self , AdtDef , AdtKind , Binder , BindingMode , BoundVar , CanonicalPolyFnSig ,
1919 ClosureSizeProfileData , Const , ConstVid , DefIdTree , ExistentialPredicate , FloatTy , FloatVar ,
20- FloatVid , GenericParamDefKind , InferConst , InferTy , IntTy , IntVar , IntVid , List , ParamConst ,
21- ParamTy , PolyFnSig , Predicate , PredicateInner , PredicateKind , ProjectionTy , Region , RegionKind ,
22- ReprOptions , TraitObjectVisitor , Ty , TyKind , TyS , TyVar , TyVid , TypeAndMut , UintTy ,
20+ FloatVid , GeneratorWitnessInner , GenericParamDefKind , InferConst , InferTy , IntTy , IntVar ,
21+ IntVid , List , ParamConst , ParamTy , PolyFnSig , Predicate , PredicateInner , PredicateKind ,
22+ ProjectionPredicate , ProjectionTy , Region , RegionKind , ReprOptions , TraitObjectVisitor , Ty ,
23+ TyKind , TyS , TyVar , TyVid , TypeAndMut , UintTy ,
2324} ;
2425use rustc_ast as ast;
2526use rustc_attr as attr;
@@ -102,6 +103,7 @@ pub struct CtxtInterners<'tcx> {
102103 substs : InternedSet < ' tcx , InternalSubsts < ' tcx > > ,
103104 canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo < ' tcx > > > ,
104105 region : InternedSet < ' tcx , RegionKind > ,
106+ projection_predicates : InternedSet < ' tcx , List < ProjectionPredicate < ' tcx > > > ,
105107 poly_existential_predicates :
106108 InternedSet < ' tcx , List < ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > > > ,
107109 predicate : InternedSet < ' tcx , PredicateInner < ' tcx > > ,
@@ -129,6 +131,7 @@ impl<'tcx> CtxtInterners<'tcx> {
129131 type_list : Default :: default ( ) ,
130132 substs : Default :: default ( ) ,
131133 region : Default :: default ( ) ,
134+ projection_predicates : Default :: default ( ) ,
132135 poly_existential_predicates : Default :: default ( ) ,
133136 canonical_var_infos : Default :: default ( ) ,
134137 predicate : Default :: default ( ) ,
@@ -1654,6 +1657,7 @@ nop_lift! {const_allocation; &'a Allocation => &'tcx Allocation}
16541657nop_lift ! { predicate; & ' a PredicateInner <' a> => & ' tcx PredicateInner <' tcx>}
16551658
16561659nop_list_lift ! { type_list; Ty <' a> => Ty <' tcx>}
1660+ nop_list_lift ! { projection_predicates; ProjectionPredicate <' a> => ProjectionPredicate <' tcx>}
16571661nop_list_lift ! { poly_existential_predicates; ty:: Binder <' a, ExistentialPredicate <' a>> => ty:: Binder <' tcx, ExistentialPredicate <' tcx>>}
16581662nop_list_lift ! { predicates; Predicate <' a> => Predicate <' tcx>}
16591663nop_list_lift ! { canonical_var_infos; CanonicalVarInfo <' a> => CanonicalVarInfo <' tcx>}
@@ -2115,6 +2119,7 @@ slice_interners!(
21152119 type_list: _intern_type_list( Ty <' tcx>) ,
21162120 substs: _intern_substs( GenericArg <' tcx>) ,
21172121 canonical_var_infos: _intern_canonical_var_infos( CanonicalVarInfo <' tcx>) ,
2122+ projection_predicates: _intern_projection_predicates( ProjectionPredicate <' tcx>) ,
21182123 poly_existential_predicates:
21192124 _intern_poly_existential_predicates( ty:: Binder <' tcx, ExistentialPredicate <' tcx>>) ,
21202125 predicates: _intern_predicates( Predicate <' tcx>) ,
@@ -2406,8 +2411,11 @@ impl<'tcx> TyCtxt<'tcx> {
24062411 }
24072412
24082413 #[ inline]
2409- pub fn mk_generator_witness ( self , types : ty:: Binder < ' tcx , & ' tcx List < Ty < ' tcx > > > ) -> Ty < ' tcx > {
2410- self . mk_ty ( GeneratorWitness ( types) )
2414+ pub fn mk_generator_witness (
2415+ self ,
2416+ inner : ty:: Binder < ' tcx , GeneratorWitnessInner < ' tcx > > ,
2417+ ) -> Ty < ' tcx > {
2418+ self . mk_ty ( GeneratorWitness ( inner) )
24112419 }
24122420
24132421 #[ inline]
@@ -2509,6 +2517,17 @@ impl<'tcx> TyCtxt<'tcx> {
25092517 Place { local : place. local , projection : self . intern_place_elems ( & projection) }
25102518 }
25112519
2520+ pub fn intern_projection_predicates (
2521+ self ,
2522+ predicates : & [ ProjectionPredicate < ' tcx > ] ,
2523+ ) -> & ' tcx List < ProjectionPredicate < ' tcx > > {
2524+ if predicates. is_empty ( ) {
2525+ List :: empty ( )
2526+ } else {
2527+ self . _intern_projection_predicates ( predicates)
2528+ }
2529+ }
2530+
25122531 pub fn intern_poly_existential_predicates (
25132532 self ,
25142533 eps : & [ ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > ] ,
@@ -2583,6 +2602,15 @@ impl<'tcx> TyCtxt<'tcx> {
25832602 } )
25842603 }
25852604
2605+ pub fn mk_projection_predicates <
2606+ I : InternAs < [ ProjectionPredicate < ' tcx > ] , & ' tcx List < ProjectionPredicate < ' tcx > > > ,
2607+ > (
2608+ self ,
2609+ iter : I ,
2610+ ) -> I :: Output {
2611+ iter. intern_with ( |xs| self . intern_projection_predicates ( xs) )
2612+ }
2613+
25862614 pub fn mk_poly_existential_predicates <
25872615 I : InternAs <
25882616 [ ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > ] ,
0 commit comments