aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/body/lower.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-23 19:50:04 +0000
committerGitHub <[email protected]>2020-12-23 19:50:04 +0000
commita82c2445be5fbd9ef6ff8a60326d60ae97c122bb (patch)
tree8877d4fd3916b28a801a6fa247640138636f72d9 /crates/hir_def/src/body/lower.rs
parent01a3fd960089d562dac328221c93875cabad1d51 (diff)
parenta142beaf013a016a48eb9f193b55e0cbcb80b6a9 (diff)
Merge #7020
7020: Implement const pat and expr inference r=flodiebold a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_def/src/body/lower.rs')
-rw-r--r--crates/hir_def/src/body/lower.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs
index 978c3a324..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) => {
@@ -932,10 +936,16 @@ impl ExprCollector<'_> {
932 let inner = self.collect_pat_opt(boxpat.pat()); 936 let inner = self.collect_pat_opt(boxpat.pat());
933 Pat::Box { inner } 937 Pat::Box { inner }
934 } 938 }
935 // FIXME: implement 939 ast::Pat::ConstBlockPat(const_block_pat) => {
936 ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) | ast::Pat::ConstBlockPat(_) => { 940 if let Some(expr) = const_block_pat.block_expr() {
937 Pat::Missing 941 let expr_id = self.collect_block(expr);
942 Pat::ConstBlock(expr_id)
943 } else {
944 Pat::Missing
945 }
938 } 946 }
947 // FIXME: implement
948 ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing,
939 }; 949 };
940 let ptr = AstPtr::new(&pat); 950 let ptr = AstPtr::new(&pat);
941 self.alloc_pat(pattern, Either::Left(ptr)) 951 self.alloc_pat(pattern, Either::Left(ptr))