diff options
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/body/lower.rs | 4 | ||||
-rw-r--r-- | crates/hir_def/src/expr.rs | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 4492a7d77..1b98504bb 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs | |||
@@ -246,6 +246,10 @@ impl ExprCollector<'_> { | |||
246 | let body = self.collect_block_opt(e.block_expr()); | 246 | let body = self.collect_block_opt(e.block_expr()); |
247 | self.alloc_expr(Expr::Async { body }, syntax_ptr) | 247 | self.alloc_expr(Expr::Async { body }, syntax_ptr) |
248 | } | 248 | } |
249 | ast::Effect::Const(_) => { | ||
250 | let body = self.collect_block_opt(e.block_expr()); | ||
251 | self.alloc_expr(Expr::Const { body }, syntax_ptr) | ||
252 | } | ||
249 | }, | 253 | }, |
250 | ast::Expr::BlockExpr(e) => self.collect_block(e), | 254 | ast::Expr::BlockExpr(e) => self.collect_block(e), |
251 | ast::Expr::LoopExpr(e) => { | 255 | ast::Expr::LoopExpr(e) => { |
diff --git a/crates/hir_def/src/expr.rs b/crates/hir_def/src/expr.rs index b1e57c693..3bba30397 100644 --- a/crates/hir_def/src/expr.rs +++ b/crates/hir_def/src/expr.rs | |||
@@ -114,6 +114,9 @@ pub enum Expr { | |||
114 | Async { | 114 | Async { |
115 | body: ExprId, | 115 | body: ExprId, |
116 | }, | 116 | }, |
117 | Const { | ||
118 | body: ExprId, | ||
119 | }, | ||
117 | Cast { | 120 | Cast { |
118 | expr: ExprId, | 121 | expr: ExprId, |
119 | type_ref: TypeRef, | 122 | type_ref: TypeRef, |
@@ -253,7 +256,10 @@ impl Expr { | |||
253 | f(*expr); | 256 | f(*expr); |
254 | } | 257 | } |
255 | } | 258 | } |
256 | Expr::TryBlock { body } | Expr::Unsafe { body } | Expr::Async { body } => f(*body), | 259 | Expr::TryBlock { body } |
260 | | Expr::Unsafe { body } | ||
261 | | Expr::Async { body } | ||
262 | | Expr::Const { body } => f(*body), | ||
257 | Expr::Loop { body, .. } => f(*body), | 263 | Expr::Loop { body, .. } => f(*body), |
258 | Expr::While { condition, body, .. } => { | 264 | Expr::While { condition, body, .. } => { |
259 | f(*condition); | 265 | f(*condition); |