resolve: One more attempt to simplify module_children

This commit is contained in:
Vadim Petrochenkov 2023-04-27 18:34:43 +03:00
parent 98c33e47a4
commit ef77dd232d
10 changed files with 45 additions and 53 deletions

View file

@ -515,9 +515,11 @@ 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_children_reexports(module_def_id) {
if export.vis.is_accessible_from(defining_mod, self.tcx)
&& let Res::Def(def_kind, def_id) = export.res
for child in self.tcx.module_children_local(module_def_id) {
// FIXME: Use module children for the logic above too.
if !child.reexport_chain.is_empty()
&& child.vis.is_accessible_from(defining_mod, self.tcx)
&& let Res::Def(def_kind, def_id) = child.res
&& let Some(def_id) = def_id.as_local() {
let vis = self.tcx.local_visibility(def_id);
self.update_macro_reachable_def(def_id, def_kind, vis, defining_mod);