@@ -1195,12 +1195,16 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1195
1195
}
1196
1196
ty:: AssocKind :: Fn => {
1197
1197
let fn_data = if let hir:: TraitItemKind :: Fn ( m_sig, m) = & ast_item. kind {
1198
- let param_names = match * m {
1199
- hir:: TraitFn :: Required ( ref names) => self . encode_fn_param_names ( names) ,
1200
- hir:: TraitFn :: Provided ( body) => self . encode_fn_param_names_for_body ( body) ,
1198
+ match * m {
1199
+ hir:: TraitFn :: Required ( ref names) => {
1200
+ record ! ( self . tables. fn_arg_names[ def_id] <- * names)
1201
+ }
1202
+ hir:: TraitFn :: Provided ( body) => {
1203
+ record ! ( self . tables. fn_arg_names[ def_id] <- self . tcx. hir( ) . body_param_names( body) )
1204
+ }
1201
1205
} ;
1202
1206
record ! ( self . tables. asyncness[ def_id] <- m_sig. header. asyncness) ;
1203
- FnData { constness : hir:: Constness :: NotConst , param_names }
1207
+ FnData { constness : hir:: Constness :: NotConst }
1204
1208
} else {
1205
1209
bug ! ( )
1206
1210
} ;
@@ -1262,14 +1266,14 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1262
1266
ty:: AssocKind :: Fn => {
1263
1267
let fn_data = if let hir:: ImplItemKind :: Fn ( ref sig, body) = ast_item. kind {
1264
1268
record ! ( self . tables. asyncness[ def_id] <- sig. header. asyncness) ;
1269
+ record ! ( self . tables. fn_arg_names[ def_id] <- self . tcx. hir( ) . body_param_names( body) ) ;
1265
1270
FnData {
1266
1271
// Can be inside `impl const Trait`, so using sig.header.constness is not reliable
1267
1272
constness : if self . tcx . is_const_fn_raw ( def_id) {
1268
1273
hir:: Constness :: Const
1269
1274
} else {
1270
1275
hir:: Constness :: NotConst
1271
1276
} ,
1272
- param_names : self . encode_fn_param_names_for_body ( body) ,
1273
1277
}
1274
1278
} else {
1275
1279
bug ! ( )
@@ -1294,14 +1298,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1294
1298
}
1295
1299
}
1296
1300
1297
- fn encode_fn_param_names_for_body ( & mut self , body_id : hir:: BodyId ) -> Lazy < [ Ident ] > {
1298
- self . lazy ( self . tcx . hir ( ) . body_param_names ( body_id) )
1299
- }
1300
-
1301
- fn encode_fn_param_names ( & mut self , param_names : & [ Ident ] ) -> Lazy < [ Ident ] > {
1302
- self . lazy ( param_names. iter ( ) )
1303
- }
1304
-
1305
1301
fn encode_mir ( & mut self ) {
1306
1302
if self . is_proc_macro {
1307
1303
return ;
@@ -1405,10 +1401,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1405
1401
}
1406
1402
hir:: ItemKind :: Fn ( ref sig, .., body) => {
1407
1403
record ! ( self . tables. asyncness[ def_id] <- sig. header. asyncness) ;
1408
- let data = FnData {
1409
- constness : sig. header . constness ,
1410
- param_names : self . encode_fn_param_names_for_body ( body) ,
1411
- } ;
1404
+ record ! ( self . tables. fn_arg_names[ def_id] <- self . tcx. hir( ) . body_param_names( body) ) ;
1405
+ let data = FnData { constness : sig. header . constness } ;
1412
1406
1413
1407
EntryKind :: Fn ( self . lazy ( data) )
1414
1408
}
@@ -1874,13 +1868,13 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1874
1868
match nitem. kind {
1875
1869
hir:: ForeignItemKind :: Fn ( _, ref names, _) => {
1876
1870
record ! ( self . tables. asyncness[ def_id] <- hir:: IsAsync :: NotAsync ) ;
1871
+ record ! ( self . tables. fn_arg_names[ def_id] <- * names) ;
1877
1872
let data = FnData {
1878
1873
constness : if self . tcx . is_const_fn_raw ( def_id) {
1879
1874
hir:: Constness :: Const
1880
1875
} else {
1881
1876
hir:: Constness :: NotConst
1882
1877
} ,
1883
- param_names : self . encode_fn_param_names ( names) ,
1884
1878
} ;
1885
1879
record ! ( self . tables. kind[ def_id] <- EntryKind :: ForeignFn ( self . lazy( data) ) ) ;
1886
1880
}
0 commit comments