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