Skip to content

Commit

Permalink
rustc_metadata: Do not encode empty reexport lists
Browse files Browse the repository at this point in the history
This is more a cleanup than optimization
  • Loading branch information
petrochenkov committed Nov 22, 2022
1 parent 66ccf36 commit f3b5791
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,13 +1267,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
// the crate root for consistency with other crates (some of the resolver
// code uses it). However, we skip encoding anything relating to child
// items - we encode information about proc-macros later on.
let reexports = if !self.is_proc_macro {
tcx.module_reexports(local_def_id).unwrap_or(&[])
} else {
&[]
};

record_array!(self.tables.module_reexports[def_id] <- reexports);
if self.is_proc_macro {
// Encode this here because we don't do it in encode_def_ids.
record!(self.tables.expn_that_defined[def_id] <- tcx.expn_that_defined(local_def_id));
Expand Down Expand Up @@ -1305,6 +1298,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
}
}
}));

if let Some(reexports) = tcx.module_reexports(local_def_id) {
assert!(!reexports.is_empty());
record_array!(self.tables.module_reexports[def_id] <- reexports);
}
}
}

Expand Down

0 comments on commit f3b5791

Please sign in to comment.