diff options
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 79abe55ce..0679ffa1e 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -650,6 +650,7 @@ impl ExprCollector<'_> { | |||
650 | ast::Pat::SlicePat(p) => { | 650 | ast::Pat::SlicePat(p) => { |
651 | let SlicePatComponents { prefix, slice, suffix } = p.components(); | 651 | let SlicePatComponents { prefix, slice, suffix } = p.components(); |
652 | 652 | ||
653 | // FIXME properly handle `DotDotPat` | ||
653 | Pat::Slice { | 654 | Pat::Slice { |
654 | prefix: prefix.into_iter().map(|p| self.collect_pat(p)).collect(), | 655 | prefix: prefix.into_iter().map(|p| self.collect_pat(p)).collect(), |
655 | slice: slice.map(|p| self.collect_pat(p)), | 656 | slice: slice.map(|p| self.collect_pat(p)), |
@@ -666,9 +667,15 @@ impl ExprCollector<'_> { | |||
666 | Pat::Missing | 667 | Pat::Missing |
667 | } | 668 | } |
668 | } | 669 | } |
669 | ast::Pat::DotDotPat(_) => unreachable!( | 670 | ast::Pat::DotDotPat(_) => { |
670 | "`DotDotPat` requires special handling and should not be mapped to a Pat." | 671 | // `DotDotPat` requires special handling and should not be mapped |
671 | ), | 672 | // to a Pat. Here we are using `Pat::Missing` as a fallback for |
673 | // when `DotDotPat` is mapped to `Pat`, which can easily happen | ||
674 | // when the source code being analyzed has a malformed pattern | ||
675 | // which includes `..` in a place where it isn't valid. | ||
676 | |||
677 | Pat::Missing | ||
678 | } | ||
672 | // FIXME: implement | 679 | // FIXME: implement |
673 | ast::Pat::BoxPat(_) | ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing, | 680 | ast::Pat::BoxPat(_) | ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing, |
674 | }; | 681 | }; |