resolve: Pre-compute non-reexport module children

Instead of repeating the same logic by walking HIR during metadata encoding.

The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list.
They can be encoded separately if this need ever arises.

`module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.
This commit is contained in:
Vadim Petrochenkov
2023-04-10 19:07:57 +03:00
parent 9be9b5e09a
commit 7c40a6fb34
16 changed files with 72 additions and 99 deletions

View File

@@ -515,7 +515,7 @@ impl<'tcx> EmbargoVisitor<'tcx> {
let vis = self.tcx.local_visibility(item_id.owner_id.def_id);
self.update_macro_reachable_def(item_id.owner_id.def_id, def_kind, vis, defining_mod);
}
for export in self.tcx.module_reexports(module_def_id) {
for export in self.tcx.module_children_reexports(module_def_id) {
if export.vis.is_accessible_from(defining_mod, self.tcx)
&& let Res::Def(def_kind, def_id) = export.res
&& let Some(def_id) = def_id.as_local() {