Skip to content

Commit 66e2543

Browse files
committed
Lower inline const's AST to HIR
1 parent 59d07c3 commit 66e2543

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
3030
let kind = match e.kind {
3131
ExprKind::Box(ref inner) => hir::ExprKind::Box(self.lower_expr(inner)),
3232
ExprKind::Array(ref exprs) => hir::ExprKind::Array(self.lower_exprs(exprs)),
33-
ExprKind::ConstBlock(_) => {
34-
unimplemented!();
33+
ExprKind::ConstBlock(ref anon_const) => {
34+
let anon_const = self.lower_anon_const(anon_const);
35+
hir::ExprKind::ConstBlock(anon_const)
3536
}
3637
ExprKind::Repeat(ref expr, ref count) => {
3738
let expr = self.lower_expr(expr);

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl<'a> AstValidator<'a> {
287287
// ```
288288
fn check_expr_within_pat(&self, expr: &Expr, allow_paths: bool) {
289289
match expr.kind {
290-
ExprKind::Lit(..) | ExprKind::Err => {}
290+
ExprKind::Lit(..) | ExprKind::ConstBlock(..) | ExprKind::Err => {}
291291
ExprKind::Path(..) if allow_paths => {}
292292
ExprKind::Unary(UnOp::Neg, ref inner) if matches!(inner.kind, ExprKind::Lit(_)) => {}
293293
_ => self.err_handler().span_err(

0 commit comments

Comments
 (0)