diff options
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index b08880cdf..46d713a7b 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -459,9 +459,8 @@ impl<'a> InferenceContext<'a> { | |||
459 | TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => { | 459 | TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => { |
460 | let local_id = self.db.struct_data(*s).variant_data.field(name)?; | 460 | let local_id = self.db.struct_data(*s).variant_data.field(name)?; |
461 | let field = FieldId { parent: (*s).into(), local_id }; | 461 | let field = FieldId { parent: (*s).into(), local_id }; |
462 | let is_visible_in_ctx = is_visible(&field); | 462 | if is_visible(&field) { |
463 | self.write_field_resolution(tgt_expr, field); | 463 | self.write_field_resolution(tgt_expr, field); |
464 | if is_visible_in_ctx { | ||
465 | Some( | 464 | Some( |
466 | self.db.field_types((*s).into())[field.local_id] | 465 | self.db.field_types((*s).into())[field.local_id] |
467 | .clone() | 466 | .clone() |
@@ -474,9 +473,8 @@ impl<'a> InferenceContext<'a> { | |||
474 | TyKind::Adt(AdtId(hir_def::AdtId::UnionId(u)), parameters) => { | 473 | TyKind::Adt(AdtId(hir_def::AdtId::UnionId(u)), parameters) => { |
475 | let local_id = self.db.union_data(*u).variant_data.field(name)?; | 474 | let local_id = self.db.union_data(*u).variant_data.field(name)?; |
476 | let field = FieldId { parent: (*u).into(), local_id }; | 475 | let field = FieldId { parent: (*u).into(), local_id }; |
477 | let is_visible_in_ctx = is_visible(&field); | 476 | if is_visible(&field) { |
478 | self.write_field_resolution(tgt_expr, field); | 477 | self.write_field_resolution(tgt_expr, field); |
479 | if is_visible_in_ctx { | ||
480 | Some( | 478 | Some( |
481 | self.db.field_types((*u).into())[field.local_id] | 479 | self.db.field_types((*u).into())[field.local_id] |
482 | .clone() | 480 | .clone() |