mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-16 17:53:30 +00:00
rustdoc: implement glob shadowing when doing local inlining
This commit is contained in:
parent
624f972358
commit
56e9ec547a
@ -164,8 +164,20 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||||||
self.inside_public_path &= self.cx.tcx.visibility(def_id).is_public();
|
self.inside_public_path &= self.cx.tcx.visibility(def_id).is_public();
|
||||||
for &i in m.item_ids {
|
for &i in m.item_ids {
|
||||||
let item = self.cx.tcx.hir().item(i);
|
let item = self.cx.tcx.hir().item(i);
|
||||||
|
if matches!(item.kind, hir::ItemKind::Use(_, hir::UseKind::Glob)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
self.visit_item(item, None, &mut om);
|
self.visit_item(item, None, &mut om);
|
||||||
}
|
}
|
||||||
|
for &i in m.item_ids {
|
||||||
|
let item = self.cx.tcx.hir().item(i);
|
||||||
|
// To match the way import precedence works, visit glob imports last.
|
||||||
|
// Later passes in rustdoc will de-duplicate by name and kind, so if glob-
|
||||||
|
// imported items appear last, then they'll be the ones that get discarded.
|
||||||
|
if matches!(item.kind, hir::ItemKind::Use(_, hir::UseKind::Glob)) {
|
||||||
|
self.visit_item(item, None, &mut om);
|
||||||
|
}
|
||||||
|
}
|
||||||
self.inside_public_path = orig_inside_public_path;
|
self.inside_public_path = orig_inside_public_path;
|
||||||
om
|
om
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user