@@ -1276,10 +1276,6 @@ pub(super) fn hir_module_items(tcx: TyCtxt<'_>, module_id: LocalDefId) -> Module
12761276
12771277 self . items . push ( item. item_id ( ) ) ;
12781278
1279- if self . tcx . hir ( ) . is_body_owner ( item. def_id ) {
1280- self . body_owners . push ( item. def_id ) ;
1281- }
1282-
12831279 if let ItemKind :: Mod ( ..) = item. kind {
12841280 // If this declares another module, do not recurse inside it.
12851281 self . submodules . push ( item. def_id ) ;
@@ -1319,14 +1315,14 @@ pub(super) fn hir_module_items(tcx: TyCtxt<'_>, module_id: LocalDefId) -> Module
13191315 if matches ! ( ex. kind, ExprKind :: Closure { .. } )
13201316 && associated_body ( Node :: Expr ( ex) ) . is_some ( )
13211317 {
1322- self . body_owners . push ( ex. hir_id . owner ) ;
1318+ self . body_owners . push ( self . tcx . hir ( ) . local_def_id ( ex. hir_id ) ) ;
13231319 }
13241320 intravisit:: walk_expr ( self , ex)
13251321 }
13261322
13271323 fn visit_anon_const ( & mut self , c : & ' hir AnonConst ) {
13281324 if associated_body ( Node :: AnonConst ( c) ) . is_some ( ) {
1329- self . body_owners . push ( c. hir_id . owner ) ;
1325+ self . body_owners . push ( self . tcx . hir ( ) . local_def_id ( c. hir_id ) ) ;
13301326 }
13311327 intravisit:: walk_anon_const ( self , c)
13321328 }
@@ -1427,14 +1423,14 @@ pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
14271423 if matches ! ( ex. kind, ExprKind :: Closure { .. } )
14281424 && associated_body ( Node :: Expr ( ex) ) . is_some ( )
14291425 {
1430- self . body_owners . push ( ex. hir_id . owner ) ;
1426+ self . body_owners . push ( self . tcx . hir ( ) . local_def_id ( ex. hir_id ) ) ;
14311427 }
14321428 intravisit:: walk_expr ( self , ex)
14331429 }
14341430
14351431 fn visit_anon_const ( & mut self , c : & ' hir AnonConst ) {
14361432 if associated_body ( Node :: AnonConst ( c) ) . is_some ( ) {
1437- self . body_owners . push ( c. hir_id . owner ) ;
1433+ self . body_owners . push ( self . tcx . hir ( ) . local_def_id ( c. hir_id ) ) ;
14381434 }
14391435 intravisit:: walk_anon_const ( self , c)
14401436 }
0 commit comments