@@ -71,9 +71,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
7171 None ,
7272 ) ;
7373 // Attach the crate's exported macros to the top-level module:
74- module
75- . macros
76- . extend ( krate. exported_macros . iter ( ) . map ( |def| self . visit_local_macro ( def, None ) ) ) ;
74+ module. macros . extend ( krate. exported_macros . iter ( ) . map ( |def| ( def, None ) ) ) ;
7775 module. is_crate = true ;
7876
7977 self . cx . renderinfo . get_mut ( ) . exact_paths = self . exact_paths ;
@@ -216,7 +214,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
216214 true
217215 }
218216 Node :: MacroDef ( def) if !glob => {
219- om. macros . push ( self . visit_local_macro ( def, renamed. map ( |i| i . name ) ) ) ;
217+ om. macros . push ( ( def, renamed) ) ;
220218 true
221219 }
222220 _ => false ,
@@ -339,19 +337,4 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
339337 om. foreigns . push ( ( item, renamed) ) ;
340338 }
341339 }
342-
343- // Convert each `exported_macro` into a doc item.
344- fn visit_local_macro ( & self , def : & ' tcx hir:: MacroDef < ' _ > , renamed : Option < Symbol > ) -> Macro {
345- debug ! ( "visit_local_macro: {}" , def. ident) ;
346- let tts = def. ast . body . inner_tokens ( ) . trees ( ) . collect :: < Vec < _ > > ( ) ;
347- // Extract the spans of all matchers. They represent the "interface" of the macro.
348- let matchers = tts. chunks ( 4 ) . map ( |arm| arm[ 0 ] . span ( ) ) . collect ( ) ;
349-
350- Macro {
351- def_id : self . cx . tcx . hir ( ) . local_def_id ( def. hir_id ) . to_def_id ( ) ,
352- name : renamed. unwrap_or ( def. ident . name ) ,
353- matchers,
354- imported_from : None ,
355- }
356- }
357340}
0 commit comments