From 0a780c0ab3869d92fb56ae3b2ddc7636fb169314 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 23 Dec 2020 12:15:38 +0100 Subject: Implement const pat inference --- crates/hir_def/src/body/lower.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'crates/hir_def/src/body') diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 978c3a324..4492a7d77 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -932,10 +932,16 @@ impl ExprCollector<'_> { let inner = self.collect_pat_opt(boxpat.pat()); Pat::Box { inner } } - // FIXME: implement - ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) | ast::Pat::ConstBlockPat(_) => { - Pat::Missing + ast::Pat::ConstBlockPat(const_block_pat) => { + if let Some(expr) = const_block_pat.block_expr() { + let expr_id = self.collect_block(expr); + Pat::ConstBlock(expr_id) + } else { + Pat::Missing + } } + // FIXME: implement + ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing, }; let ptr = AstPtr::new(&pat); self.alloc_pat(pattern, Either::Left(ptr)) -- cgit v1.2.3