aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/body
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/body')
-rw-r--r--crates/ra_hir_def/src/body/lower.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 687216dc3..49f5420d1 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -18,7 +18,7 @@ use ra_syntax::{
18use test_utils::tested_by; 18use test_utils::tested_by;
19 19
20use crate::{ 20use crate::{
21 adt::StructKind, 21 adt::{self, StructKind},
22 body::{Body, BodySourceMap, Expander, PatPtr, SyntheticSyntax}, 22 body::{Body, BodySourceMap, Expander, PatPtr, SyntheticSyntax},
23 builtin_type::{BuiltinFloat, BuiltinInt}, 23 builtin_type::{BuiltinFloat, BuiltinInt},
24 db::DefDatabase, 24 db::DefDatabase,
@@ -575,9 +575,16 @@ impl ExprCollector<'_> {
575 self.body.item_scope.define_def(def); 575 self.body.item_scope.define_def(def);
576 if let Some(name) = name { 576 if let Some(name) = name {
577 let vis = crate::visibility::Visibility::Public; // FIXME determine correctly 577 let vis = crate::visibility::Visibility::Public; // FIXME determine correctly
578 self.body 578 let favor_types = match def {
579 .item_scope 579 ModuleDefId::AdtId(AdtId::StructId(s)) => {
580 .push_res(name.as_name(), crate::per_ns::PerNs::from_def(def, vis)); 580 self.db.struct_data(s).variant_data.kind() == adt::StructKind::Record
581 }
582 _ => false,
583 };
584 self.body.item_scope.push_res(
585 name.as_name(),
586 crate::per_ns::PerNs::from_def(def, vis, favor_types),
587 );
581 } 588 }
582 } 589 }
583 } 590 }