@@ -1195,22 +1195,18 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
11951195 record ! ( self . tables. rendered_const[ def_id] <- rendered) ;
11961196 }
11971197 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+ }
12111206 } ;
1207+ record ! ( self . tables. asyncness[ def_id] <- m_sig. header. asyncness) ;
1208+ record ! ( self . tables. impl_constness[ def_id] <- hir:: Constness :: NotConst ) ;
12121209 record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocFn ( self . lazy( AssocFnData {
1213- fn_data,
12141210 container,
12151211 has_self: trait_item. fn_has_self_parameter,
12161212 } ) ) ) ;
@@ -1265,22 +1261,17 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
12651261 }
12661262 }
12671263 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
12791270 } else {
1280- bug ! ( )
1271+ hir :: Constness :: NotConst
12811272 } ;
1273+ record ! ( self . tables. impl_constness[ def_id] <- constness) ;
12821274 record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocFn ( self . lazy( AssocFnData {
1283- fn_data,
12841275 container,
12851276 has_self: impl_item. fn_has_self_parameter,
12861277 } ) ) ) ;
@@ -1402,9 +1393,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
14021393 hir:: ItemKind :: Fn ( ref sig, .., body) => {
14031394 record ! ( self . tables. asyncness[ def_id] <- sig. header. asyncness) ;
14041395 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
14081398 }
14091399 hir:: ItemKind :: Macro ( ref macro_def, _) => {
14101400 EntryKind :: MacroDef ( self . lazy ( & * macro_def. body ) , macro_def. macro_rules )
@@ -1897,14 +1887,13 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
18971887 hir:: ForeignItemKind :: Fn ( _, ref names, _) => {
18981888 record ! ( self . tables. asyncness[ def_id] <- hir:: IsAsync :: NotAsync ) ;
18991889 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
19061894 } ;
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 ) ;
19081897 }
19091898 hir:: ForeignItemKind :: Static ( ..) => {
19101899 record ! ( self . tables. kind[ def_id] <- EntryKind :: ForeignStatic ) ;
0 commit comments