1
Fork 0

add derive macros' helper attributes to doc output

This commit is contained in:
QuietMisdreavus 2018-09-26 11:29:41 -05:00
parent 869ebc4f95
commit 27429d9415
5 changed files with 34 additions and 1 deletions

View file

@ -13,7 +13,7 @@
use std::iter::once;
use syntax::ast;
use syntax::ext::base::MacroKind;
use syntax::ext::base::{MacroKind, SyntaxExtension};
use syntax_pos::Span;
use rustc::hir;
@ -465,8 +465,14 @@ fn build_macro(cx: &DocContext, did: DefId, name: ast::Name) -> clean::ItemEnum
})
}
LoadedMacro::ProcMacro(ext) => {
let helpers = match &*ext {
&SyntaxExtension::ProcMacroDerive(_, ref syms, ..) => { syms.clean(cx) }
_ => Vec::new(),
};
clean::ProcMacroItem(clean::ProcMacro {
kind: ext.kind(),
helpers,
})
}
}

View file

@ -3793,6 +3793,7 @@ impl Clean<Item> for doctree::Macro {
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct ProcMacro {
pub kind: MacroKind,
pub helpers: Vec<String>,
}
impl Clean<Item> for doctree::ProcMacro {
@ -3807,6 +3808,7 @@ impl Clean<Item> for doctree::ProcMacro {
def_id: cx.tcx.hir.local_def_id(self.id),
inner: ProcMacroItem(ProcMacro {
kind: self.kind,
helpers: self.helpers.clean(cx),
}),
}
}