aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def')
-rw-r--r--crates/hir_def/src/body/lower.rs12
-rw-r--r--crates/hir_def/src/expr.rs8
2 files changed, 16 insertions, 4 deletions
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<'_> {
932 let inner = self.collect_pat_opt(boxpat.pat()); 932 let inner = self.collect_pat_opt(boxpat.pat());
933 Pat::Box { inner } 933 Pat::Box { inner }
934 } 934 }
935 // FIXME: implement 935 ast::Pat::ConstBlockPat(const_block_pat) => {
936 ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) | ast::Pat::ConstBlockPat(_) => { 936 if let Some(expr) = const_block_pat.block_expr() {
937 Pat::Missing 937 let expr_id = self.collect_block(expr);
938 Pat::ConstBlock(expr_id)
939 } else {
940 Pat::Missing
941 }
938 } 942 }
943 // FIXME: implement
944 ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing,
939 }; 945 };
940 let ptr = AstPtr::new(&pat); 946 let ptr = AstPtr::new(&pat);
941 self.alloc_pat(pattern, Either::Left(ptr)) 947 self.alloc_pat(pattern, Either::Left(ptr))
diff --git a/crates/hir_def/src/expr.rs b/crates/hir_def/src/expr.rs
index e5d740a36..b1e57c693 100644
--- a/crates/hir_def/src/expr.rs
+++ b/crates/hir_def/src/expr.rs
@@ -399,12 +399,18 @@ pub enum Pat {
399 TupleStruct { path: Option<Path>, args: Vec<PatId>, ellipsis: Option<usize> }, 399 TupleStruct { path: Option<Path>, args: Vec<PatId>, ellipsis: Option<usize> },
400 Ref { pat: PatId, mutability: Mutability }, 400 Ref { pat: PatId, mutability: Mutability },
401 Box { inner: PatId }, 401 Box { inner: PatId },
402 ConstBlock(ExprId),
402} 403}
403 404
404impl Pat { 405impl Pat {
405 pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) { 406 pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) {
406 match self { 407 match self {
407 Pat::Range { .. } | Pat::Lit(..) | Pat::Path(..) | Pat::Wild | Pat::Missing => {} 408 Pat::Range { .. }
409 | Pat::Lit(..)
410 | Pat::Path(..)
411 | Pat::ConstBlock(..)
412 | Pat::Wild
413 | Pat::Missing => {}
408 Pat::Bind { subpat, .. } => { 414 Pat::Bind { subpat, .. } => {
409 subpat.iter().copied().for_each(f); 415 subpat.iter().copied().for_each(f);
410 } 416 }