aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/find_path.rs2
-rw-r--r--crates/ra_hir_def/src/lang_item.rs4
-rw-r--r--crates/ra_hir_def/src/nameres.rs3
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs7
4 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/find_path.rs b/crates/ra_hir_def/src/find_path.rs
index 43b9b124a..217e19b01 100644
--- a/crates/ra_hir_def/src/find_path.rs
+++ b/crates/ra_hir_def/src/find_path.rs
@@ -176,7 +176,7 @@ fn find_importable_locations(
176 // directly (only through reexports in direct dependencies). 176 // directly (only through reexports in direct dependencies).
177 for krate in Some(from.krate) 177 for krate in Some(from.krate)
178 .into_iter() 178 .into_iter()
179 .chain(crate_graph.dependencies(from.krate).map(|dep| dep.crate_id)) 179 .chain(crate_graph.crate_data(&from.krate).dependencies.iter().map(|dep| dep.crate_id))
180 { 180 {
181 result.extend( 181 result.extend(
182 importable_locations_in_crate(db, item, krate) 182 importable_locations_in_crate(db, item, krate)
diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs
index 5a336ea1f..79e8d8038 100644
--- a/crates/ra_hir_def/src/lang_item.rs
+++ b/crates/ra_hir_def/src/lang_item.rs
@@ -117,7 +117,9 @@ impl LangItems {
117 return Some(*target); 117 return Some(*target);
118 } 118 }
119 db.crate_graph() 119 db.crate_graph()
120 .dependencies(start_crate) 120 .crate_data(&start_crate)
121 .dependencies
122 .iter()
121 .find_map(|dep| db.lang_item(dep.crate_id, item.clone())) 123 .find_map(|dep| db.lang_item(dep.crate_id, item.clone()))
122 } 124 }
123 125
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index 628c44c99..6af0f4a8e 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -179,8 +179,7 @@ impl CrateDefMap {
179 pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { 179 pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> {
180 let _p = profile("crate_def_map_query"); 180 let _p = profile("crate_def_map_query");
181 let def_map = { 181 let def_map = {
182 let crate_graph = db.crate_graph(); 182 let edition = db.crate_graph().crate_data(&krate).edition;
183 let edition = crate_graph.edition(krate);
184 let mut modules: Arena<LocalModuleId, ModuleData> = Arena::default(); 183 let mut modules: Arena<LocalModuleId, ModuleData> = Arena::default();
185 let root = modules.alloc(ModuleData::default()); 184 let root = modules.alloc(ModuleData::default());
186 CrateDefMap { 185 CrateDefMap {
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 {