aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/module/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/module/mod.rs')
-rw-r--r--crates/ra_hir/src/module/mod.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/crates/ra_hir/src/module/mod.rs b/crates/ra_hir/src/module/mod.rs
index fa9ee94eb..08ce7c8d1 100644
--- a/crates/ra_hir/src/module/mod.rs
+++ b/crates/ra_hir/src/module/mod.rs
@@ -14,7 +14,7 @@ use ra_db::{SourceRootId, FileId, FilePosition, Cancelable};
14use relative_path::RelativePathBuf; 14use relative_path::RelativePathBuf;
15 15
16use crate::{ 16use crate::{
17 DefLoc, DefId, Path, PathKind, HirDatabase, SourceItemId, SourceFileItemId, 17 DefKind, DefLoc, DefId, Path, PathKind, HirDatabase, SourceItemId, SourceFileItemId,
18 arena::{Arena, Id}, 18 arena::{Arena, Id},
19}; 19};
20 20
@@ -127,9 +127,11 @@ impl Module {
127 } 127 }
128 128
129 pub fn def_id(&self, db: &impl HirDatabase) -> DefId { 129 pub fn def_id(&self, db: &impl HirDatabase) -> DefId {
130 let def_loc = DefLoc::Module { 130 let def_loc = DefLoc {
131 id: self.module_id, 131 kind: DefKind::Module,
132 source_root: self.source_root_id, 132 source_root_id: self.source_root_id,
133 module_id: self.module_id,
134 source_item_id: self.module_id.source(&self.tree).0,
133 }; 135 };
134 def_loc.id(db) 136 def_loc.id(db)
135 } 137 }
@@ -161,7 +163,12 @@ impl Module {
161 let segments = path.segments; 163 let segments = path.segments;
162 for name in segments.iter() { 164 for name in segments.iter() {
163 let module = match curr.loc(db) { 165 let module = match curr.loc(db) {
164 DefLoc::Module { id, source_root } => Module::new(db, source_root, id)?, 166 DefLoc {
167 kind: DefKind::Module,
168 source_root_id,
169 module_id,
170 ..
171 } => Module::new(db, source_root_id, module_id)?,
165 _ => return Ok(None), 172 _ => return Ok(None),
166 }; 173 };
167 let scope = module.scope(db)?; 174 let scope = module.scope(db)?;