@@ -1276,10 +1276,6 @@ pub(super) fn hir_module_items(tcx: TyCtxt<'_>, module_id: LocalDefId) -> Module
1276
1276
1277
1277
self . items . push ( item. item_id ( ) ) ;
1278
1278
1279
- if self . tcx . hir ( ) . is_body_owner ( item. def_id ) {
1280
- self . body_owners . push ( item. def_id ) ;
1281
- }
1282
-
1283
1279
if let ItemKind :: Mod ( ..) = item. kind {
1284
1280
// If this declares another module, do not recurse inside it.
1285
1281
self . submodules . push ( item. def_id ) ;
@@ -1319,14 +1315,14 @@ pub(super) fn hir_module_items(tcx: TyCtxt<'_>, module_id: LocalDefId) -> Module
1319
1315
if matches ! ( ex. kind, ExprKind :: Closure { .. } )
1320
1316
&& associated_body ( Node :: Expr ( ex) ) . is_some ( )
1321
1317
{
1322
- self . body_owners . push ( ex. hir_id . owner ) ;
1318
+ self . body_owners . push ( self . tcx . hir ( ) . local_def_id ( ex. hir_id ) ) ;
1323
1319
}
1324
1320
intravisit:: walk_expr ( self , ex)
1325
1321
}
1326
1322
1327
1323
fn visit_anon_const ( & mut self , c : & ' hir AnonConst ) {
1328
1324
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 ) ) ;
1330
1326
}
1331
1327
intravisit:: walk_anon_const ( self , c)
1332
1328
}
@@ -1427,14 +1423,14 @@ pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
1427
1423
if matches ! ( ex. kind, ExprKind :: Closure { .. } )
1428
1424
&& associated_body ( Node :: Expr ( ex) ) . is_some ( )
1429
1425
{
1430
- self . body_owners . push ( ex. hir_id . owner ) ;
1426
+ self . body_owners . push ( self . tcx . hir ( ) . local_def_id ( ex. hir_id ) ) ;
1431
1427
}
1432
1428
intravisit:: walk_expr ( self , ex)
1433
1429
}
1434
1430
1435
1431
fn visit_anon_const ( & mut self , c : & ' hir AnonConst ) {
1436
1432
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 ) ) ;
1438
1434
}
1439
1435
intravisit:: walk_anon_const ( self , c)
1440
1436
}
0 commit comments