@@ -15,7 +15,6 @@ use crate::rustc::lint;
15
15
use crate :: session:: Session ;
16
16
use crate :: util:: nodemap:: { DefIdMap , FxHashMap , FxHashSet , HirIdMap , HirIdSet } ;
17
17
use errors:: { Applicability , DiagnosticBuilder } ;
18
- use rustc_data_structures:: sync:: Lrc ;
19
18
use rustc_macros:: HashStable ;
20
19
use std:: borrow:: Cow ;
21
20
use std:: cell:: Cell ;
@@ -211,10 +210,10 @@ struct NamedRegionMap {
211
210
/// See [`NamedRegionMap`].
212
211
#[ derive( Default ) ]
213
212
pub 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 > > ,
216
215
object_lifetime_defaults :
217
- FxHashMap < LocalDefId , Lrc < FxHashMap < ItemLocalId , Lrc < Vec < ObjectLifetimeDefault > > > > > ,
216
+ FxHashMap < LocalDefId , FxHashMap < ItemLocalId , Vec < ObjectLifetimeDefault > > > ,
218
217
}
219
218
220
219
impl_stable_hash_for ! ( struct crate :: middle:: resolve_lifetime:: ResolveLifetimes {
@@ -347,23 +346,21 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
347
346
348
347
named_region_map : |tcx, id| {
349
348
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)
351
350
} ,
352
351
353
352
is_late_bound_map : |tcx, id| {
354
353
let id = LocalDefId :: from_def_id ( DefId :: local ( id) ) ; // (*)
355
354
tcx. resolve_lifetimes ( LOCAL_CRATE )
356
355
. late_bound
357
356
. get ( & id)
358
- . cloned ( )
359
357
} ,
360
358
361
359
object_lifetime_defaults_map : |tcx, id| {
362
360
let id = LocalDefId :: from_def_id ( DefId :: local ( id) ) ; // (*)
363
361
tcx. resolve_lifetimes ( LOCAL_CRATE )
364
362
. object_lifetime_defaults
365
363
. get ( & id)
366
- . cloned ( )
367
364
} ,
368
365
369
366
..* providers
@@ -379,7 +376,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
379
376
fn resolve_lifetimes < ' tcx > (
380
377
tcx : TyCtxt < ' _ , ' tcx , ' tcx > ,
381
378
for_krate : CrateNum ,
382
- ) -> Lrc < ResolveLifetimes > {
379
+ ) -> & ' tcx ResolveLifetimes {
383
380
assert_eq ! ( for_krate, LOCAL_CRATE ) ;
384
381
385
382
let named_region_map = krate ( tcx) ;
@@ -388,24 +385,22 @@ fn resolve_lifetimes<'tcx>(
388
385
389
386
for ( hir_id, v) in named_region_map. defs {
390
387
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) ;
392
389
}
393
390
for hir_id in named_region_map. late_bound {
394
391
let map = rl. late_bound
395
392
. entry ( hir_id. owner_local_def_id ( ) )
396
393
. or_default ( ) ;
397
- Lrc :: get_mut ( map) . unwrap ( ) . insert ( hir_id. local_id ) ;
394
+ map. insert ( hir_id. local_id ) ;
398
395
}
399
396
for ( hir_id, v) in named_region_map. object_lifetime_defaults {
400
397
let map = rl. object_lifetime_defaults
401
398
. entry ( hir_id. owner_local_def_id ( ) )
402
399
. 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) ;
406
401
}
407
402
408
- Lrc :: new ( rl)
403
+ tcx . arena . alloc ( rl)
409
404
}
410
405
411
406
fn krate < ' tcx > ( tcx : TyCtxt < ' _ , ' tcx , ' tcx > ) -> NamedRegionMap {
0 commit comments