diff options
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r-- | crates/ra_hir/src/query_definitions.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs index 72440d1d6..405e359f1 100644 --- a/crates/ra_hir/src/query_definitions.rs +++ b/crates/ra_hir/src/query_definitions.rs | |||
@@ -52,7 +52,12 @@ pub(super) fn struct_data(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Ar | |||
52 | let syntax = db.file_item(def_loc.source_item_id); | 52 | let syntax = db.file_item(def_loc.source_item_id); |
53 | let struct_def = | 53 | let struct_def = |
54 | ast::StructDef::cast(syntax.borrowed()).expect("struct def should point to StructDef node"); | 54 | ast::StructDef::cast(syntax.borrowed()).expect("struct def should point to StructDef node"); |
55 | Ok(Arc::new(StructData::new(struct_def.borrowed()))) | 55 | let module = def_id.module(db)?; |
56 | Ok(Arc::new(StructData::new( | ||
57 | db, | ||
58 | &module, | ||
59 | struct_def.borrowed(), | ||
60 | )?)) | ||
56 | } | 61 | } |
57 | 62 | ||
58 | pub(super) fn enum_data(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<EnumData>> { | 63 | pub(super) fn enum_data(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<EnumData>> { |
@@ -61,7 +66,8 @@ pub(super) fn enum_data(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc< | |||
61 | let syntax = db.file_item(def_loc.source_item_id); | 66 | let syntax = db.file_item(def_loc.source_item_id); |
62 | let enum_def = | 67 | let enum_def = |
63 | ast::EnumDef::cast(syntax.borrowed()).expect("enum def should point to EnumDef node"); | 68 | ast::EnumDef::cast(syntax.borrowed()).expect("enum def should point to EnumDef node"); |
64 | Ok(Arc::new(EnumData::new(enum_def.borrowed()))) | 69 | let module = def_id.module(db)?; |
70 | Ok(Arc::new(EnumData::new(db, &module, enum_def.borrowed())?)) | ||
65 | } | 71 | } |
66 | 72 | ||
67 | pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { | 73 | pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { |