@@ -29,15 +29,14 @@ use rustc::ty::layout::{LayoutTyper, TyLayout};
2929use session:: config:: NoDebugInfo ;
3030use session:: Session ;
3131use session:: config;
32- use symbol_map :: SymbolMap ;
32+ use symbol_cache :: SymbolCache ;
3333use util:: nodemap:: { NodeSet , DefIdMap , FxHashMap } ;
3434
3535use std:: ffi:: { CStr , CString } ;
3636use std:: cell:: { Cell , RefCell } ;
3737use std:: marker:: PhantomData ;
3838use std:: ptr;
3939use std:: iter;
40- use std:: rc:: Rc ;
4140use std:: str;
4241use syntax:: ast;
4342use syntax:: symbol:: InternedString ;
@@ -94,7 +93,7 @@ pub struct SharedCrateContext<'a, 'tcx: 'a> {
9493/// per compilation unit. Each one has its own LLVM `ContextRef` so that
9594/// several compilation units may be optimized in parallel. All other LLVM
9695/// data structures in the `LocalCrateContext` are tied to that `ContextRef`.
97- pub struct LocalCrateContext < ' tcx > {
96+ pub struct LocalCrateContext < ' a , ' tcx : ' a > {
9897 llmod : ModuleRef ,
9998 llcx : ContextRef ,
10099 stats : Stats ,
@@ -166,10 +165,10 @@ pub struct LocalCrateContext<'tcx> {
166165 /// Depth of the current type-of computation - used to bail out
167166 type_of_depth : Cell < usize > ,
168167
169- symbol_map : Rc < SymbolMap < ' tcx > > ,
170-
171168 /// A counter that is used for generating local symbol names
172169 local_gen_sym_counter : Cell < usize > ,
170+
171+ symbol_cache : & ' a SymbolCache < ' a , ' tcx > ,
173172}
174173
175174// Implement DepTrackingMapConfig for `trait_cache`
@@ -227,12 +226,12 @@ impl<'gcx> DepTrackingMapConfig for ProjectionCache<'gcx> {
227226/// pass around (SharedCrateContext, LocalCrateContext) tuples all over trans.
228227pub struct CrateContext < ' a , ' tcx : ' a > {
229228 shared : & ' a SharedCrateContext < ' a , ' tcx > ,
230- local_ccx : & ' a LocalCrateContext < ' tcx > ,
229+ local_ccx : & ' a LocalCrateContext < ' a , ' tcx > ,
231230}
232231
233232impl < ' a , ' tcx > CrateContext < ' a , ' tcx > {
234233 pub fn new ( shared : & ' a SharedCrateContext < ' a , ' tcx > ,
235- local_ccx : & ' a LocalCrateContext < ' tcx > )
234+ local_ccx : & ' a LocalCrateContext < ' a , ' tcx > )
236235 -> Self {
237236 CrateContext { shared, local_ccx }
238237 }
@@ -429,11 +428,11 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
429428 }
430429}
431430
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 > {
437436 unsafe {
438437 // Append ".rs" to LLVM module identifier.
439438 //
@@ -487,8 +486,8 @@ impl<'tcx> LocalCrateContext<'tcx> {
487486 rust_try_fn : Cell :: new ( None ) ,
488487 intrinsics : RefCell :: new ( FxHashMap ( ) ) ,
489488 type_of_depth : Cell :: new ( 0 ) ,
490- symbol_map : symbol_map,
491489 local_gen_sym_counter : Cell :: new ( 0 ) ,
490+ symbol_cache : symbol_cache,
492491 } ;
493492
494493 let ( int_type, opaque_vec_type, str_slice_ty, mut local_ccx) = {
@@ -522,9 +521,9 @@ impl<'tcx> LocalCrateContext<'tcx> {
522521 /// This is used in the `LocalCrateContext` constructor to allow calling
523522 /// functions that expect a complete `CrateContext`, even before the local
524523 /// 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 > {
528527 assert ! ( local_ccxs. len( ) == 1 ) ;
529528 CrateContext {
530529 shared : shared,
@@ -542,7 +541,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
542541 self . shared
543542 }
544543
545- fn local ( & self ) -> & ' b LocalCrateContext < ' tcx > {
544+ fn local ( & self ) -> & ' b LocalCrateContext < ' b , ' tcx > {
546545 self . local_ccx
547546 }
548547
@@ -709,8 +708,8 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
709708 self . shared . use_dll_storage_attrs ( )
710709 }
711710
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
714713 }
715714
716715 /// 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> {
856855 }
857856}
858857
859- pub struct TypeOfDepthLock < ' a , ' tcx : ' a > ( & ' a LocalCrateContext < ' tcx > ) ;
858+ pub struct TypeOfDepthLock < ' a , ' tcx : ' a > ( & ' a LocalCrateContext < ' a , ' tcx > ) ;
860859
861860impl < ' a , ' tcx > Drop for TypeOfDepthLock < ' a , ' tcx > {
862861 fn drop ( & mut self ) {
0 commit comments