@@ -725,14 +725,14 @@ fn contains_null(s: &str) -> bool {
725725 s. bytes ( ) . any ( |b| b == 0 )
726726}
727727
728- fn write_metadata ( cx : & SharedCrateContext ,
729- link_meta : & LinkMeta ,
730- exported_symbols : & NodeSet )
731- -> ( ContextRef , ModuleRef , EncodedMetadata ) {
728+ fn write_metadata < ' a , ' gcx > ( tcx : TyCtxt < ' a , ' gcx , ' gcx > ,
729+ link_meta : & LinkMeta ,
730+ exported_symbols : & NodeSet )
731+ -> ( ContextRef , ModuleRef , EncodedMetadata ) {
732732 use flate;
733733
734734 let ( metadata_llcx, metadata_llmod) = unsafe {
735- context:: create_context_and_module ( cx . sess ( ) , "metadata" )
735+ context:: create_context_and_module ( tcx . sess , "metadata" )
736736 } ;
737737
738738 #[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
@@ -742,7 +742,7 @@ fn write_metadata(cx: &SharedCrateContext,
742742 Compressed
743743 }
744744
745- let kind = cx . sess ( ) . crate_types . borrow ( ) . iter ( ) . map ( |ty| {
745+ let kind = tcx . sess . crate_types . borrow ( ) . iter ( ) . map ( |ty| {
746746 match * ty {
747747 config:: CrateTypeExecutable |
748748 config:: CrateTypeStaticlib |
@@ -762,8 +762,8 @@ fn write_metadata(cx: &SharedCrateContext,
762762 } ) ;
763763 }
764764
765- let cstore = & cx . tcx ( ) . sess . cstore ;
766- let metadata = cstore. encode_metadata ( cx . tcx ( ) ,
765+ let cstore = & tcx. sess . cstore ;
766+ let metadata = cstore. encode_metadata ( tcx,
767767 & link_meta,
768768 exported_symbols) ;
769769 if kind == MetadataKind :: Uncompressed {
@@ -776,15 +776,15 @@ fn write_metadata(cx: &SharedCrateContext,
776776
777777 let llmeta = C_bytes_in_context ( metadata_llcx, & compressed) ;
778778 let llconst = C_struct_in_context ( metadata_llcx, & [ llmeta] , false ) ;
779- let name = symbol_export:: metadata_symbol_name ( cx . tcx ( ) ) ;
779+ let name = symbol_export:: metadata_symbol_name ( tcx) ;
780780 let buf = CString :: new ( name) . unwrap ( ) ;
781781 let llglobal = unsafe {
782782 llvm:: LLVMAddGlobal ( metadata_llmod, val_ty ( llconst) . to_ref ( ) , buf. as_ptr ( ) )
783783 } ;
784784 unsafe {
785785 llvm:: LLVMSetInitializer ( llglobal, llconst) ;
786786 let section_name =
787- cx . tcx ( ) . sess . cstore . metadata_section_name ( & cx . sess ( ) . target . target ) ;
787+ tcx. sess . cstore . metadata_section_name ( & tcx . sess . target . target ) ;
788788 let name = CString :: new ( section_name) . unwrap ( ) ;
789789 llvm:: LLVMSetSection ( llglobal, name. as_ptr ( ) ) ;
790790
@@ -1078,7 +1078,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
10781078 // Translate the metadata.
10791079 let ( metadata_llcx, metadata_llmod, metadata) =
10801080 time ( tcx. sess . time_passes ( ) , "write metadata" , || {
1081- write_metadata ( & shared_ccx , & link_meta, shared_ccx. exported_symbols ( ) )
1081+ write_metadata ( tcx , & link_meta, shared_ccx. exported_symbols ( ) )
10821082 } ) ;
10831083
10841084 let metadata_module = ModuleTranslation {
0 commit comments