aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/infer/expr.rs')
-rw-r--r--crates/ra_hir/src/ty/infer/expr.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs
index 316cdc880..3d0895dc6 100644
--- a/crates/ra_hir/src/ty/infer/expr.rs
+++ b/crates/ra_hir/src/ty/infer/expr.rs
@@ -8,7 +8,7 @@ use hir_def::{
8 generics::GenericParams, 8 generics::GenericParams,
9 path::{GenericArg, GenericArgs}, 9 path::{GenericArg, GenericArgs},
10 resolver::resolver_for_expr, 10 resolver::resolver_for_expr,
11 ContainerId, Lookup, 11 AdtId, ContainerId, Lookup, StructFieldId,
12}; 12};
13use hir_expand::name; 13use hir_expand::name;
14 14
@@ -20,7 +20,7 @@ use crate::{
20 Mutability, Namespace, Obligation, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, 20 Mutability, Namespace, Obligation, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty,
21 TypeCtor, TypeWalk, Uncertain, 21 TypeCtor, TypeWalk, Uncertain,
22 }, 22 },
23 Adt, Name, 23 Name,
24}; 24};
25 25
26use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; 26use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch};
@@ -259,14 +259,17 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
259 TypeCtor::Tuple { .. } => name 259 TypeCtor::Tuple { .. } => name
260 .as_tuple_index() 260 .as_tuple_index()
261 .and_then(|idx| a_ty.parameters.0.get(idx).cloned()), 261 .and_then(|idx| a_ty.parameters.0.get(idx).cloned()),
262 TypeCtor::Adt(Adt::Struct(s)) => s.field(self.db, name).map(|field| { 262 TypeCtor::Adt(AdtId::StructId(s)) => {
263 self.write_field_resolution(tgt_expr, field); 263 self.db.struct_data(s).variant_data.field(name).map(|local_id| {
264 self.db.field_types(s.id.into())[field.id] 264 let field = StructFieldId { parent: s.into(), local_id }.into();
265 .clone() 265 self.write_field_resolution(tgt_expr, field);
266 .subst(&a_ty.parameters) 266 self.db.field_types(s.into())[field.id]
267 }), 267 .clone()
268 .subst(&a_ty.parameters)
269 })
270 }
268 // FIXME: 271 // FIXME:
269 TypeCtor::Adt(Adt::Union(_)) => None, 272 TypeCtor::Adt(AdtId::UnionId(_)) => None,
270 _ => None, 273 _ => None,
271 }, 274 },
272 _ => None, 275 _ => None,