@@ -1623,6 +1623,14 @@ pub struct AnonConst {
16231623 pub span : Span ,
16241624}
16251625
1626+ /// An inline constant expression `const { something }`.
1627+ #[ derive( Copy , Clone , Debug , HashStable_Generic ) ]
1628+ pub struct ConstBlock {
1629+ pub hir_id : HirId ,
1630+ pub def_id : LocalDefId ,
1631+ pub body : BodyId ,
1632+ }
1633+
16261634/// An expression.
16271635#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
16281636pub struct Expr < ' hir > {
@@ -1909,7 +1917,7 @@ pub fn is_range_literal(expr: &Expr<'_>) -> bool {
19091917#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
19101918pub enum ExprKind < ' hir > {
19111919 /// Allow anonymous constants from an inline `const` block
1912- ConstBlock ( & ' hir Expr < ' hir > ) ,
1920+ ConstBlock ( ConstBlock ) ,
19131921 /// An array (e.g., `[a, b, c, d]`).
19141922 Array ( & ' hir [ Expr < ' hir > ] ) ,
19151923 /// A function call.
@@ -3641,6 +3649,7 @@ pub enum Node<'hir> {
36413649 Variant ( & ' hir Variant < ' hir > ) ,
36423650 Field ( & ' hir FieldDef < ' hir > ) ,
36433651 AnonConst ( & ' hir AnonConst ) ,
3652+ ConstBlock ( & ' hir ConstBlock ) ,
36443653 Expr ( & ' hir Expr < ' hir > ) ,
36453654 ExprField ( & ' hir ExprField < ' hir > ) ,
36463655 Stmt ( & ' hir Stmt < ' hir > ) ,
@@ -3701,6 +3710,7 @@ impl<'hir> Node<'hir> {
37013710 Node :: PreciseCapturingNonLifetimeArg ( a) => Some ( a. ident ) ,
37023711 Node :: Param ( ..)
37033712 | Node :: AnonConst ( ..)
3713+ | Node :: ConstBlock ( ..)
37043714 | Node :: Expr ( ..)
37053715 | Node :: Stmt ( ..)
37063716 | Node :: Block ( ..)
@@ -3798,6 +3808,7 @@ impl<'hir> Node<'hir> {
37983808 }
37993809
38003810 Node :: AnonConst ( constant) => Some ( ( constant. def_id , constant. body ) ) ,
3811+ Node :: ConstBlock ( constant) => Some ( ( constant. def_id , constant. body ) ) ,
38013812
38023813 _ => None ,
38033814 }
@@ -3866,6 +3877,7 @@ impl<'hir> Node<'hir> {
38663877 expect_variant, & ' hir Variant <' hir>, Node :: Variant ( n) , n;
38673878 expect_field, & ' hir FieldDef <' hir>, Node :: Field ( n) , n;
38683879 expect_anon_const, & ' hir AnonConst , Node :: AnonConst ( n) , n;
3880+ expect_inline_const, & ' hir ConstBlock , Node :: ConstBlock ( n) , n;
38693881 expect_expr, & ' hir Expr <' hir>, Node :: Expr ( n) , n;
38703882 expect_expr_field, & ' hir ExprField <' hir>, Node :: ExprField ( n) , n;
38713883 expect_stmt, & ' hir Stmt <' hir>, Node :: Stmt ( n) , n;
0 commit comments