@@ -25,7 +25,7 @@ use monomorphize::Instance;
2525
2626use partitioning:: CodegenUnit ;
2727use trans_item:: TransItem ;
28- use type_:: { Type , TypeNames } ;
28+ use type_:: Type ;
2929use rustc:: ty:: subst:: Substs ;
3030use rustc:: ty:: { self , Ty , TyCtxt } ;
3131use session:: config:: NoDebugInfo ;
@@ -87,7 +87,6 @@ pub struct LocalCrateContext<'tcx> {
8787 llmod : ModuleRef ,
8888 llcx : ContextRef ,
8989 previous_work_product : Option < WorkProduct > ,
90- tn : TypeNames , // FIXME: This seems to be largely unused.
9190 codegen_unit : CodegenUnit < ' tcx > ,
9291 needs_unwind_cleanup_cache : RefCell < FxHashMap < Ty < ' tcx > , bool > > ,
9392 fn_pointer_shims : RefCell < FxHashMap < Ty < ' tcx > , ValueRef > > ,
@@ -137,6 +136,7 @@ pub struct LocalCrateContext<'tcx> {
137136 type_hashcodes : RefCell < FxHashMap < Ty < ' tcx > , String > > ,
138137 int_type : Type ,
139138 opaque_vec_type : Type ,
139+ str_slice_type : Type ,
140140 builder : BuilderRef_res ,
141141
142142 /// Holds the LLVM values for closure IDs.
@@ -611,7 +611,6 @@ impl<'tcx> LocalCrateContext<'tcx> {
611611 llcx : llcx,
612612 previous_work_product : previous_work_product,
613613 codegen_unit : codegen_unit,
614- tn : TypeNames :: new ( ) ,
615614 needs_unwind_cleanup_cache : RefCell :: new ( FxHashMap ( ) ) ,
616615 fn_pointer_shims : RefCell :: new ( FxHashMap ( ) ) ,
617616 drop_glues : RefCell :: new ( FxHashMap ( ) ) ,
@@ -631,6 +630,7 @@ impl<'tcx> LocalCrateContext<'tcx> {
631630 type_hashcodes : RefCell :: new ( FxHashMap ( ) ) ,
632631 int_type : Type :: from_ref ( ptr:: null_mut ( ) ) ,
633632 opaque_vec_type : Type :: from_ref ( ptr:: null_mut ( ) ) ,
633+ str_slice_type : Type :: from_ref ( ptr:: null_mut ( ) ) ,
634634 builder : BuilderRef_res ( llvm:: LLVMCreateBuilderInContext ( llcx) ) ,
635635 closure_vals : RefCell :: new ( FxHashMap ( ) ) ,
636636 dbg_cx : dbg_cx,
@@ -662,7 +662,7 @@ impl<'tcx> LocalCrateContext<'tcx> {
662662
663663 local_ccx. int_type = int_type;
664664 local_ccx. opaque_vec_type = opaque_vec_type;
665- local_ccx. tn . associate_type ( "str_slice" , & str_slice_ty) ;
665+ local_ccx. str_slice_type = str_slice_ty;
666666
667667 if shared. tcx . sess . count_llvm_insns ( ) {
668668 base:: init_insn_ctxt ( )
@@ -778,10 +778,6 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
778778 unsafe { llvm:: LLVMRustGetModuleDataLayout ( self . llmod ( ) ) }
779779 }
780780
781- pub fn tn < ' a > ( & ' a self ) -> & ' a TypeNames {
782- & self . local ( ) . tn
783- }
784-
785781 pub fn export_map < ' a > ( & ' a self ) -> & ' a ExportMap {
786782 & self . shared . export_map
787783 }
@@ -885,6 +881,10 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
885881 self . local ( ) . opaque_vec_type
886882 }
887883
884+ pub fn str_slice_type ( & self ) -> Type {
885+ self . local ( ) . str_slice_type
886+ }
887+
888888 pub fn closure_vals < ' a > ( & ' a self ) -> & ' a RefCell < FxHashMap < Instance < ' tcx > , ValueRef > > {
889889 & self . local ( ) . closure_vals
890890 }
0 commit comments