aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/adt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/adt.rs')
-rw-r--r--crates/ra_hir_def/src/adt.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index db3e63ef8..ef2b20f1e 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -11,8 +11,9 @@ use ra_arena::{map::ArenaMap, Arena};
11use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; 11use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
12 12
13use crate::{ 13use crate::{
14 db::DefDatabase, src::HasChildSource, trace::Trace, type_ref::TypeRef, AstItemDef, EnumId, 14 db::DefDatabase, src::HasChildSource, src::HasSource, trace::Trace, type_ref::TypeRef,
15 LocalEnumVariantId, LocalStructFieldId, StructId, UnionId, VariantId, 15 AstItemDef, EnumId, LocalEnumVariantId, LocalStructFieldId, Lookup, StructId, UnionId,
16 VariantId,
16}; 17};
17 18
18/// Note that we use `StructData` for unions as well! 19/// Note that we use `StructData` for unions as well!
@@ -50,7 +51,7 @@ pub struct StructFieldData {
50 51
51impl StructData { 52impl StructData {
52 pub(crate) fn struct_data_query(db: &impl DefDatabase, id: StructId) -> Arc<StructData> { 53 pub(crate) fn struct_data_query(db: &impl DefDatabase, id: StructId) -> Arc<StructData> {
53 let src = id.source(db); 54 let src = id.lookup(db).source(db);
54 let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); 55 let name = src.value.name().map_or_else(Name::missing, |n| n.as_name());
55 let variant_data = VariantData::new(src.value.kind()); 56 let variant_data = VariantData::new(src.value.kind());
56 let variant_data = Arc::new(variant_data); 57 let variant_data = Arc::new(variant_data);
@@ -153,7 +154,7 @@ impl HasChildSource for VariantId {
153 let src = it.parent.child_source(db); 154 let src = it.parent.child_source(db);
154 src.map(|map| map[it.local_id].kind()) 155 src.map(|map| map[it.local_id].kind())
155 } 156 }
156 VariantId::StructId(it) => it.source(db).map(|it| it.kind()), 157 VariantId::StructId(it) => it.lookup(db).source(db).map(|it| it.kind()),
157 VariantId::UnionId(it) => it.source(db).map(|it| { 158 VariantId::UnionId(it) => it.source(db).map(|it| {
158 it.record_field_def_list() 159 it.record_field_def_list()
159 .map(ast::StructKind::Record) 160 .map(ast::StructKind::Record)