Fix re-export of doc hidden macro not showing up

This commit is contained in:
Guillaume Gomez 2023-05-26 17:31:11 +02:00
parent 223f6f5926
commit 3802ba0f6a
2 changed files with 12 additions and 1 deletions

View File

@ -2592,7 +2592,8 @@ fn clean_use_statement_inner<'tcx>(
} else {
if inline_attr.is_none()
&& let Res::Def(DefKind::Mod, did) = path.res
&& !did.is_local() && did.is_crate_root()
&& !did.is_local()
&& did.is_crate_root()
{
// if we're `pub use`ing an extern crate root, don't inline it unless we
// were specifically asked for it

View File

@ -310,6 +310,16 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}
let ret = match tcx.hir().get_by_def_id(res_did) {
// Bang macros are handled a bit on their because of how they are handled by the
// compiler. If they have `#[doc(hidden)]` and the re-export doesn't have
// `#[doc(inline)]`, then we don't inline it.
Node::Item(&hir::Item { kind: hir::ItemKind::Macro(_, MacroKind::Bang), .. })
if !please_inline
&& renamed.is_some()
&& self.cx.tcx.is_doc_hidden(ori_res_did) =>
{
return false;
}
Node::Item(&hir::Item { kind: hir::ItemKind::Mod(ref m), .. }) if glob => {
let prev = mem::replace(&mut self.inlining, true);
for &i in m.item_ids {