@@ -21,7 +21,7 @@ use crate::middle::cstore::EncodedMetadata;
21
21
use crate :: middle:: lang_items;
22
22
use crate :: middle:: resolve_lifetime:: { self , ObjectLifetimeDefault } ;
23
23
use crate :: middle:: stability;
24
- use crate :: mir:: { Body , interpret, ProjectionKind , Promoted } ;
24
+ use crate :: mir:: { Body , interpret, PlaceElem , ProjectionKind , Promoted } ;
25
25
use crate :: mir:: interpret:: { ConstValue , Allocation , Scalar } ;
26
26
use crate :: ty:: subst:: { GenericArg , InternalSubsts , SubstsRef , Subst } ;
27
27
use crate :: ty:: ReprOptions ;
@@ -106,6 +106,7 @@ pub struct CtxtInterners<'tcx> {
106
106
goal : InternedSet < ' tcx , GoalKind < ' tcx > > ,
107
107
goal_list : InternedSet < ' tcx , List < Goal < ' tcx > > > ,
108
108
projs : InternedSet < ' tcx , List < ProjectionKind > > ,
109
+ place_elems : InternedSet < ' tcx , List < PlaceElem < ' tcx > > > ,
109
110
const_ : InternedSet < ' tcx , Const < ' tcx > > ,
110
111
}
111
112
@@ -124,6 +125,7 @@ impl<'tcx> CtxtInterners<'tcx> {
124
125
goal : Default :: default ( ) ,
125
126
goal_list : Default :: default ( ) ,
126
127
projs : Default :: default ( ) ,
128
+ place_elems : Default :: default ( ) ,
127
129
const_ : Default :: default ( ) ,
128
130
}
129
131
}
@@ -2145,6 +2147,13 @@ impl<'tcx> Borrow<[ProjectionKind]>
2145
2147
}
2146
2148
}
2147
2149
2150
+ impl < ' tcx > Borrow < [ PlaceElem < ' tcx > ] >
2151
+ for Interned < ' tcx , List < PlaceElem < ' tcx > > > {
2152
+ fn borrow ( & self ) -> & [ PlaceElem < ' tcx > ] {
2153
+ & self . 0 [ ..]
2154
+ }
2155
+ }
2156
+
2148
2157
impl < ' tcx > Borrow < RegionKind > for Interned < ' tcx , RegionKind > {
2149
2158
fn borrow ( & self ) -> & RegionKind {
2150
2159
& self . 0
@@ -2245,7 +2254,8 @@ slice_interners!(
2245
2254
predicates: _intern_predicates( Predicate <' tcx>) ,
2246
2255
clauses: _intern_clauses( Clause <' tcx>) ,
2247
2256
goal_list: _intern_goals( Goal <' tcx>) ,
2248
- projs: _intern_projs( ProjectionKind )
2257
+ projs: _intern_projs( ProjectionKind ) ,
2258
+ place_elems: _intern_place_elems( PlaceElem <' tcx>)
2249
2259
) ;
2250
2260
2251
2261
impl < ' tcx > TyCtxt < ' tcx > {
@@ -2631,6 +2641,14 @@ impl<'tcx> TyCtxt<'tcx> {
2631
2641
}
2632
2642
}
2633
2643
2644
+ pub fn intern_place_elems ( self , ts : & [ PlaceElem < ' tcx > ] ) -> & ' tcx List < PlaceElem < ' tcx > > {
2645
+ if ts. len ( ) == 0 {
2646
+ List :: empty ( )
2647
+ } else {
2648
+ self . _intern_place_elems ( ts)
2649
+ }
2650
+ }
2651
+
2634
2652
pub fn intern_canonical_var_infos ( self , ts : & [ CanonicalVarInfo ] ) -> CanonicalVarInfos < ' tcx > {
2635
2653
if ts. len ( ) == 0 {
2636
2654
List :: empty ( )
0 commit comments