aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/pattern
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/diagnostics/pattern')
-rw-r--r--crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs b/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs
index d3513c406..248a379b3 100644
--- a/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs
+++ b/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs
@@ -857,8 +857,18 @@ impl Fields {
857 self.replace_with_fieldpats(args.iter().copied()) 857 self.replace_with_fieldpats(args.iter().copied())
858 } 858 }
859 Pat::Record { args, ellipsis, .. } => { 859 Pat::Record { args, ellipsis, .. } => {
860 // FIXME(iDawer) handle ellipsis. 860 let variant_id =
861 self.replace_with_fieldpats(args.iter().map(|field_pat| field_pat.pat)) 861 cx.infer.variant_resolution_for_pat(pat).unwrap_or_else(|| todo!());
862 let variant_data = variant_id.variant_data(cx.db.upcast());
863
864 let new_pats = args.iter().map(|field_pat| {
865 // TODO: field lookup is inefficient
866 let raw =
867 variant_data.field(&field_pat.name).unwrap_or_else(|| todo!()).into_raw();
868 let idx = u32::from(raw) as usize;
869 (idx, field_pat.pat)
870 });
871 self.replace_fields_indexed(new_pats)
862 } 872 }
863 Pat::Slice { .. } => { 873 Pat::Slice { .. } => {
864 todo!() 874 todo!()