@@ -5056,12 +5056,18 @@ struct ItemInfoCollector<'a, 'ra, 'tcx> {
50565056}
50575057
50585058impl ItemInfoCollector < ' _ , ' _ , ' _ > {
5059- fn collect_fn_info ( & mut self , sig : & FnSig , id : NodeId , attrs : & [ Attribute ] ) {
5059+ fn collect_fn_info (
5060+ & mut self ,
5061+ header : FnHeader ,
5062+ decl : & FnDecl ,
5063+ id : NodeId ,
5064+ attrs : & [ Attribute ] ,
5065+ ) {
50605066 let sig = DelegationFnSig {
5061- header : sig . header ,
5062- param_count : sig . decl . inputs . len ( ) ,
5063- has_self : sig . decl . has_self ( ) ,
5064- c_variadic : sig . decl . c_variadic ( ) ,
5067+ header,
5068+ param_count : decl. inputs . len ( ) ,
5069+ has_self : decl. has_self ( ) ,
5070+ c_variadic : decl. c_variadic ( ) ,
50655071 target_feature : attrs. iter ( ) . any ( |attr| attr. has_name ( sym:: target_feature) ) ,
50665072 } ;
50675073 self . r . delegation_fn_sigs . insert ( self . r . local_def_id ( id) , sig) ;
@@ -5081,7 +5087,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
50815087 | ItemKind :: Trait ( box Trait { generics, .. } )
50825088 | ItemKind :: TraitAlias ( generics, _) => {
50835089 if let ItemKind :: Fn ( box Fn { sig, .. } ) = & item. kind {
5084- self . collect_fn_info ( sig, item. id , & item. attrs ) ;
5090+ self . collect_fn_info ( sig. header , & sig . decl , item. id , & item. attrs ) ;
50855091 }
50865092
50875093 let def_id = self . r . local_def_id ( item. id ) ;
@@ -5093,8 +5099,21 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
50935099 self . r . item_generics_num_lifetimes . insert ( def_id, count) ;
50945100 }
50955101
5102+ ItemKind :: ForeignMod ( ForeignMod { extern_span, safety : _, abi, items } ) => {
5103+ for foreign_item in items {
5104+ if let ForeignItemKind :: Fn ( box Fn { sig, .. } ) = & foreign_item. kind {
5105+ let new_header = FnHeader {
5106+ ext : abi. map_or ( Extern :: Implicit ( * extern_span) , |lit| {
5107+ Extern :: Explicit ( lit, * extern_span)
5108+ } ) ,
5109+ ..sig. header
5110+ } ;
5111+ self . collect_fn_info ( new_header, & sig. decl , foreign_item. id , & item. attrs ) ;
5112+ }
5113+ }
5114+ }
5115+
50965116 ItemKind :: Mod ( ..)
5097- | ItemKind :: ForeignMod ( ..)
50985117 | ItemKind :: Static ( ..)
50995118 | ItemKind :: Use ( ..)
51005119 | ItemKind :: ExternCrate ( ..)
@@ -5114,7 +5133,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
51145133
51155134 fn visit_assoc_item ( & mut self , item : & ' ast AssocItem , ctxt : AssocCtxt ) {
51165135 if let AssocItemKind :: Fn ( box Fn { sig, .. } ) = & item. kind {
5117- self . collect_fn_info ( sig, item. id , & item. attrs ) ;
5136+ self . collect_fn_info ( sig. header , & sig . decl , item. id , & item. attrs ) ;
51185137 }
51195138 visit:: walk_assoc_item ( self , item, ctxt) ;
51205139 }
0 commit comments