@@ -104,7 +104,11 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
104
104
// separately
105
105
Def :: Macro ( did, MacroKind :: Bang ) => {
106
106
record_extern_fqn ( cx, did, clean:: TypeKind :: Macro ) ;
107
- clean:: MacroItem ( build_macro ( cx, did, name) )
107
+ if let Some ( mac) = build_macro ( cx, did, name) {
108
+ clean:: MacroItem ( mac)
109
+ } else {
110
+ return None ;
111
+ }
108
112
}
109
113
_ => return None ,
110
114
} ;
@@ -466,12 +470,12 @@ fn build_static(cx: &DocContext, did: DefId, mutable: bool) -> clean::Static {
466
470
}
467
471
}
468
472
469
- fn build_macro ( cx : & DocContext , did : DefId , name : ast:: Name ) -> clean:: Macro {
473
+ fn build_macro ( cx : & DocContext , did : DefId , name : ast:: Name ) -> Option < clean:: Macro > {
470
474
let imported_from = cx. tcx . original_crate_name ( did. krate ) ;
471
475
let def = match cx. cstore . load_macro_untracked ( did, cx. sess ( ) ) {
472
476
LoadedMacro :: MacroDef ( macro_def) => macro_def,
473
477
// FIXME(jseyfried): document proc macro re-exports
474
- LoadedMacro :: ProcMacro ( ..) => panic ! ( "attempting to document proc-macro re-export" ) ,
478
+ LoadedMacro :: ProcMacro ( ..) => return None ,
475
479
} ;
476
480
477
481
let matchers: hir:: HirVec < Span > = if let ast:: ItemKind :: MacroDef ( ref def) = def. node {
@@ -487,10 +491,10 @@ fn build_macro(cx: &DocContext, did: DefId, name: ast::Name) -> clean::Macro {
487
491
format!( " {} => {{ ... }};\n " , span. to_src( cx) )
488
492
} ) . collect:: <String >( ) ) ;
489
493
490
- clean:: Macro {
494
+ Some ( clean:: Macro {
491
495
source,
492
496
imported_from : Some ( imported_from) . clean ( cx) ,
493
- }
497
+ } )
494
498
}
495
499
496
500
/// A trait's generics clause actually contains all of the predicates for all of
0 commit comments