@@ -71,9 +71,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
71
71
None ,
72
72
) ;
73
73
// 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 ) ) ) ;
77
75
module. is_crate = true ;
78
76
79
77
self . cx . renderinfo . get_mut ( ) . exact_paths = self . exact_paths ;
@@ -216,7 +214,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
216
214
true
217
215
}
218
216
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) ) ;
220
218
true
221
219
}
222
220
_ => false ,
@@ -339,19 +337,4 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
339
337
om. foreigns . push ( ( item, renamed) ) ;
340
338
}
341
339
}
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
- }
357
340
}
0 commit comments