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

@@ -931,7 +931,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
/// Builds the reduced graph for a single item in an external crate.
fn build_reduced_graph_for_external_crate_res(&mut self, child: ModChild) {
let parent = self.parent_scope.module;
let ModChild { ident, res, vis, span, macro_rules, .. } = child;
let ModChild { ident, res, vis, span, .. } = child;
let res = res.expect_non_local();
let expansion = self.parent_scope.expansion;
// Record primary definitions.
@@ -964,9 +964,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
_,
) => self.r.define(parent, ident, ValueNS, (res, vis, span, expansion)),
Res::Def(DefKind::Macro(..), _) | Res::NonMacroAttr(..) => {
if !macro_rules {
self.r.define(parent, ident, MacroNS, (res, vis, span, expansion))
}
self.r.define(parent, ident, MacroNS, (res, vis, span, expansion))
}
Res::Def(
DefKind::TyParam