diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-15 12:39:24 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-15 12:39:24 +0000 |
commit | a8b319cf28c0985d964ef6624c3ee6e7f09afb2d (patch) | |
tree | 2ee4aa8e66b3371f8cbf65b2c4951d5e2c227cb4 /crates/hir_ty/src/infer/expr.rs | |
parent | b4446cdd06caa32e1e9e255312a15feb770d4935 (diff) | |
parent | f7156cb0aeaba8fe32c381a2d676b35d2c86f46f (diff) |
Merge #8026
8026: Simplify source maps for fields r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 55163c963..1a11b146a 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -405,14 +405,13 @@ impl<'a> InferenceContext<'a> { | |||
405 | let substs = ty.substs().cloned().unwrap_or_else(Substs::empty); | 405 | let substs = ty.substs().cloned().unwrap_or_else(Substs::empty); |
406 | let field_types = def_id.map(|it| self.db.field_types(it)).unwrap_or_default(); | 406 | let field_types = def_id.map(|it| self.db.field_types(it)).unwrap_or_default(); |
407 | let variant_data = def_id.map(|it| variant_data(self.db.upcast(), it)); | 407 | let variant_data = def_id.map(|it| variant_data(self.db.upcast(), it)); |
408 | for (field_idx, field) in fields.iter().enumerate() { | 408 | for field in fields.iter() { |
409 | let field_def = | 409 | let field_def = |
410 | variant_data.as_ref().and_then(|it| match it.field(&field.name) { | 410 | variant_data.as_ref().and_then(|it| match it.field(&field.name) { |
411 | Some(local_id) => Some(FieldId { parent: def_id.unwrap(), local_id }), | 411 | Some(local_id) => Some(FieldId { parent: def_id.unwrap(), local_id }), |
412 | None => { | 412 | None => { |
413 | self.push_diagnostic(InferenceDiagnostic::NoSuchField { | 413 | self.push_diagnostic(InferenceDiagnostic::NoSuchField { |
414 | expr: tgt_expr, | 414 | expr: field.expr, |
415 | field: field_idx, | ||
416 | }); | 415 | }); |
417 | None | 416 | None |
418 | } | 417 | } |