From 230c763648ad87e07d843a52c134b12d1b7397f4 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 6 Apr 2021 19:44:28 +0200 Subject: infer: remove `record_pat_field_resolutions` field Same as https://github.com/rust-analyzer/rust-analyzer/pull/8376, this can be computed from other data --- crates/hir_ty/src/infer.rs | 6 +----- crates/hir_ty/src/infer/pat.rs | 6 ------ 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index c63878e7a..efe9198cc 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs @@ -131,8 +131,7 @@ pub struct InferenceResult { method_resolutions: FxHashMap, /// For each field access expr, records the field it resolves to. field_resolutions: FxHashMap, - record_pat_field_resolutions: FxHashMap, - /// For each struct literal, records the variant it resolves to. + /// For each struct literal or pattern, records the variant it resolves to. variant_resolutions: FxHashMap, /// For each associated item record what it resolves to assoc_resolutions: FxHashMap, @@ -151,9 +150,6 @@ impl InferenceResult { pub fn field_resolution(&self, expr: ExprId) -> Option { self.field_resolutions.get(&expr).copied() } - pub fn record_pat_field_resolution(&self, pat: PatId) -> Option { - self.record_pat_field_resolutions.get(&pat).copied() - } pub fn variant_resolution_for_expr(&self, id: ExprId) -> Option { self.variant_resolutions.get(&id.into()).copied() } diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 942f70edf..e4813c87c 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs @@ -7,7 +7,6 @@ use chalk_ir::Mutability; use hir_def::{ expr::{BindingAnnotation, Expr, Literal, Pat, PatId, RecordFieldPat}, path::Path, - FieldId, }; use hir_expand::name::Name; @@ -80,11 +79,6 @@ impl<'a> InferenceContext<'a> { let field_tys = def.map(|it| self.db.field_types(it)).unwrap_or_default(); for subpat in subpats { let matching_field = var_data.as_ref().and_then(|it| it.field(&subpat.name)); - if let Some(local_id) = matching_field { - let field_def = FieldId { parent: def.unwrap(), local_id }; - self.result.record_pat_field_resolutions.insert(subpat.pat, field_def); - } - let expected_ty = matching_field.map_or(self.err_ty(), |field| { field_tys[field].clone().substitute(&Interner, &substs) }); -- cgit v1.2.3