@@ -1195,22 +1195,18 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1195
1195
record ! ( self . tables. rendered_const[ def_id] <- rendered) ;
1196
1196
}
1197
1197
ty:: AssocKind :: Fn => {
1198
- let fn_data = if let hir:: TraitItemKind :: Fn ( m_sig, m) = & ast_item. kind {
1199
- match * m {
1200
- hir:: TraitFn :: Required ( ref names) => {
1201
- record ! ( self . tables. fn_arg_names[ def_id] <- * names)
1202
- }
1203
- hir:: TraitFn :: Provided ( body) => {
1204
- record ! ( self . tables. fn_arg_names[ def_id] <- self . tcx. hir( ) . body_param_names( body) )
1205
- }
1206
- } ;
1207
- record ! ( self . tables. asyncness[ def_id] <- m_sig. header. asyncness) ;
1208
- FnData { constness : hir:: Constness :: NotConst }
1209
- } else {
1210
- bug ! ( )
1198
+ let hir:: TraitItemKind :: Fn ( m_sig, m) = & ast_item. kind else { bug ! ( ) } ;
1199
+ match * m {
1200
+ hir:: TraitFn :: Required ( ref names) => {
1201
+ record ! ( self . tables. fn_arg_names[ def_id] <- * names)
1202
+ }
1203
+ hir:: TraitFn :: Provided ( body) => {
1204
+ record ! ( self . tables. fn_arg_names[ def_id] <- self . tcx. hir( ) . body_param_names( body) )
1205
+ }
1211
1206
} ;
1207
+ record ! ( self . tables. asyncness[ def_id] <- m_sig. header. asyncness) ;
1208
+ record ! ( self . tables. impl_constness[ def_id] <- hir:: Constness :: NotConst ) ;
1212
1209
record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocFn ( self . lazy( AssocFnData {
1213
- fn_data,
1214
1210
container,
1215
1211
has_self: trait_item. fn_has_self_parameter,
1216
1212
} ) ) ) ;
@@ -1265,22 +1261,17 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1265
1261
}
1266
1262
}
1267
1263
ty:: AssocKind :: Fn => {
1268
- let fn_data = if let hir:: ImplItemKind :: Fn ( ref sig, body) = ast_item. kind {
1269
- record ! ( self . tables. asyncness[ def_id] <- sig. header. asyncness) ;
1270
- record ! ( self . tables. fn_arg_names[ def_id] <- self . tcx. hir( ) . body_param_names( body) ) ;
1271
- FnData {
1272
- // Can be inside `impl const Trait`, so using sig.header.constness is not reliable
1273
- constness : if self . tcx . is_const_fn_raw ( def_id) {
1274
- hir:: Constness :: Const
1275
- } else {
1276
- hir:: Constness :: NotConst
1277
- } ,
1278
- }
1264
+ let hir:: ImplItemKind :: Fn ( ref sig, body) = ast_item. kind else { bug ! ( ) } ;
1265
+ record ! ( self . tables. asyncness[ def_id] <- sig. header. asyncness) ;
1266
+ record ! ( self . tables. fn_arg_names[ def_id] <- self . tcx. hir( ) . body_param_names( body) ) ;
1267
+ // Can be inside `impl const Trait`, so using sig.header.constness is not reliable
1268
+ let constness = if self . tcx . is_const_fn_raw ( def_id) {
1269
+ hir:: Constness :: Const
1279
1270
} else {
1280
- bug ! ( )
1271
+ hir :: Constness :: NotConst
1281
1272
} ;
1273
+ record ! ( self . tables. impl_constness[ def_id] <- constness) ;
1282
1274
record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocFn ( self . lazy( AssocFnData {
1283
- fn_data,
1284
1275
container,
1285
1276
has_self: impl_item. fn_has_self_parameter,
1286
1277
} ) ) ) ;
@@ -1402,9 +1393,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1402
1393
hir:: ItemKind :: Fn ( ref sig, .., body) => {
1403
1394
record ! ( self . tables. asyncness[ def_id] <- sig. header. asyncness) ;
1404
1395
record ! ( self . tables. fn_arg_names[ def_id] <- self . tcx. hir( ) . body_param_names( body) ) ;
1405
- let data = FnData { constness : sig. header . constness } ;
1406
-
1407
- EntryKind :: Fn ( self . lazy ( data) )
1396
+ record ! ( self . tables. impl_constness[ def_id] <- sig. header. constness) ;
1397
+ EntryKind :: Fn
1408
1398
}
1409
1399
hir:: ItemKind :: Macro ( ref macro_def, _) => {
1410
1400
EntryKind :: MacroDef ( self . lazy ( & * macro_def. body ) , macro_def. macro_rules )
@@ -1897,14 +1887,13 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1897
1887
hir:: ForeignItemKind :: Fn ( _, ref names, _) => {
1898
1888
record ! ( self . tables. asyncness[ def_id] <- hir:: IsAsync :: NotAsync ) ;
1899
1889
record ! ( self . tables. fn_arg_names[ def_id] <- * names) ;
1900
- let data = FnData {
1901
- constness : if self . tcx . is_const_fn_raw ( def_id) {
1902
- hir:: Constness :: Const
1903
- } else {
1904
- hir:: Constness :: NotConst
1905
- } ,
1890
+ let constness = if self . tcx . is_const_fn_raw ( def_id) {
1891
+ hir:: Constness :: Const
1892
+ } else {
1893
+ hir:: Constness :: NotConst
1906
1894
} ;
1907
- record ! ( self . tables. kind[ def_id] <- EntryKind :: ForeignFn ( self . lazy( data) ) ) ;
1895
+ record ! ( self . tables. impl_constness[ def_id] <- constness) ;
1896
+ record ! ( self . tables. kind[ def_id] <- EntryKind :: ForeignFn ) ;
1908
1897
}
1909
1898
hir:: ForeignItemKind :: Static ( ..) => {
1910
1899
record ! ( self . tables. kind[ def_id] <- EntryKind :: ForeignStatic ) ;
0 commit comments