From 8c378af72117e92bc894fd4a79e978ef0d1c0cc7 Mon Sep 17 00:00:00 2001 From: Josh Mcguigan Date: Tue, 24 Mar 2020 04:40:58 -0700 Subject: missing match arms diagnostic --- crates/ra_hir_ty/src/infer/pat.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_ty/src/infer/pat.rs') diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/ra_hir_ty/src/infer/pat.rs index 86acd27f8..69bbb4307 100644 --- a/crates/ra_hir_ty/src/infer/pat.rs +++ b/crates/ra_hir_ty/src/infer/pat.rs @@ -21,9 +21,13 @@ impl<'a> InferenceContext<'a> { subpats: &[PatId], expected: &Ty, default_bm: BindingMode, + id: PatId, ) -> Ty { let (ty, def) = self.resolve_variant(path); let var_data = def.map(|it| variant_data(self.db.upcast(), it)); + if let Some(variant) = def { + self.write_variant_resolution(id.into(), variant); + } self.unify(&ty, expected); let substs = ty.substs().unwrap_or_else(Substs::empty); @@ -152,7 +156,7 @@ impl<'a> InferenceContext<'a> { Ty::apply_one(TypeCtor::Ref(*mutability), subty) } Pat::TupleStruct { path: p, args: subpats } => { - self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm) + self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm, pat) } Pat::Record { path: p, args: fields } => { self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat) -- cgit v1.2.3