@@ -158,7 +158,7 @@ pub(crate) fn try_inline(
158158 } )
159159 }
160160 Res :: Def ( DefKind :: Macro ( kinds) , did) => {
161- let ( mac, others ) = build_macro ( cx. tcx , did, name, kinds) ;
161+ let mac = build_macro ( cx. tcx , did, name, kinds) ;
162162
163163 let type_kind = match kinds {
164164 MacroKinds :: BANG => ItemType :: Macro ,
@@ -168,15 +168,7 @@ pub(crate) fn try_inline(
168168 _ => ItemType :: Macro ,
169169 } ;
170170 record_extern_fqn ( cx, did, type_kind) ;
171- let first = try_inline_inner ( cx, mac, did, name, import_def_id) ;
172- if let Some ( others) = others {
173- for mac_kind in others {
174- let mut mac = first. clone ( ) ;
175- mac. inner . kind = mac_kind;
176- ret. push ( mac) ;
177- }
178- }
179- ret. push ( first) ;
171+ ret. push ( try_inline_inner ( cx, mac, did, name, import_def_id) ) ;
180172 return Some ( ret) ;
181173 }
182174 _ => return None ,
@@ -793,52 +785,24 @@ fn build_macro(
793785 def_id : DefId ,
794786 name : Symbol ,
795787 macro_kinds : MacroKinds ,
796- ) -> ( clean:: ItemKind , Option < Vec < clean :: ItemKind > > ) {
788+ ) -> clean:: ItemKind {
797789 match CStore :: from_tcx ( tcx) . load_macro_untracked ( tcx, def_id) {
798790 LoadedMacro :: MacroDef { def, .. } => match macro_kinds {
799- MacroKinds :: BANG => (
800- clean:: MacroItem (
801- clean:: Macro {
802- source : utils:: display_macro_source ( tcx, name, & def) ,
803- macro_rules : def. macro_rules ,
804- } ,
805- MacroKinds :: BANG ,
806- ) ,
807- None ,
808- ) ,
809- MacroKinds :: DERIVE => (
810- clean:: ProcMacroItem ( clean:: ProcMacro {
811- kind : MacroKind :: Derive ,
812- helpers : Vec :: new ( ) ,
813- } ) ,
814- None ,
815- ) ,
816- MacroKinds :: ATTR => (
817- clean:: ProcMacroItem ( clean:: ProcMacro {
818- kind : MacroKind :: Attr ,
819- helpers : Vec :: new ( ) ,
820- } ) ,
821- None ,
791+ MacroKinds :: DERIVE => clean:: ProcMacroItem ( clean:: ProcMacro {
792+ kind : MacroKind :: Derive ,
793+ helpers : Vec :: new ( ) ,
794+ } ) ,
795+ MacroKinds :: ATTR => clean:: ProcMacroItem ( clean:: ProcMacro {
796+ kind : MacroKind :: Attr ,
797+ helpers : Vec :: new ( ) ,
798+ } ) ,
799+ _ => clean:: MacroItem (
800+ clean:: Macro {
801+ source : utils:: display_macro_source ( tcx, name, & def) ,
802+ macro_rules : def. macro_rules ,
803+ } ,
804+ macro_kinds,
822805 ) ,
823- _ => {
824- let mut kinds = Vec :: new ( ) ;
825- kinds. push ( clean:: MacroItem (
826- clean:: Macro {
827- source : utils:: display_macro_source ( tcx, name, & def) ,
828- macro_rules : def. macro_rules ,
829- } ,
830- macro_kinds,
831- ) ) ;
832- for kind in macro_kinds. iter ( ) . filter ( |kind| * kind != MacroKinds :: BANG ) {
833- match kind {
834- MacroKinds :: ATTR => kinds. push ( clean:: AttrMacroItem ) ,
835- MacroKinds :: DERIVE => kinds. push ( clean:: DeriveMacroItem ) ,
836- _ => panic ! ( "unsupported macro kind {kind:?}" ) ,
837- }
838- }
839- let kind = kinds. pop ( ) . expect ( "no supported macro kind found" ) ;
840- ( kind, Some ( kinds) )
841- }
842806 } ,
843807 LoadedMacro :: ProcMacro ( ext) => {
844808 // Proc macros can only have a single kind
@@ -848,7 +812,7 @@ fn build_macro(
848812 MacroKinds :: DERIVE => MacroKind :: Derive ,
849813 _ => unreachable ! ( ) ,
850814 } ;
851- ( clean:: ProcMacroItem ( clean:: ProcMacro { kind, helpers : ext. helper_attrs } ) , None )
815+ clean:: ProcMacroItem ( clean:: ProcMacro { kind, helpers : ext. helper_attrs } )
852816 }
853817 }
854818}
0 commit comments