diff options
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/infer/pat.rs | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index 1fdb235a0..83f946eee 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs | |||
@@ -8,7 +8,7 @@ use hir_def::{ | |||
8 | expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, | 8 | expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, |
9 | path::{GenericArg, GenericArgs}, | 9 | path::{GenericArg, GenericArgs}, |
10 | resolver::resolver_for_expr, | 10 | resolver::resolver_for_expr, |
11 | AdtId, AssocContainerId, Lookup, StructFieldId, | 11 | AdtId, AssocContainerId, FieldId, Lookup, |
12 | }; | 12 | }; |
13 | use hir_expand::name::Name; | 13 | use hir_expand::name::Name; |
14 | use ra_syntax::ast::RangeOp; | 14 | use ra_syntax::ast::RangeOp; |
@@ -216,9 +216,7 @@ impl<'a> InferenceContext<'a> { | |||
216 | for (field_idx, field) in fields.iter().enumerate() { | 216 | for (field_idx, field) in fields.iter().enumerate() { |
217 | let field_def = | 217 | let field_def = |
218 | variant_data.as_ref().and_then(|it| match it.field(&field.name) { | 218 | variant_data.as_ref().and_then(|it| match it.field(&field.name) { |
219 | Some(local_id) => { | 219 | Some(local_id) => Some(FieldId { parent: def_id.unwrap(), local_id }), |
220 | Some(StructFieldId { parent: def_id.unwrap(), local_id }) | ||
221 | } | ||
222 | None => { | 220 | None => { |
223 | self.push_diagnostic(InferenceDiagnostic::NoSuchField { | 221 | self.push_diagnostic(InferenceDiagnostic::NoSuchField { |
224 | expr: tgt_expr, | 222 | expr: tgt_expr, |
@@ -257,7 +255,7 @@ impl<'a> InferenceContext<'a> { | |||
257 | .and_then(|idx| a_ty.parameters.0.get(idx).cloned()), | 255 | .and_then(|idx| a_ty.parameters.0.get(idx).cloned()), |
258 | TypeCtor::Adt(AdtId::StructId(s)) => { | 256 | TypeCtor::Adt(AdtId::StructId(s)) => { |
259 | self.db.struct_data(s).variant_data.field(name).map(|local_id| { | 257 | self.db.struct_data(s).variant_data.field(name).map(|local_id| { |
260 | let field = StructFieldId { parent: s.into(), local_id }; | 258 | let field = FieldId { parent: s.into(), local_id }; |
261 | self.write_field_resolution(tgt_expr, field); | 259 | self.write_field_resolution(tgt_expr, field); |
262 | self.db.field_types(s.into())[field.local_id] | 260 | self.db.field_types(s.into())[field.local_id] |
263 | .clone() | 261 | .clone() |
diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/ra_hir_ty/src/infer/pat.rs index 7c2ad4384..54ec870df 100644 --- a/crates/ra_hir_ty/src/infer/pat.rs +++ b/crates/ra_hir_ty/src/infer/pat.rs | |||
@@ -7,7 +7,7 @@ use hir_def::{ | |||
7 | expr::{BindingAnnotation, Pat, PatId, RecordFieldPat}, | 7 | expr::{BindingAnnotation, Pat, PatId, RecordFieldPat}, |
8 | path::Path, | 8 | path::Path, |
9 | type_ref::Mutability, | 9 | type_ref::Mutability, |
10 | StructFieldId, | 10 | FieldId, |
11 | }; | 11 | }; |
12 | use hir_expand::name::Name; | 12 | use hir_expand::name::Name; |
13 | use test_utils::tested_by; | 13 | use test_utils::tested_by; |
@@ -69,7 +69,7 @@ impl<'a> InferenceContext<'a> { | |||
69 | for subpat in subpats { | 69 | for subpat in subpats { |
70 | let matching_field = var_data.as_ref().and_then(|it| it.field(&subpat.name)); | 70 | let matching_field = var_data.as_ref().and_then(|it| it.field(&subpat.name)); |
71 | if let Some(local_id) = matching_field { | 71 | if let Some(local_id) = matching_field { |
72 | let field_def = StructFieldId { parent: def.unwrap(), local_id }; | 72 | let field_def = FieldId { parent: def.unwrap(), local_id }; |
73 | self.result.record_field_pat_resolutions.insert(subpat.pat, field_def); | 73 | self.result.record_field_pat_resolutions.insert(subpat.pat, field_def); |
74 | } | 74 | } |
75 | 75 | ||