aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 51c65a5d7..e69f89b80 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -34,7 +34,7 @@ pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> C
34 let crate_graph = db.crate_graph(); 34 let crate_graph = db.crate_graph();
35 35
36 // populate external prelude 36 // populate external prelude
37 for dep in crate_graph.dependencies(def_map.krate) { 37 for dep in &crate_graph.crate_data(&def_map.krate).dependencies {
38 let dep_def_map = db.crate_def_map(dep.crate_id); 38 let dep_def_map = db.crate_def_map(dep.crate_id);
39 log::debug!("crate dep {:?} -> {:?}", dep.name, dep.crate_id); 39 log::debug!("crate dep {:?} -> {:?}", dep.name, dep.crate_id);
40 def_map.extern_prelude.insert( 40 def_map.extern_prelude.insert(
@@ -128,8 +128,7 @@ where
128 DB: DefDatabase, 128 DB: DefDatabase,
129{ 129{
130 fn collect(&mut self) { 130 fn collect(&mut self) {
131 let crate_graph = self.db.crate_graph(); 131 let file_id = self.db.crate_graph().crate_data(&self.def_map.krate).root_file_id;
132 let file_id = crate_graph.crate_root(self.def_map.krate);
133 let raw_items = self.db.raw_items(file_id.into()); 132 let raw_items = self.db.raw_items(file_id.into());
134 let module_id = self.def_map.root; 133 let module_id = self.def_map.root;
135 self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id }; 134 self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id };
@@ -955,7 +954,7 @@ mod tests {
955 let krate = db.test_crate(); 954 let krate = db.test_crate();
956 955
957 let def_map = { 956 let def_map = {
958 let edition = db.crate_graph().edition(krate); 957 let edition = db.crate_graph().crate_data(&krate).edition;
959 let mut modules: Arena<LocalModuleId, ModuleData> = Arena::default(); 958 let mut modules: Arena<LocalModuleId, ModuleData> = Arena::default();
960 let root = modules.alloc(ModuleData::default()); 959 let root = modules.alloc(ModuleData::default());
961 CrateDefMap { 960 CrateDefMap {