@@ -100,7 +100,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
100
100
None ) ;
101
101
// attach the crate's exported macros to the top-level module:
102
102
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 ( ) ;
104
104
self . module . macros . extend ( macro_exports) ;
105
105
self . module . is_crate = true ;
106
106
@@ -376,6 +376,10 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
376
376
} ) ;
377
377
true
378
378
}
379
+ Node :: MacroDef ( def) if !glob => {
380
+ om. macros . push ( self . visit_local_macro ( def, renamed) ) ;
381
+ true
382
+ }
379
383
_ => false ,
380
384
} ;
381
385
self . view_item_stack . remove ( & def_node_id) ;
@@ -593,7 +597,11 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
593
597
}
594
598
595
599
// 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 {
597
605
debug ! ( "visit_local_macro: {}" , def. name) ;
598
606
let tts = def. body . trees ( ) . collect :: < Vec < _ > > ( ) ;
599
607
// 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> {
602
610
Macro {
603
611
def_id : self . cx . tcx . hir . local_def_id ( def. id ) ,
604
612
attrs : def. attrs . clone ( ) ,
605
- name : def. name ,
613
+ name : renamed . unwrap_or ( def. name ) ,
606
614
whence : def. span ,
607
615
matchers,
608
616
stab : self . stability ( def. id ) ,
0 commit comments