@@ -5117,12 +5117,18 @@ struct ItemInfoCollector<'a, 'ra, 'tcx> {
51175117}
51185118
51195119impl ItemInfoCollector < ' _ , ' _ , ' _ > {
5120- fn collect_fn_info ( & mut self , sig : & FnSig , id : NodeId , attrs : & [ Attribute ] ) {
5120+ fn collect_fn_info (
5121+ & mut self ,
5122+ header : FnHeader ,
5123+ decl : & FnDecl ,
5124+ id : NodeId ,
5125+ attrs : & [ Attribute ] ,
5126+ ) {
51215127 let sig = DelegationFnSig {
5122- header : sig . header ,
5123- param_count : sig . decl . inputs . len ( ) ,
5124- has_self : sig . decl . has_self ( ) ,
5125- c_variadic : sig . decl . c_variadic ( ) ,
5128+ header,
5129+ param_count : decl. inputs . len ( ) ,
5130+ has_self : decl. has_self ( ) ,
5131+ c_variadic : decl. c_variadic ( ) ,
51265132 target_feature : attrs. iter ( ) . any ( |attr| attr. has_name ( sym:: target_feature) ) ,
51275133 } ;
51285134 self . r . delegation_fn_sigs . insert ( self . r . local_def_id ( id) , sig) ;
@@ -5142,7 +5148,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
51425148 | ItemKind :: Trait ( box Trait { generics, .. } )
51435149 | ItemKind :: TraitAlias ( generics, _) => {
51445150 if let ItemKind :: Fn ( box Fn { sig, .. } ) = & item. kind {
5145- self . collect_fn_info ( sig, item. id , & item. attrs ) ;
5151+ self . collect_fn_info ( sig. header , & sig . decl , item. id , & item. attrs ) ;
51465152 }
51475153
51485154 let def_id = self . r . local_def_id ( item. id ) ;
@@ -5154,8 +5160,17 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
51545160 self . r . item_generics_num_lifetimes . insert ( def_id, count) ;
51555161 }
51565162
5163+ ItemKind :: ForeignMod ( ForeignMod { extern_span, safety : _, abi, items } ) => {
5164+ for foreign_item in items {
5165+ if let ForeignItemKind :: Fn ( box Fn { sig, .. } ) = & foreign_item. kind {
5166+ let new_header =
5167+ FnHeader { ext : Extern :: from_abi ( * abi, * extern_span) , ..sig. header } ;
5168+ self . collect_fn_info ( new_header, & sig. decl , foreign_item. id , & item. attrs ) ;
5169+ }
5170+ }
5171+ }
5172+
51575173 ItemKind :: Mod ( ..)
5158- | ItemKind :: ForeignMod ( ..)
51595174 | ItemKind :: Static ( ..)
51605175 | ItemKind :: Use ( ..)
51615176 | ItemKind :: ExternCrate ( ..)
@@ -5175,7 +5190,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
51755190
51765191 fn visit_assoc_item ( & mut self , item : & ' ast AssocItem , ctxt : AssocCtxt ) {
51775192 if let AssocItemKind :: Fn ( box Fn { sig, .. } ) = & item. kind {
5178- self . collect_fn_info ( sig, item. id , & item. attrs ) ;
5193+ self . collect_fn_info ( sig. header , & sig . decl , item. id , & item. attrs ) ;
51795194 }
51805195 visit:: walk_assoc_item ( self , item, ctxt) ;
51815196 }
0 commit comments