@@ -330,15 +330,11 @@ pub enum Variance {
330330/// `tcx.variances_of()` to get the variance for a *particular*
331331/// item.
332332#[ derive( HashStable ) ]
333- pub struct CrateVariancesMap {
333+ pub struct CrateVariancesMap < ' tcx > {
334334 /// For each item with generics, maps to a vector of the variance
335335 /// of its generics. If an item has no generics, it will have no
336336 /// entry.
337- pub variances : FxHashMap < DefId , Lrc < Vec < ty:: Variance > > > ,
338-
339- /// An empty vector, useful for cloning.
340- #[ stable_hasher( ignore) ]
341- pub empty_variance : Lrc < Vec < ty:: Variance > > ,
337+ pub variances : FxHashMap < DefId , & ' tcx [ ty:: Variance ] > ,
342338}
343339
344340impl Variance {
@@ -1110,11 +1106,7 @@ pub struct CratePredicatesMap<'tcx> {
11101106 /// For each struct with outlive bounds, maps to a vector of the
11111107 /// predicate of its outlive bounds. If an item has no outlives
11121108 /// bounds, it will have no entry.
1113- pub predicates : FxHashMap < DefId , Lrc < Vec < ty:: Predicate < ' tcx > > > > ,
1114-
1115- /// An empty vector, useful for cloning.
1116- #[ stable_hasher( ignore) ]
1117- pub empty_predicate : Lrc < Vec < ty:: Predicate < ' tcx > > > ,
1109+ pub predicates : FxHashMap < DefId , & ' tcx [ ty:: Predicate < ' tcx > ] > ,
11181110}
11191111
11201112impl < ' tcx > AsRef < Predicate < ' tcx > > for Predicate < ' tcx > {
@@ -3091,7 +3083,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
30913083
30923084pub struct AssociatedItemsIterator < ' a , ' gcx : ' tcx , ' tcx : ' a > {
30933085 tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
3094- def_ids : Lrc < Vec < DefId > > ,
3086+ def_ids : & ' gcx [ DefId ] ,
30953087 next_index : usize ,
30963088}
30973089
@@ -3180,26 +3172,27 @@ fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
31803172
31813173fn associated_item_def_ids < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
31823174 def_id : DefId )
3183- -> Lrc < Vec < DefId > > {
3175+ -> & ' tcx [ DefId ] {
31843176 let id = tcx. hir ( ) . as_local_hir_id ( def_id) . unwrap ( ) ;
31853177 let item = tcx. hir ( ) . expect_item_by_hir_id ( id) ;
3186- let vec : Vec < _ > = match item. node {
3178+ match item. node {
31873179 hir:: ItemKind :: Trait ( .., ref trait_item_refs) => {
3188- trait_item_refs. iter ( )
3189- . map ( |trait_item_ref| trait_item_ref. id )
3190- . map ( |id| tcx. hir ( ) . local_def_id_from_hir_id ( id. hir_id ) )
3191- . collect ( )
3180+ tcx. arena . alloc_from_iter (
3181+ trait_item_refs. iter ( )
3182+ . map ( |trait_item_ref| trait_item_ref. id )
3183+ . map ( |id| tcx. hir ( ) . local_def_id_from_hir_id ( id. hir_id ) )
3184+ )
31923185 }
31933186 hir:: ItemKind :: Impl ( .., ref impl_item_refs) => {
3194- impl_item_refs. iter ( )
3195- . map ( |impl_item_ref| impl_item_ref. id )
3196- . map ( |id| tcx. hir ( ) . local_def_id_from_hir_id ( id. hir_id ) )
3197- . collect ( )
3187+ tcx. arena . alloc_from_iter (
3188+ impl_item_refs. iter ( )
3189+ . map ( |impl_item_ref| impl_item_ref. id )
3190+ . map ( |id| tcx. hir ( ) . local_def_id_from_hir_id ( id. hir_id ) )
3191+ )
31983192 }
3199- hir:: ItemKind :: TraitAlias ( ..) => vec ! [ ] ,
3193+ hir:: ItemKind :: TraitAlias ( ..) => & [ ] ,
32003194 _ => span_bug ! ( item. span, "associated_item_def_ids: not impl or trait" )
3201- } ;
3202- Lrc :: new ( vec)
3195+ }
32033196}
32043197
32053198fn def_span < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId ) -> Span {
@@ -3385,7 +3378,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
33853378/// (constructing this map requires touching the entire crate).
33863379#[ derive( Clone , Debug , Default , HashStable ) ]
33873380pub struct CrateInherentImpls {
3388- pub inherent_impls : DefIdMap < Lrc < Vec < DefId > > > ,
3381+ pub inherent_impls : DefIdMap < Vec < DefId > > ,
33893382}
33903383
33913384#[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , RustcEncodable , RustcDecodable ) ]
0 commit comments