@@ -5101,12 +5101,18 @@ struct ItemInfoCollector<'a, 'ra, 'tcx> {
51015101}
51025102
51035103impl ItemInfoCollector < ' _ , ' _ , ' _ > {
5104- fn collect_fn_info ( & mut self , sig : & FnSig , id : NodeId , attrs : & [ Attribute ] ) {
5104+ fn collect_fn_info (
5105+ & mut self ,
5106+ header : FnHeader ,
5107+ decl : & FnDecl ,
5108+ id : NodeId ,
5109+ attrs : & [ Attribute ] ,
5110+ ) {
51055111 let sig = DelegationFnSig {
5106- header : sig . header ,
5107- param_count : sig . decl . inputs . len ( ) ,
5108- has_self : sig . decl . has_self ( ) ,
5109- c_variadic : sig . decl . c_variadic ( ) ,
5112+ header,
5113+ param_count : decl. inputs . len ( ) ,
5114+ has_self : decl. has_self ( ) ,
5115+ c_variadic : decl. c_variadic ( ) ,
51105116 target_feature : attrs. iter ( ) . any ( |attr| attr. has_name ( sym:: target_feature) ) ,
51115117 } ;
51125118 self . r . delegation_fn_sigs . insert ( self . r . local_def_id ( id) , sig) ;
@@ -5126,7 +5132,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
51265132 | ItemKind :: Trait ( box Trait { generics, .. } )
51275133 | ItemKind :: TraitAlias ( generics, _) => {
51285134 if let ItemKind :: Fn ( box Fn { sig, .. } ) = & item. kind {
5129- self . collect_fn_info ( sig, item. id , & item. attrs ) ;
5135+ self . collect_fn_info ( sig. header , & sig . decl , item. id , & item. attrs ) ;
51305136 }
51315137
51325138 let def_id = self . r . local_def_id ( item. id ) ;
@@ -5138,8 +5144,17 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
51385144 self . r . item_generics_num_lifetimes . insert ( def_id, count) ;
51395145 }
51405146
5147+ ItemKind :: ForeignMod ( ForeignMod { extern_span, safety : _, abi, items } ) => {
5148+ for foreign_item in items {
5149+ if let ForeignItemKind :: Fn ( box Fn { sig, .. } ) = & foreign_item. kind {
5150+ let new_header =
5151+ FnHeader { ext : Extern :: from_abi ( * abi, * extern_span) , ..sig. header } ;
5152+ self . collect_fn_info ( new_header, & sig. decl , foreign_item. id , & item. attrs ) ;
5153+ }
5154+ }
5155+ }
5156+
51415157 ItemKind :: Mod ( ..)
5142- | ItemKind :: ForeignMod ( ..)
51435158 | ItemKind :: Static ( ..)
51445159 | ItemKind :: Use ( ..)
51455160 | ItemKind :: ExternCrate ( ..)
@@ -5159,7 +5174,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
51595174
51605175 fn visit_assoc_item ( & mut self , item : & ' ast AssocItem , ctxt : AssocCtxt ) {
51615176 if let AssocItemKind :: Fn ( box Fn { sig, .. } ) = & item. kind {
5162- self . collect_fn_info ( sig, item. id , & item. attrs ) ;
5177+ self . collect_fn_info ( sig. header , & sig . decl , item. id , & item. attrs ) ;
51635178 }
51645179 visit:: walk_assoc_item ( self , item, ctxt) ;
51655180 }
0 commit comments