@@ -31,7 +31,7 @@ use middle::cstore::EncodedMetadata;
3131use middle:: lang_items;
3232use middle:: resolve_lifetime:: { self , ObjectLifetimeDefault } ;
3333use middle:: stability;
34- use mir:: { self , Mir , interpret} ;
34+ use mir:: { self , Mir , interpret, ProjectionKind } ;
3535use mir:: interpret:: Allocation ;
3636use ty:: subst:: { CanonicalUserSubsts , Kind , Substs , Subst } ;
3737use ty:: ReprOptions ;
@@ -132,6 +132,7 @@ pub struct CtxtInterners<'tcx> {
132132 clauses : InternedSet < ' tcx , List < Clause < ' tcx > > > ,
133133 goal : InternedSet < ' tcx , GoalKind < ' tcx > > ,
134134 goal_list : InternedSet < ' tcx , List < Goal < ' tcx > > > ,
135+ projs : InternedSet < ' tcx , List < ProjectionKind < ' tcx > > > ,
135136}
136137
137138impl < ' gcx : ' tcx , ' tcx > CtxtInterners < ' tcx > {
@@ -149,6 +150,7 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
149150 clauses : Default :: default ( ) ,
150151 goal : Default :: default ( ) ,
151152 goal_list : Default :: default ( ) ,
153+ projs : Default :: default ( ) ,
152154 }
153155 }
154156
@@ -2294,6 +2296,13 @@ impl<'tcx: 'lcx, 'lcx> Borrow<[Kind<'lcx>]> for Interned<'tcx, Substs<'tcx>> {
22942296 }
22952297}
22962298
2299+ impl < ' tcx : ' lcx , ' lcx > Borrow < [ ProjectionKind < ' lcx > ] >
2300+ for Interned < ' tcx , List < ProjectionKind < ' tcx > > > {
2301+ fn borrow < ' a > ( & ' a self ) -> & ' a [ ProjectionKind < ' lcx > ] {
2302+ & self . 0 [ ..]
2303+ }
2304+ }
2305+
22972306impl < ' tcx > Borrow < RegionKind > for Interned < ' tcx , RegionKind > {
22982307 fn borrow < ' a > ( & ' a self ) -> & ' a RegionKind {
22992308 & self . 0
@@ -2441,7 +2450,8 @@ slice_interners!(
24412450 type_list: _intern_type_list( Ty ) ,
24422451 substs: _intern_substs( Kind ) ,
24432452 clauses: _intern_clauses( Clause ) ,
2444- goal_list: _intern_goals( Goal )
2453+ goal_list: _intern_goals( Goal ) ,
2454+ projs: _intern_projs( ProjectionKind )
24452455) ;
24462456
24472457// This isn't a perfect fit: CanonicalVarInfo slices are always
@@ -2743,6 +2753,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
27432753 }
27442754 }
27452755
2756+ pub fn intern_projs ( self , ps : & [ ProjectionKind < ' tcx > ] ) -> & ' tcx List < ProjectionKind < ' tcx > > {
2757+ if ps. len ( ) == 0 {
2758+ List :: empty ( )
2759+ } else {
2760+ self . _intern_projs ( ps)
2761+ }
2762+ }
2763+
27462764 pub fn intern_canonical_var_infos ( self , ts : & [ CanonicalVarInfo ] ) -> CanonicalVarInfos < ' gcx > {
27472765 if ts. len ( ) == 0 {
27482766 List :: empty ( )
0 commit comments