From b4f41973326a684844ffe23c5816e17d485b4203 Mon Sep 17 00:00:00 2001 From: Dawer <7803845+iDawer@users.noreply.github.com> Date: Fri, 30 Apr 2021 13:33:07 +0500 Subject: Build wildcard witnesses instead of panicking --- crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crates') diff --git a/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs b/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs index 7bd02a502..60323aea3 100644 --- a/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs +++ b/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs @@ -496,6 +496,8 @@ impl Fields { pub(super) fn apply(self, pcx: PatCtxt<'_>, ctor: &Constructor) -> Pat { let subpatterns_and_indices = self.patterns_and_indices(); let mut subpatterns = subpatterns_and_indices.iter().map(|&(_, p)| p); + // TODO witnesses are not yet used + const TODO: Pat = Pat::Wild; match ctor { Single | Variant(_) => match pcx.ty.kind(&Interner) { @@ -509,7 +511,7 @@ impl Fields { let path = find_path(pcx.cx.db.upcast(), item, pcx.cx.module) .map(|mpath| Path::from_known_path(mpath, Vec::new()).into()); match adt { - hir_def::AdtId::EnumId(_) => todo!(), + hir_def::AdtId::EnumId(id) => TODO, hir_def::AdtId::StructId(id) => { let variant_data = &pcx.cx.db.struct_data(id).variant_data; let args = subpatterns_and_indices @@ -522,7 +524,7 @@ impl Fields { .collect(); Pat::Record { path, args, ellipsis: false } } - hir_def::AdtId::UnionId(_) => todo!(), + hir_def::AdtId::UnionId(_) => Pat::Wild, } } else { Pat::Tuple { args: subpatterns, ellipsis: None } @@ -540,12 +542,10 @@ impl Fields { } _ => Pat::Wild, }, - Constructor::Slice(slice) => { - todo!() - } - Str(_) => todo!(), - FloatRange(..) => todo!(), - Constructor::IntRange(_) => todo!(), + Constructor::Slice(slice) => TODO, + Str(_) => TODO, + FloatRange(..) => TODO, + Constructor::IntRange(_) => TODO, NonExhaustive => Pat::Wild, Wildcard => Pat::Wild, Opaque => panic!("bug: we should not try to apply an opaque constructor"), -- cgit v1.2.3