@@ -44,6 +44,7 @@ pub fn associated_body(node: Node<'_>) -> Option<(LocalDefId, BodyId)> {
44
44
}
45
45
46
46
Node :: AnonConst ( constant) => Some ( ( constant. def_id , constant. body ) ) ,
47
+ Node :: ConstBlock ( constant) => Some ( ( constant. def_id , constant. body ) ) ,
47
48
48
49
_ => None ,
49
50
}
@@ -240,15 +241,8 @@ impl<'hir> Map<'hir> {
240
241
None => bug ! ( "constructor node without a constructor" ) ,
241
242
}
242
243
}
243
- Node :: AnonConst ( _) => {
244
- let inline = match self . find_parent ( hir_id) {
245
- Some ( Node :: Expr ( & Expr {
246
- kind : ExprKind :: ConstBlock ( ref anon_const) , ..
247
- } ) ) if anon_const. hir_id == hir_id => true ,
248
- _ => false ,
249
- } ;
250
- if inline { DefKind :: InlineConst } else { DefKind :: AnonConst }
251
- }
244
+ Node :: AnonConst ( _) => DefKind :: AnonConst ,
245
+ Node :: ConstBlock ( _) => DefKind :: InlineConst ,
252
246
Node :: Field ( _) => DefKind :: Field ,
253
247
Node :: Expr ( expr) => match expr. kind {
254
248
ExprKind :: Closure ( Closure { movability : None , .. } ) => DefKind :: Closure ,
@@ -1060,6 +1054,7 @@ impl<'hir> Map<'hir> {
1060
1054
Node :: Variant ( variant) => variant. span ,
1061
1055
Node :: Field ( field) => field. span ,
1062
1056
Node :: AnonConst ( constant) => self . body ( constant. body ) . value . span ,
1057
+ Node :: ConstBlock ( constant) => self . body ( constant. body ) . value . span ,
1063
1058
Node :: Expr ( expr) => expr. span ,
1064
1059
Node :: ExprField ( field) => field. span ,
1065
1060
Node :: Stmt ( stmt) => stmt. span ,
@@ -1289,6 +1284,7 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String {
1289
1284
format ! ( "{id} (field `{}` in {})" , field. ident, path_str( field. def_id) )
1290
1285
}
1291
1286
Some ( Node :: AnonConst ( _) ) => node_str ( "const" ) ,
1287
+ Some ( Node :: ConstBlock ( _) ) => node_str ( "const" ) ,
1292
1288
Some ( Node :: Expr ( _) ) => node_str ( "expr" ) ,
1293
1289
Some ( Node :: ExprField ( _) ) => node_str ( "expr field" ) ,
1294
1290
Some ( Node :: Stmt ( _) ) => node_str ( "stmt" ) ,
@@ -1434,6 +1430,11 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
1434
1430
intravisit:: walk_anon_const ( self , c)
1435
1431
}
1436
1432
1433
+ fn visit_inline_const ( & mut self , c : & ' hir ConstBlock ) {
1434
+ self . body_owners . push ( c. def_id ) ;
1435
+ intravisit:: walk_inline_const ( self , c)
1436
+ }
1437
+
1437
1438
fn visit_expr ( & mut self , ex : & ' hir Expr < ' hir > ) {
1438
1439
if let ExprKind :: Closure ( closure) = ex. kind {
1439
1440
self . body_owners . push ( closure. def_id ) ;
0 commit comments