1
Fork 0

rustc_metadata: Do not encode empty reexport lists

This is more a cleanup than optimization
This commit is contained in:
Vadim Petrochenkov 2022-11-22 19:19:40 +03:00
parent 66ccf36f16
commit f3b5791a47

View file

@ -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));
@ -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);
}
}
}