aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-04-06 18:44:28 +0100
committerJonas Schievink <[email protected]>2021-04-06 18:44:28 +0100
commit230c763648ad87e07d843a52c134b12d1b7397f4 (patch)
treecce18424094010e01c366703f4ed771a3e1dd479 /crates/hir
parente6a1c9ca60c19bf3b02b302e21d9f9fd9bd8a466 (diff)
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
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/source_analyzer.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index c013e78d9..ce6f3c008 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -185,12 +185,16 @@ impl SourceAnalyzer {
185 185
186 pub(crate) fn resolve_record_pat_field( 186 pub(crate) fn resolve_record_pat_field(
187 &self, 187 &self,
188 _db: &dyn HirDatabase, 188 db: &dyn HirDatabase,
189 field: &ast::RecordPatField, 189 field: &ast::RecordPatField,
190 ) -> Option<Field> { 190 ) -> Option<Field> {
191 let pat_id = self.pat_id(&field.pat()?)?; 191 let field_name = field.field_name()?.as_name();
192 let struct_field = self.infer.as_ref()?.record_pat_field_resolution(pat_id)?; 192 let record_pat = ast::RecordPat::cast(field.syntax().parent().and_then(|p| p.parent())?)?;
193 Some(struct_field.into()) 193 let pat_id = self.pat_id(&record_pat.into())?;
194 let variant = self.infer.as_ref()?.variant_resolution_for_pat(pat_id)?;
195 let variant_data = variant.variant_data(db.upcast());
196 let field = FieldId { parent: variant, local_id: variant_data.field(&field_name)? };
197 Some(field.into())
194 } 198 }
195 199
196 pub(crate) fn resolve_macro_call( 200 pub(crate) fn resolve_macro_call(