@@ -5117,12 +5117,18 @@ struct ItemInfoCollector<'a, 'ra, 'tcx> {
5117
5117
}
5118
5118
5119
5119
impl 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
+ ) {
5121
5127
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 ( ) ,
5126
5132
target_feature : attrs. iter ( ) . any ( |attr| attr. has_name ( sym:: target_feature) ) ,
5127
5133
} ;
5128
5134
self . r . delegation_fn_sigs . insert ( self . r . local_def_id ( id) , sig) ;
@@ -5142,7 +5148,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
5142
5148
| ItemKind :: Trait ( box Trait { generics, .. } )
5143
5149
| ItemKind :: TraitAlias ( generics, _) => {
5144
5150
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 ) ;
5146
5152
}
5147
5153
5148
5154
let def_id = self . r . local_def_id ( item. id ) ;
@@ -5154,8 +5160,17 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
5154
5160
self . r . item_generics_num_lifetimes . insert ( def_id, count) ;
5155
5161
}
5156
5162
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
+
5157
5173
ItemKind :: Mod ( ..)
5158
- | ItemKind :: ForeignMod ( ..)
5159
5174
| ItemKind :: Static ( ..)
5160
5175
| ItemKind :: Use ( ..)
5161
5176
| ItemKind :: ExternCrate ( ..)
@@ -5175,7 +5190,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
5175
5190
5176
5191
fn visit_assoc_item ( & mut self , item : & ' ast AssocItem , ctxt : AssocCtxt ) {
5177
5192
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 ) ;
5179
5194
}
5180
5195
visit:: walk_assoc_item ( self , item, ctxt) ;
5181
5196
}
0 commit comments