@@ -165,8 +165,8 @@ pub(crate) fn try_inline(
165165 MacroKinds :: BANG => ItemType :: Macro ,
166166 MacroKinds :: ATTR => ItemType :: ProcAttribute ,
167167 MacroKinds :: DERIVE => ItemType :: ProcDerive ,
168- _ if kinds . contains ( MacroKinds :: BANG ) => ItemType :: Macro ,
169- _ => panic ! ( "unsupported macro kind {kinds:?}" ) ,
168+ // Then it means it's more than one type so we default to "macro".
169+ _ => ItemType :: Macro ,
170170 } ;
171171 record_extern_fqn ( cx, did, type_kind) ;
172172 let first = try_inline_inner ( cx, mac, did, name, import_def_id) ;
@@ -819,25 +819,25 @@ fn build_macro(
819819 } ) ,
820820 None ,
821821 ) ,
822- _ if macro_kinds. contains ( MacroKinds :: BANG ) => {
823- let kind = clean:: MacroItem (
822+ _ => {
823+ let mut kinds = Vec :: new ( ) ;
824+ kinds. push ( clean:: MacroItem (
824825 clean:: Macro {
825826 source : utils:: display_macro_source ( cx, name, & def) ,
826827 macro_rules : def. macro_rules ,
827828 } ,
828829 macro_kinds,
829- ) ;
830- let mut ret = vec ! [ ] ;
830+ ) ) ;
831831 for kind in macro_kinds. iter ( ) . filter ( |kind| * kind != MacroKinds :: BANG ) {
832832 match kind {
833- MacroKinds :: ATTR => ret . push ( clean:: AttrMacroItem ) ,
834- MacroKinds :: DERIVE => ret . push ( clean:: DeriveMacroItem ) ,
833+ MacroKinds :: ATTR => kinds . push ( clean:: AttrMacroItem ) ,
834+ MacroKinds :: DERIVE => kinds . push ( clean:: DeriveMacroItem ) ,
835835 _ => panic ! ( "unsupported macro kind {kind:?}" ) ,
836836 }
837837 }
838- ( kind, Some ( ret) )
838+ let kind = kinds. pop ( ) . expect ( "no supported macro kind found" ) ;
839+ ( kind, Some ( kinds) )
839840 }
840- _ => panic ! ( "unsupported macro kind {macro_kinds:?}" ) ,
841841 } ,
842842 LoadedMacro :: ProcMacro ( ext) => {
843843 // Proc macros can only have a single kind
0 commit comments