aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres.rs')
-rw-r--r--crates/ra_hir/src/nameres.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index edd2f25f7..d361cf9e6 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -62,7 +62,7 @@ use test_utils::tested_by;
62 62
63use crate::{ 63use crate::{
64 ModuleDef, Name, Crate, Module, Problem, 64 ModuleDef, Name, Crate, Module, Problem,
65 PersistentHirDatabase, Path, PathKind, HirFileId, 65 DefDatabase, Path, PathKind, HirFileId,
66 ids::{SourceItemId, SourceFileItemId, MacroCallId}, 66 ids::{SourceItemId, SourceFileItemId, MacroCallId},
67}; 67};
68 68
@@ -196,10 +196,7 @@ enum ReachedFixedPoint {
196} 196}
197 197
198impl CrateDefMap { 198impl CrateDefMap {
199 pub(crate) fn crate_def_map_query( 199 pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: Crate) -> Arc<CrateDefMap> {
200 db: &impl PersistentHirDatabase,
201 krate: Crate,
202 ) -> Arc<CrateDefMap> {
203 let start = std::time::Instant::now(); 200 let start = std::time::Instant::now();
204 let def_map = { 201 let def_map = {
205 let edition = krate.edition(db); 202 let edition = krate.edition(db);
@@ -268,7 +265,7 @@ impl CrateDefMap {
268 265
269 pub(crate) fn resolve_path( 266 pub(crate) fn resolve_path(
270 &self, 267 &self,
271 db: &impl PersistentHirDatabase, 268 db: &impl DefDatabase,
272 original_module: CrateModuleId, 269 original_module: CrateModuleId,
273 path: &Path, 270 path: &Path,
274 ) -> (PerNs<ModuleDef>, Option<usize>) { 271 ) -> (PerNs<ModuleDef>, Option<usize>) {
@@ -280,7 +277,7 @@ impl CrateDefMap {
280 // the result. 277 // the result.
281 fn resolve_path_fp( 278 fn resolve_path_fp(
282 &self, 279 &self,
283 db: &impl PersistentHirDatabase, 280 db: &impl DefDatabase,
284 mode: ResolveMode, 281 mode: ResolveMode,
285 original_module: CrateModuleId, 282 original_module: CrateModuleId,
286 path: &Path, 283 path: &Path,
@@ -296,7 +293,7 @@ impl CrateDefMap {
296 // plain import or absolute path in 2015: crate-relative with 293 // plain import or absolute path in 2015: crate-relative with
297 // fallback to extern prelude (with the simplification in 294 // fallback to extern prelude (with the simplification in
298 // rust-lang/rust#57745) 295 // rust-lang/rust#57745)
299 // TODO there must be a nicer way to write this condition 296 // FIXME there must be a nicer way to write this condition
300 PathKind::Plain | PathKind::Abs 297 PathKind::Plain | PathKind::Abs
301 if self.edition == Edition::Edition2015 298 if self.edition == Edition::Edition2015
302 && (path.kind == PathKind::Abs || mode == ResolveMode::Import) => 299 && (path.kind == PathKind::Abs || mode == ResolveMode::Import) =>
@@ -422,7 +419,7 @@ impl CrateDefMap {
422 419
423 pub(crate) fn resolve_name_in_module( 420 pub(crate) fn resolve_name_in_module(
424 &self, 421 &self,
425 db: &impl PersistentHirDatabase, 422 db: &impl DefDatabase,
426 module: CrateModuleId, 423 module: CrateModuleId,
427 name: &Name, 424 name: &Name,
428 ) -> PerNs<ModuleDef> { 425 ) -> PerNs<ModuleDef> {
@@ -442,7 +439,7 @@ impl CrateDefMap {
442 self.extern_prelude.get(name).map_or(PerNs::none(), |&it| PerNs::types(it)) 439 self.extern_prelude.get(name).map_or(PerNs::none(), |&it| PerNs::types(it))
443 } 440 }
444 441
445 fn resolve_in_prelude(&self, db: &impl PersistentHirDatabase, name: &Name) -> PerNs<ModuleDef> { 442 fn resolve_in_prelude(&self, db: &impl DefDatabase, name: &Name) -> PerNs<ModuleDef> {
446 if let Some(prelude) = self.prelude { 443 if let Some(prelude) = self.prelude {
447 let resolution = if prelude.krate == self.krate { 444 let resolution = if prelude.krate == self.krate {
448 self[prelude.module_id].scope.items.get(name).cloned() 445 self[prelude.module_id].scope.items.get(name).cloned()