Skip to content

Commit

Permalink
Encode exported symbols last
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Mar 19, 2020
1 parent 6cd0dca commit 1a34cbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/librustc_metadata/rmeta/encoder.rs
Expand Up @@ -467,12 +467,6 @@ impl<'tcx> EncodeContext<'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.
Expand Down Expand Up @@ -513,6 +507,12 @@ impl<'tcx> EncodeContext<'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);

Expand Down
3 changes: 2 additions & 1 deletion src/librustc_metadata/rmeta/mod.rs
Expand Up @@ -196,14 +196,15 @@ crate struct CrateRoot<'tcx> {
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>,

/// 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,
Expand Down

0 comments on commit 1a34cbc

Please sign in to comment.