]> git.lizzy.rs Git - rust.git/commitdiff
Encode exported symbols last
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Sat, 11 Jan 2020 02:42:40 +0000 (03:42 +0100)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Thu, 19 Mar 2020 14:12:31 +0000 (15:12 +0100)
src/librustc_metadata/rmeta/encoder.rs
src/librustc_metadata/rmeta/mod.rs

index 625970fbfbf473c44a73a3d1ca1c843a249fa82f..74824e1f91bea04047fcb27f72cdb5c5425492a0 100644 (file)
@@ -467,12 +467,6 @@ fn encode_crate_root(&mut self) -> Lazy<CrateRoot<'tcx>> {
         let impls = self.encode_impls();
         let impl_bytes = self.position() - i;
 
-        // Encode exported symbols info.
-        i = self.position();
-        let exported_symbols = self.tcx.exported_symbols(LOCAL_CRATE);
-        let exported_symbols = self.encode_exported_symbols(&exported_symbols);
-        let exported_symbols_bytes = self.position() - i;
-
         let tcx = self.tcx;
 
         // Encode the items.
@@ -513,6 +507,12 @@ fn encode_crate_root(&mut self) -> Lazy<CrateRoot<'tcx>> {
         let proc_macro_data = self.encode_proc_macros();
         let proc_macro_data_bytes = self.position() - i;
 
+        // Encode exported symbols info.
+        i = self.position();
+        let exported_symbols = self.tcx.exported_symbols(LOCAL_CRATE);
+        let exported_symbols = self.encode_exported_symbols(&exported_symbols);
+        let exported_symbols_bytes = self.position() - i;
+
         let attrs = tcx.hir().krate_attrs();
         let has_default_lib_allocator = attr::contains_name(&attrs, sym::default_lib_allocator);
 
index 05d834e5dee12b04097f253edf3fd785136c76ac..448c1610c13684f7e4aa142175209dc57a9fe6b9 100644 (file)
@@ -196,7 +196,6 @@ macro_rules! Lazy {
     source_map: Lazy<[rustc_span::SourceFile]>,
     def_path_table: Lazy<map::definitions::DefPathTable>,
     impls: Lazy<[TraitImpls]>,
-    exported_symbols: Lazy!([(ExportedSymbol<'tcx>, SymbolExportLevel)]),
     interpret_alloc_index: Lazy<[u32]>,
 
     per_def: LazyPerDefTables<'tcx>,
@@ -204,6 +203,8 @@ macro_rules! Lazy {
     /// The DefIndex's of any proc macros declared by this crate.
     proc_macro_data: Option<Lazy<[DefIndex]>>,
 
+    exported_symbols: Lazy!([(ExportedSymbol<'tcx>, SymbolExportLevel)]),
+
     compiler_builtins: bool,
     needs_allocator: bool,
     needs_panic_runtime: bool,