about summary refs log tree commit diff
path: root/src/librustdoc/visit_ast.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-05-26 17:31:11 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-05-26 17:31:11 +0200
commit3802ba0f6a88355396a4b27b922f6f6b494dbd32 (patch)
tree06d294130559e7d6326b87f34b736a54634d481e /src/librustdoc/visit_ast.rs
parent223f6f5926893bf82c5f2f9b1bb78fa6f1d1d1aa (diff)
downloadrust-3802ba0f6a88355396a4b27b922f6f6b494dbd32.tar.gz
rust-3802ba0f6a88355396a4b27b922f6f6b494dbd32.zip
Fix re-export of doc hidden macro not showing up
Diffstat (limited to 'src/librustdoc/visit_ast.rs')
-rw-r--r--src/librustdoc/visit_ast.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 8f8dc6b7090..891574eb466 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -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 {