@@ -164,8 +164,8 @@ pub(crate) fn try_inline(
164164 MacroKinds :: BANG => ItemType :: Macro ,
165165 MacroKinds :: ATTR => ItemType :: ProcAttribute ,
166166 MacroKinds :: DERIVE => ItemType :: ProcDerive ,
167- _ if kinds . contains ( MacroKinds :: BANG ) => ItemType :: Macro ,
168- _ => panic ! ( "unsupported macro kind {kinds:?}" ) ,
167+ // Then it means it's more than one type so we default to "macro".
168+ _ => ItemType :: Macro ,
169169 } ;
170170 record_extern_fqn ( cx, did, type_kind) ;
171171 let first = try_inline_inner ( cx, mac, did, name, import_def_id) ;
@@ -820,25 +820,25 @@ fn build_macro(
820820 } ) ,
821821 None ,
822822 ) ,
823- _ if macro_kinds. contains ( MacroKinds :: BANG ) => {
824- let kind = clean:: MacroItem (
823+ _ => {
824+ let mut kinds = Vec :: new ( ) ;
825+ kinds. push ( clean:: MacroItem (
825826 clean:: Macro {
826- source : utils:: display_macro_source ( cx , name, & def) ,
827+ source : utils:: display_macro_source ( tcx , name, & def) ,
827828 macro_rules : def. macro_rules ,
828829 } ,
829830 macro_kinds,
830- ) ;
831- let mut ret = vec ! [ ] ;
831+ ) ) ;
832832 for kind in macro_kinds. iter ( ) . filter ( |kind| * kind != MacroKinds :: BANG ) {
833833 match kind {
834- MacroKinds :: ATTR => ret . push ( clean:: AttrMacroItem ) ,
835- MacroKinds :: DERIVE => ret . push ( clean:: DeriveMacroItem ) ,
834+ MacroKinds :: ATTR => kinds . push ( clean:: AttrMacroItem ) ,
835+ MacroKinds :: DERIVE => kinds . push ( clean:: DeriveMacroItem ) ,
836836 _ => panic ! ( "unsupported macro kind {kind:?}" ) ,
837837 }
838838 }
839- ( kind, Some ( ret) )
839+ let kind = kinds. pop ( ) . expect ( "no supported macro kind found" ) ;
840+ ( kind, Some ( kinds) )
840841 }
841- _ => panic ! ( "unsupported macro kind {macro_kinds:?}" ) ,
842842 } ,
843843 LoadedMacro :: ProcMacro ( ext) => {
844844 // Proc macros can only have a single kind
0 commit comments