@@ -15,7 +15,6 @@ use crate::rustc::lint;
1515use crate :: session:: Session ;
1616use crate :: util:: nodemap:: { DefIdMap , FxHashMap , FxHashSet , HirIdMap , HirIdSet } ;
1717use errors:: { Applicability , DiagnosticBuilder } ;
18- use rustc_data_structures:: sync:: Lrc ;
1918use rustc_macros:: HashStable ;
2019use std:: borrow:: Cow ;
2120use std:: cell:: Cell ;
@@ -211,10 +210,10 @@ struct NamedRegionMap {
211210/// See [`NamedRegionMap`].
212211#[ derive( Default ) ]
213212pub struct ResolveLifetimes {
214- defs : FxHashMap < LocalDefId , Lrc < FxHashMap < ItemLocalId , Region > > > ,
215- late_bound : FxHashMap < LocalDefId , Lrc < FxHashSet < ItemLocalId > > > ,
213+ defs : FxHashMap < LocalDefId , FxHashMap < ItemLocalId , Region > > ,
214+ late_bound : FxHashMap < LocalDefId , FxHashSet < ItemLocalId > > ,
216215 object_lifetime_defaults :
217- FxHashMap < LocalDefId , Lrc < FxHashMap < ItemLocalId , Lrc < Vec < ObjectLifetimeDefault > > > > > ,
216+ FxHashMap < LocalDefId , FxHashMap < ItemLocalId , Vec < ObjectLifetimeDefault > > > ,
218217}
219218
220219impl_stable_hash_for ! ( struct crate :: middle:: resolve_lifetime:: ResolveLifetimes {
@@ -347,23 +346,21 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
347346
348347 named_region_map : |tcx, id| {
349348 let id = LocalDefId :: from_def_id ( DefId :: local ( id) ) ; // (*)
350- tcx. resolve_lifetimes ( LOCAL_CRATE ) . defs . get ( & id) . cloned ( )
349+ tcx. resolve_lifetimes ( LOCAL_CRATE ) . defs . get ( & id)
351350 } ,
352351
353352 is_late_bound_map : |tcx, id| {
354353 let id = LocalDefId :: from_def_id ( DefId :: local ( id) ) ; // (*)
355354 tcx. resolve_lifetimes ( LOCAL_CRATE )
356355 . late_bound
357356 . get ( & id)
358- . cloned ( )
359357 } ,
360358
361359 object_lifetime_defaults_map : |tcx, id| {
362360 let id = LocalDefId :: from_def_id ( DefId :: local ( id) ) ; // (*)
363361 tcx. resolve_lifetimes ( LOCAL_CRATE )
364362 . object_lifetime_defaults
365363 . get ( & id)
366- . cloned ( )
367364 } ,
368365
369366 ..* providers
@@ -379,7 +376,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
379376fn resolve_lifetimes < ' tcx > (
380377 tcx : TyCtxt < ' _ , ' tcx , ' tcx > ,
381378 for_krate : CrateNum ,
382- ) -> Lrc < ResolveLifetimes > {
379+ ) -> & ' tcx ResolveLifetimes {
383380 assert_eq ! ( for_krate, LOCAL_CRATE ) ;
384381
385382 let named_region_map = krate ( tcx) ;
@@ -388,24 +385,22 @@ fn resolve_lifetimes<'tcx>(
388385
389386 for ( hir_id, v) in named_region_map. defs {
390387 let map = rl. defs . entry ( hir_id. owner_local_def_id ( ) ) . or_default ( ) ;
391- Lrc :: get_mut ( map) . unwrap ( ) . insert ( hir_id. local_id , v) ;
388+ map. insert ( hir_id. local_id , v) ;
392389 }
393390 for hir_id in named_region_map. late_bound {
394391 let map = rl. late_bound
395392 . entry ( hir_id. owner_local_def_id ( ) )
396393 . or_default ( ) ;
397- Lrc :: get_mut ( map) . unwrap ( ) . insert ( hir_id. local_id ) ;
394+ map. insert ( hir_id. local_id ) ;
398395 }
399396 for ( hir_id, v) in named_region_map. object_lifetime_defaults {
400397 let map = rl. object_lifetime_defaults
401398 . entry ( hir_id. owner_local_def_id ( ) )
402399 . or_default ( ) ;
403- Lrc :: get_mut ( map)
404- . unwrap ( )
405- . insert ( hir_id. local_id , Lrc :: new ( v) ) ;
400+ map. insert ( hir_id. local_id , v) ;
406401 }
407402
408- Lrc :: new ( rl)
403+ tcx . arena . alloc ( rl)
409404}
410405
411406fn krate < ' tcx > ( tcx : TyCtxt < ' _ , ' tcx , ' tcx > ) -> NamedRegionMap {
0 commit comments