mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
hir_ty: don't call write_field_resolution when field candidate isn't visible
This commit is contained in:
parent
96c88680b2
commit
7155f815b9
1 changed files with 4 additions and 6 deletions
|
@ -459,9 +459,8 @@ impl<'a> InferenceContext<'a> {
|
||||||
TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => {
|
TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => {
|
||||||
let local_id = self.db.struct_data(*s).variant_data.field(name)?;
|
let local_id = self.db.struct_data(*s).variant_data.field(name)?;
|
||||||
let field = FieldId { parent: (*s).into(), local_id };
|
let field = FieldId { parent: (*s).into(), local_id };
|
||||||
let is_visible_in_ctx = is_visible(&field);
|
if is_visible(&field) {
|
||||||
self.write_field_resolution(tgt_expr, field);
|
self.write_field_resolution(tgt_expr, field);
|
||||||
if is_visible_in_ctx {
|
|
||||||
Some(
|
Some(
|
||||||
self.db.field_types((*s).into())[field.local_id]
|
self.db.field_types((*s).into())[field.local_id]
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -474,9 +473,8 @@ impl<'a> InferenceContext<'a> {
|
||||||
TyKind::Adt(AdtId(hir_def::AdtId::UnionId(u)), parameters) => {
|
TyKind::Adt(AdtId(hir_def::AdtId::UnionId(u)), parameters) => {
|
||||||
let local_id = self.db.union_data(*u).variant_data.field(name)?;
|
let local_id = self.db.union_data(*u).variant_data.field(name)?;
|
||||||
let field = FieldId { parent: (*u).into(), local_id };
|
let field = FieldId { parent: (*u).into(), local_id };
|
||||||
let is_visible_in_ctx = is_visible(&field);
|
if is_visible(&field) {
|
||||||
self.write_field_resolution(tgt_expr, field);
|
self.write_field_resolution(tgt_expr, field);
|
||||||
if is_visible_in_ctx {
|
|
||||||
Some(
|
Some(
|
||||||
self.db.field_types((*u).into())[field.local_id]
|
self.db.field_types((*u).into())[field.local_id]
|
||||||
.clone()
|
.clone()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue