diff options
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r-- | crates/hir_def/src/body/lower.rs | 6 | ||||
-rw-r--r-- | crates/hir_def/src/expr.rs | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index c5ebc2aa0..2d91bb21f 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs | |||
@@ -838,8 +838,12 @@ impl ExprCollector<'_> { | |||
838 | 838 | ||
839 | Pat::Missing | 839 | Pat::Missing |
840 | } | 840 | } |
841 | ast::Pat::BoxPat(boxpat) => { | ||
842 | let inner = self.collect_pat_opt(boxpat.pat()); | ||
843 | Pat::Box { inner } | ||
844 | } | ||
841 | // FIXME: implement | 845 | // FIXME: implement |
842 | ast::Pat::BoxPat(_) | ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing, | 846 | ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing, |
843 | }; | 847 | }; |
844 | let ptr = AstPtr::new(&pat); | 848 | let ptr = AstPtr::new(&pat); |
845 | self.alloc_pat(pattern, Either::Left(ptr)) | 849 | self.alloc_pat(pattern, Either::Left(ptr)) |
diff --git a/crates/hir_def/src/expr.rs b/crates/hir_def/src/expr.rs index e862c2080..e5d740a36 100644 --- a/crates/hir_def/src/expr.rs +++ b/crates/hir_def/src/expr.rs | |||
@@ -398,6 +398,7 @@ pub enum Pat { | |||
398 | Bind { mode: BindingAnnotation, name: Name, subpat: Option<PatId> }, | 398 | Bind { mode: BindingAnnotation, name: Name, subpat: Option<PatId> }, |
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 | } | 402 | } |
402 | 403 | ||
403 | impl Pat { | 404 | impl Pat { |
@@ -418,6 +419,7 @@ impl Pat { | |||
418 | Pat::Record { args, .. } => { | 419 | Pat::Record { args, .. } => { |
419 | args.iter().map(|f| f.pat).for_each(f); | 420 | args.iter().map(|f| f.pat).for_each(f); |
420 | } | 421 | } |
422 | Pat::Box { inner } => f(*inner), | ||
421 | } | 423 | } |
422 | } | 424 | } |
423 | } | 425 | } |