@@ -17,9 +17,10 @@ use crate::ty::TyKind::*;
17
17
use crate :: ty:: {
18
18
self , AdtDef , AdtKind , Binder , BindingMode , BoundVar , CanonicalPolyFnSig ,
19
19
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 ,
23
24
} ;
24
25
use rustc_ast as ast;
25
26
use rustc_attr as attr;
@@ -102,6 +103,7 @@ pub struct CtxtInterners<'tcx> {
102
103
substs : InternedSet < ' tcx , InternalSubsts < ' tcx > > ,
103
104
canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo < ' tcx > > > ,
104
105
region : InternedSet < ' tcx , RegionKind > ,
106
+ projection_predicates : InternedSet < ' tcx , List < ProjectionPredicate < ' tcx > > > ,
105
107
poly_existential_predicates :
106
108
InternedSet < ' tcx , List < ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > > > ,
107
109
predicate : InternedSet < ' tcx , PredicateInner < ' tcx > > ,
@@ -129,6 +131,7 @@ impl<'tcx> CtxtInterners<'tcx> {
129
131
type_list : Default :: default ( ) ,
130
132
substs : Default :: default ( ) ,
131
133
region : Default :: default ( ) ,
134
+ projection_predicates : Default :: default ( ) ,
132
135
poly_existential_predicates : Default :: default ( ) ,
133
136
canonical_var_infos : Default :: default ( ) ,
134
137
predicate : Default :: default ( ) ,
@@ -1654,6 +1657,7 @@ nop_lift! {const_allocation; &'a Allocation => &'tcx Allocation}
1654
1657
nop_lift ! { predicate; & ' a PredicateInner <' a> => & ' tcx PredicateInner <' tcx>}
1655
1658
1656
1659
nop_list_lift ! { type_list; Ty <' a> => Ty <' tcx>}
1660
+ nop_list_lift ! { projection_predicates; ProjectionPredicate <' a> => ProjectionPredicate <' tcx>}
1657
1661
nop_list_lift ! { poly_existential_predicates; ty:: Binder <' a, ExistentialPredicate <' a>> => ty:: Binder <' tcx, ExistentialPredicate <' tcx>>}
1658
1662
nop_list_lift ! { predicates; Predicate <' a> => Predicate <' tcx>}
1659
1663
nop_list_lift ! { canonical_var_infos; CanonicalVarInfo <' a> => CanonicalVarInfo <' tcx>}
@@ -2115,6 +2119,7 @@ slice_interners!(
2115
2119
type_list: _intern_type_list( Ty <' tcx>) ,
2116
2120
substs: _intern_substs( GenericArg <' tcx>) ,
2117
2121
canonical_var_infos: _intern_canonical_var_infos( CanonicalVarInfo <' tcx>) ,
2122
+ projection_predicates: _intern_projection_predicates( ProjectionPredicate <' tcx>) ,
2118
2123
poly_existential_predicates:
2119
2124
_intern_poly_existential_predicates( ty:: Binder <' tcx, ExistentialPredicate <' tcx>>) ,
2120
2125
predicates: _intern_predicates( Predicate <' tcx>) ,
@@ -2406,8 +2411,11 @@ impl<'tcx> TyCtxt<'tcx> {
2406
2411
}
2407
2412
2408
2413
#[ 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) )
2411
2419
}
2412
2420
2413
2421
#[ inline]
@@ -2509,6 +2517,17 @@ impl<'tcx> TyCtxt<'tcx> {
2509
2517
Place { local : place. local , projection : self . intern_place_elems ( & projection) }
2510
2518
}
2511
2519
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
+
2512
2531
pub fn intern_poly_existential_predicates (
2513
2532
self ,
2514
2533
eps : & [ ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > ] ,
@@ -2583,6 +2602,15 @@ impl<'tcx> TyCtxt<'tcx> {
2583
2602
} )
2584
2603
}
2585
2604
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
+
2586
2614
pub fn mk_poly_existential_predicates <
2587
2615
I : InternAs <
2588
2616
[ ty:: Binder < ' tcx , ExistentialPredicate < ' tcx > > ] ,
0 commit comments