@@ -56,6 +56,7 @@ use externalfiles::ExternalHtml;
5656
5757use serialize:: json:: { ToJson , Json , as_json} ;
5858use syntax:: ast;
59+ use syntax:: ext:: base:: MacroKind ;
5960use syntax:: source_map:: FileName ;
6061use syntax:: feature_gate:: UnstableFeatures ;
6162use rustc:: hir:: def_id:: { CrateNum , CRATE_DEF_INDEX , DefId } ;
@@ -2155,6 +2156,12 @@ impl<'a> fmt::Display for Item<'a> {
21552156 clean:: EnumItem ( ..) => write ! ( fmt, "Enum " ) ?,
21562157 clean:: TypedefItem ( ..) => write ! ( fmt, "Type Definition " ) ?,
21572158 clean:: MacroItem ( ..) => write ! ( fmt, "Macro " ) ?,
2159+ clean:: ProcMacroItem ( ref mac) => match mac. kind {
2160+ MacroKind :: Bang => write ! ( fmt, "Macro " ) ?,
2161+ MacroKind :: Attr => write ! ( fmt, "Attribute Macro " ) ?,
2162+ MacroKind :: Derive => write ! ( fmt, "Derive Macro " ) ?,
2163+ MacroKind :: ProcMacroStub => unreachable ! ( ) ,
2164+ }
21582165 clean:: PrimitiveItem ( ..) => write ! ( fmt, "Primitive Type " ) ?,
21592166 clean:: StaticItem ( ..) | clean:: ForeignStaticItem ( ..) => write ! ( fmt, "Static " ) ?,
21602167 clean:: ConstantItem ( ..) => write ! ( fmt, "Constant " ) ?,
@@ -2191,6 +2198,7 @@ impl<'a> fmt::Display for Item<'a> {
21912198 clean:: EnumItem ( ref e) => item_enum ( fmt, self . cx , self . item , e) ,
21922199 clean:: TypedefItem ( ref t, _) => item_typedef ( fmt, self . cx , self . item , t) ,
21932200 clean:: MacroItem ( ref m) => item_macro ( fmt, self . cx , self . item , m) ,
2201+ clean:: ProcMacroItem ( ref m) => item_proc_macro ( fmt, self . cx , self . item , m) ,
21942202 clean:: PrimitiveItem ( ref p) => item_primitive ( fmt, self . cx , self . item , p) ,
21952203 clean:: StaticItem ( ref i) | clean:: ForeignStaticItem ( ref i) =>
21962204 item_static ( fmt, self . cx , self . item , i) ,
@@ -4523,6 +4531,8 @@ fn item_ty_to_strs(ty: &ItemType) -> (&'static str, &'static str) {
45234531 ItemType :: ForeignType => ( "foreign-types" , "Foreign Types" ) ,
45244532 ItemType :: Keyword => ( "keywords" , "Keywords" ) ,
45254533 ItemType :: Existential => ( "existentials" , "Existentials" ) ,
4534+ ItemType :: ProcAttribute => ( "attributes" , "Attribute Macros" ) ,
4535+ ItemType :: ProcDerive => ( "derives" , "Derive Macros" ) ,
45264536 }
45274537}
45284538
@@ -4598,6 +4608,17 @@ fn item_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
45984608 document ( w, cx, it)
45994609}
46004610
4611+ fn item_proc_macro ( w : & mut fmt:: Formatter , cx : & Context , it : & clean:: Item , m : & clean:: ProcMacro )
4612+ -> fmt:: Result
4613+ {
4614+ if m. kind == MacroKind :: Bang {
4615+ write ! ( w, "<pre class='rust macro'>" ) ?;
4616+ write ! ( w, "{}!() {{ /* proc-macro */ }}" , it. name. as_ref( ) . unwrap( ) ) ?;
4617+ write ! ( w, "</pre>" ) ?;
4618+ }
4619+ document ( w, cx, it)
4620+ }
4621+
46014622fn item_primitive ( w : & mut fmt:: Formatter , cx : & Context ,
46024623 it : & clean:: Item ,
46034624 _p : & clean:: PrimitiveType ) -> fmt:: Result {
0 commit comments