@@ -100,7 +100,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
100100 None ) ;
101101 // attach the crate's exported macros to the top-level module:
102102 let macro_exports: Vec < _ > =
103- krate. exported_macros . iter ( ) . map ( |def| self . visit_local_macro ( def) ) . collect ( ) ;
103+ krate. exported_macros . iter ( ) . map ( |def| self . visit_local_macro ( def, None ) ) . collect ( ) ;
104104 self . module . macros . extend ( macro_exports) ;
105105 self . module . is_crate = true ;
106106
@@ -376,6 +376,10 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
376376 } ) ;
377377 true
378378 }
379+ Node :: MacroDef ( def) if !glob => {
380+ om. macros . push ( self . visit_local_macro ( def, renamed) ) ;
381+ true
382+ }
379383 _ => false ,
380384 } ;
381385 self . view_item_stack . remove ( & def_node_id) ;
@@ -593,7 +597,11 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
593597 }
594598
595599 // convert each exported_macro into a doc item
596- fn visit_local_macro ( & self , def : & hir:: MacroDef ) -> Macro {
600+ fn visit_local_macro (
601+ & self ,
602+ def : & hir:: MacroDef ,
603+ renamed : Option < ast:: Name >
604+ ) -> Macro {
597605 debug ! ( "visit_local_macro: {}" , def. name) ;
598606 let tts = def. body . trees ( ) . collect :: < Vec < _ > > ( ) ;
599607 // Extract the spans of all matchers. They represent the "interface" of the macro.
@@ -602,7 +610,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
602610 Macro {
603611 def_id : self . cx . tcx . hir . local_def_id ( def. id ) ,
604612 attrs : def. attrs . clone ( ) ,
605- name : def. name ,
613+ name : renamed . unwrap_or ( def. name ) ,
606614 whence : def. span ,
607615 matchers,
608616 stab : self . stability ( def. id ) ,
0 commit comments