@@ -62,7 +62,7 @@ impl<'a, 'tcx> Stripper<'a, 'tcx> {
6262
6363 /// In case `i` is a non-hidden impl block, then we special-case it by changing the value
6464 /// of `is_in_hidden_item` to `true` because the impl children inherit its visibility.
65- fn recurse_in_impl ( & mut self , i : Item ) -> Item {
65+ fn recurse_in_impl_or_exported_macro ( & mut self , i : Item ) -> Item {
6666 let prev = mem:: replace ( & mut self . is_in_hidden_item , false ) ;
6767 let ret = self . fold_item_recur ( i) ;
6868 self . is_in_hidden_item = prev;
@@ -73,9 +73,17 @@ impl<'a, 'tcx> Stripper<'a, 'tcx> {
7373impl < ' a , ' tcx > DocFolder for Stripper < ' a , ' tcx > {
7474 fn fold_item ( & mut self , i : Item ) -> Option < Item > {
7575 let has_doc_hidden = i. attrs . lists ( sym:: doc) . has_word ( sym:: hidden) ;
76- let is_impl = matches ! ( * i. kind, clean:: ImplItem ( ..) ) ;
76+ let is_impl_or_exported_macro = match * i. kind {
77+ clean:: ImplItem ( ..) => true ,
78+ // If the macro has the `#[macro_export]` attribute, it means it's accessible at the
79+ // crate level so it should be handled differently.
80+ clean:: MacroItem ( ..) => {
81+ i. attrs . other_attrs . iter ( ) . any ( |attr| attr. has_name ( sym:: macro_export) )
82+ }
83+ _ => false ,
84+ } ;
7785 let mut is_hidden = has_doc_hidden;
78- if !is_impl {
86+ if !is_impl_or_exported_macro {
7987 is_hidden = self . is_in_hidden_item || has_doc_hidden;
8088 if !is_hidden && i. inline_stmt_id . is_none ( ) {
8189 // We don't need to check if it's coming from a reexport since the reexport itself was
@@ -92,8 +100,8 @@ impl<'a, 'tcx> DocFolder for Stripper<'a, 'tcx> {
92100 if self . update_retained {
93101 self . retained . insert ( i. item_id ) ;
94102 }
95- return Some ( if is_impl {
96- self . recurse_in_impl ( i)
103+ return Some ( if is_impl_or_exported_macro {
104+ self . recurse_in_impl_or_exported_macro ( i)
97105 } else {
98106 self . set_is_in_hidden_item_and_fold ( false , i)
99107 } ) ;
0 commit comments