@@ -29,15 +29,14 @@ use rustc::ty::layout::{LayoutTyper, TyLayout};
29
29
use session:: config:: NoDebugInfo ;
30
30
use session:: Session ;
31
31
use session:: config;
32
- use symbol_map :: SymbolMap ;
32
+ use symbol_cache :: SymbolCache ;
33
33
use util:: nodemap:: { NodeSet , DefIdMap , FxHashMap } ;
34
34
35
35
use std:: ffi:: { CStr , CString } ;
36
36
use std:: cell:: { Cell , RefCell } ;
37
37
use std:: marker:: PhantomData ;
38
38
use std:: ptr;
39
39
use std:: iter;
40
- use std:: rc:: Rc ;
41
40
use std:: str;
42
41
use syntax:: ast;
43
42
use syntax:: symbol:: InternedString ;
@@ -94,7 +93,7 @@ pub struct SharedCrateContext<'a, 'tcx: 'a> {
94
93
/// per compilation unit. Each one has its own LLVM `ContextRef` so that
95
94
/// several compilation units may be optimized in parallel. All other LLVM
96
95
/// data structures in the `LocalCrateContext` are tied to that `ContextRef`.
97
- pub struct LocalCrateContext < ' tcx > {
96
+ pub struct LocalCrateContext < ' a , ' tcx : ' a > {
98
97
llmod : ModuleRef ,
99
98
llcx : ContextRef ,
100
99
stats : Stats ,
@@ -166,10 +165,10 @@ pub struct LocalCrateContext<'tcx> {
166
165
/// Depth of the current type-of computation - used to bail out
167
166
type_of_depth : Cell < usize > ,
168
167
169
- symbol_map : Rc < SymbolMap < ' tcx > > ,
170
-
171
168
/// A counter that is used for generating local symbol names
172
169
local_gen_sym_counter : Cell < usize > ,
170
+
171
+ symbol_cache : & ' a SymbolCache < ' a , ' tcx > ,
173
172
}
174
173
175
174
// Implement DepTrackingMapConfig for `trait_cache`
@@ -227,12 +226,12 @@ impl<'gcx> DepTrackingMapConfig for ProjectionCache<'gcx> {
227
226
/// pass around (SharedCrateContext, LocalCrateContext) tuples all over trans.
228
227
pub struct CrateContext < ' a , ' tcx : ' a > {
229
228
shared : & ' a SharedCrateContext < ' a , ' tcx > ,
230
- local_ccx : & ' a LocalCrateContext < ' tcx > ,
229
+ local_ccx : & ' a LocalCrateContext < ' a , ' tcx > ,
231
230
}
232
231
233
232
impl < ' a , ' tcx > CrateContext < ' a , ' tcx > {
234
233
pub fn new ( shared : & ' a SharedCrateContext < ' a , ' tcx > ,
235
- local_ccx : & ' a LocalCrateContext < ' tcx > )
234
+ local_ccx : & ' a LocalCrateContext < ' a , ' tcx > )
236
235
-> Self {
237
236
CrateContext { shared, local_ccx }
238
237
}
@@ -429,11 +428,11 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
429
428
}
430
429
}
431
430
432
- impl < ' tcx > LocalCrateContext < ' tcx > {
433
- pub fn new < ' a > ( shared : & SharedCrateContext < ' a , ' tcx > ,
434
- codegen_unit : CodegenUnit < ' tcx > ,
435
- symbol_map : Rc < SymbolMap < ' tcx > > )
436
- -> LocalCrateContext < ' tcx > {
431
+ impl < ' a , ' tcx > LocalCrateContext < ' a , ' tcx > {
432
+ pub fn new ( shared : & SharedCrateContext < ' a , ' tcx > ,
433
+ codegen_unit : CodegenUnit < ' tcx > ,
434
+ symbol_cache : & ' a SymbolCache < ' a , ' tcx > )
435
+ -> LocalCrateContext < ' a , ' tcx > {
437
436
unsafe {
438
437
// Append ".rs" to LLVM module identifier.
439
438
//
@@ -487,8 +486,8 @@ impl<'tcx> LocalCrateContext<'tcx> {
487
486
rust_try_fn : Cell :: new ( None ) ,
488
487
intrinsics : RefCell :: new ( FxHashMap ( ) ) ,
489
488
type_of_depth : Cell :: new ( 0 ) ,
490
- symbol_map : symbol_map,
491
489
local_gen_sym_counter : Cell :: new ( 0 ) ,
490
+ symbol_cache : symbol_cache,
492
491
} ;
493
492
494
493
let ( int_type, opaque_vec_type, str_slice_ty, mut local_ccx) = {
@@ -522,9 +521,9 @@ impl<'tcx> LocalCrateContext<'tcx> {
522
521
/// This is used in the `LocalCrateContext` constructor to allow calling
523
522
/// functions that expect a complete `CrateContext`, even before the local
524
523
/// portion is fully initialized and attached to the `SharedCrateContext`.
525
- fn dummy_ccx < ' a > ( shared : & ' a SharedCrateContext < ' a , ' tcx > ,
526
- local_ccxs : & ' a [ LocalCrateContext < ' tcx > ] )
527
- -> CrateContext < ' a , ' tcx > {
524
+ fn dummy_ccx ( shared : & ' a SharedCrateContext < ' a , ' tcx > ,
525
+ local_ccxs : & ' a [ LocalCrateContext < ' a , ' tcx > ] )
526
+ -> CrateContext < ' a , ' tcx > {
528
527
assert ! ( local_ccxs. len( ) == 1 ) ;
529
528
CrateContext {
530
529
shared : shared,
@@ -542,7 +541,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
542
541
self . shared
543
542
}
544
543
545
- fn local ( & self ) -> & ' b LocalCrateContext < ' tcx > {
544
+ fn local ( & self ) -> & ' b LocalCrateContext < ' b , ' tcx > {
546
545
self . local_ccx
547
546
}
548
547
@@ -709,8 +708,8 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
709
708
self . shared . use_dll_storage_attrs ( )
710
709
}
711
710
712
- pub fn symbol_map ( & self ) -> & SymbolMap < ' tcx > {
713
- & * self . local ( ) . symbol_map
711
+ pub fn symbol_cache ( & self ) -> & ' b SymbolCache < ' b , ' tcx > {
712
+ self . local ( ) . symbol_cache
714
713
}
715
714
716
715
/// Given the def-id of some item that has no type parameters, make
@@ -856,7 +855,7 @@ impl<'a, 'tcx> LayoutTyper<'tcx> for &'a CrateContext<'a, 'tcx> {
856
855
}
857
856
}
858
857
859
- pub struct TypeOfDepthLock < ' a , ' tcx : ' a > ( & ' a LocalCrateContext < ' tcx > ) ;
858
+ pub struct TypeOfDepthLock < ' a , ' tcx : ' a > ( & ' a LocalCrateContext < ' a , ' tcx > ) ;
860
859
861
860
impl < ' a , ' tcx > Drop for TypeOfDepthLock < ' a , ' tcx > {
862
861
fn drop ( & mut self ) {
0 commit comments