@@ -5101,12 +5101,18 @@ struct ItemInfoCollector<'a, 'ra, 'tcx> {
5101
5101
}
5102
5102
5103
5103
impl 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
+ ) {
5105
5111
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 ( ) ,
5110
5116
target_feature : attrs. iter ( ) . any ( |attr| attr. has_name ( sym:: target_feature) ) ,
5111
5117
} ;
5112
5118
self . r . delegation_fn_sigs . insert ( self . r . local_def_id ( id) , sig) ;
@@ -5126,7 +5132,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
5126
5132
| ItemKind :: Trait ( box Trait { generics, .. } )
5127
5133
| ItemKind :: TraitAlias ( generics, _) => {
5128
5134
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 ) ;
5130
5136
}
5131
5137
5132
5138
let def_id = self . r . local_def_id ( item. id ) ;
@@ -5138,8 +5144,17 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
5138
5144
self . r . item_generics_num_lifetimes . insert ( def_id, count) ;
5139
5145
}
5140
5146
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
+
5141
5157
ItemKind :: Mod ( ..)
5142
- | ItemKind :: ForeignMod ( ..)
5143
5158
| ItemKind :: Static ( ..)
5144
5159
| ItemKind :: Use ( ..)
5145
5160
| ItemKind :: ExternCrate ( ..)
@@ -5159,7 +5174,7 @@ impl<'ast> Visitor<'ast> for ItemInfoCollector<'_, '_, '_> {
5159
5174
5160
5175
fn visit_assoc_item ( & mut self , item : & ' ast AssocItem , ctxt : AssocCtxt ) {
5161
5176
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 ) ;
5163
5178
}
5164
5179
visit:: walk_assoc_item ( self , item, ctxt) ;
5165
5180
}
0 commit comments