Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/find_path.rs')
-rw-r--r--crates/hir-def/src/find_path.rs66
1 files changed, 33 insertions, 33 deletions
diff --git a/crates/hir-def/src/find_path.rs b/crates/hir-def/src/find_path.rs
index cc0594f00d..5d1cac8e93 100644
--- a/crates/hir-def/src/find_path.rs
+++ b/crates/hir-def/src/find_path.rs
@@ -12,7 +12,7 @@ use intern::sym;
use rustc_hash::FxHashSet;
use crate::{
- FindPathConfig, ModuleDefId, ModuleIdLt,
+ FindPathConfig, ModuleDefId, ModuleId,
db::DefDatabase,
item_scope::ItemInNs,
nameres::DefMap,
@@ -24,7 +24,7 @@ use crate::{
pub fn find_path(
db: &dyn DefDatabase,
item: ItemInNs,
- from: ModuleIdLt<'_>,
+ from: ModuleId,
mut prefix_kind: PrefixKind,
ignore_local_imports: bool,
mut cfg: FindPathConfig,
@@ -102,14 +102,14 @@ struct FindPathCtx<'db> {
cfg: FindPathConfig,
ignore_local_imports: bool,
is_std_item: bool,
- from: ModuleIdLt<'db>,
+ from: ModuleId,
from_crate: Crate,
- crate_root: ModuleIdLt<'db>,
+ crate_root: ModuleId,
from_def_map: &'db DefMap,
fuel: Cell<usize>,
}
-/// Attempts to find a path to refer to the given `item` visible from the `from` ModuleIdLt<'_>
+/// Attempts to find a path to refer to the given `item` visible from the `from` ModuleId
fn find_path_inner(ctx: &FindPathCtx<'_>, item: ItemInNs, max_len: usize) -> Option<ModPath> {
// - if the item is a module, jump straight to module search
if !ctx.is_std_item
@@ -157,10 +157,10 @@ fn find_path_inner(ctx: &FindPathCtx<'_>, item: ItemInNs, max_len: usize) -> Opt
}
#[tracing::instrument(skip_all)]
-fn find_path_for_module<'db>(
- ctx: &'db FindPathCtx<'db>,
- visited_modules: &mut FxHashSet<(ItemInNs, ModuleIdLt<'db>)>,
- module_id: ModuleIdLt<'db>,
+fn find_path_for_module(
+ ctx: &FindPathCtx<'_>,
+ visited_modules: &mut FxHashSet<(ItemInNs, ModuleId)>,
+ module_id: ModuleId,
maybe_extern: bool,
max_len: usize,
) -> Option<Choice> {
@@ -217,7 +217,7 @@ fn find_path_for_module<'db>(
ctx.db,
ctx.from_def_map,
ctx.from,
- ItemInNs::Types(unsafe { module_id.to_static() }.into()),
+ ItemInNs::Types(module_id.into()),
ctx.ignore_local_imports,
);
if let Some(scope_name) = scope_name {
@@ -244,7 +244,7 @@ fn find_path_for_module<'db>(
}
// - if the module is in the prelude, return it by that path
- let item = ItemInNs::Types(unsafe { module_id.to_static() }.into());
+ let item = ItemInNs::Types(module_id.into());
if let Some(choice) = find_in_prelude(ctx.db, ctx.from_def_map, item, ctx.from) {
return Some(choice);
}
@@ -257,10 +257,10 @@ fn find_path_for_module<'db>(
best_choice
}
-fn find_in_scope<'db>(
- db: &'db dyn DefDatabase,
+fn find_in_scope(
+ db: &dyn DefDatabase,
def_map: &DefMap,
- from: ModuleIdLt<'db>,
+ from: ModuleId,
item: ItemInNs,
ignore_local_imports: bool,
) -> Option<Name> {
@@ -278,7 +278,7 @@ fn find_in_prelude(
db: &dyn DefDatabase,
local_def_map: &DefMap,
item: ItemInNs,
- from: ModuleIdLt<'_>,
+ from: ModuleId,
) -> Option<Choice> {
let (prelude_module, _) = local_def_map.prelude()?;
let prelude_def_map = prelude_module.def_map(db);
@@ -310,8 +310,8 @@ fn find_in_prelude(
fn is_kw_kind_relative_to_from(
db: &dyn DefDatabase,
def_map: &DefMap,
- item: ModuleIdLt<'_>,
- from: ModuleIdLt<'_>,
+ item: ModuleId,
+ from: ModuleId,
) -> Option<PathKind> {
if item.krate(db) != from.krate(db) || item.block(db).is_some() || from.block(db).is_some() {
return None;
@@ -332,9 +332,9 @@ fn is_kw_kind_relative_to_from(
}
#[tracing::instrument(skip_all)]
-fn calculate_best_path<'db>(
- ctx: &'db FindPathCtx<'db>,
- visited_modules: &mut FxHashSet<(ItemInNs, ModuleIdLt<'db>)>,
+fn calculate_best_path(
+ ctx: &FindPathCtx<'_>,
+ visited_modules: &mut FxHashSet<(ItemInNs, ModuleId)>,
item: ItemInNs,
max_len: usize,
best_choice: &mut Option<Choice>,
@@ -372,9 +372,9 @@ fn calculate_best_path<'db>(
}
}
-fn find_in_sysroot<'db>(
- ctx: &'db FindPathCtx<'db>,
- visited_modules: &mut FxHashSet<(ItemInNs, ModuleIdLt<'db>)>,
+fn find_in_sysroot(
+ ctx: &FindPathCtx<'_>,
+ visited_modules: &mut FxHashSet<(ItemInNs, ModuleId)>,
item: ItemInNs,
max_len: usize,
best_choice: &mut Option<Choice>,
@@ -418,9 +418,9 @@ fn find_in_sysroot<'db>(
});
}
-fn find_in_dep<'db>(
- ctx: &'db FindPathCtx<'db>,
- visited_modules: &mut FxHashSet<(ItemInNs, ModuleIdLt<'db>)>,
+fn find_in_dep(
+ ctx: &FindPathCtx<'_>,
+ visited_modules: &mut FxHashSet<(ItemInNs, ModuleId)>,
item: ItemInNs,
max_len: usize,
best_choice: &mut Option<Choice>,
@@ -461,9 +461,9 @@ fn find_in_dep<'db>(
}
}
-fn calculate_best_path_local<'db>(
- ctx: &'db FindPathCtx<'db>,
- visited_modules: &mut FxHashSet<(ItemInNs, ModuleIdLt<'db>)>,
+fn calculate_best_path_local(
+ ctx: &FindPathCtx<'_>,
+ visited_modules: &mut FxHashSet<(ItemInNs, ModuleId)>,
item: ItemInNs,
max_len: usize,
best_choice: &mut Option<Choice>,
@@ -558,11 +558,11 @@ fn path_kind_len(kind: PathKind) -> usize {
}
/// Finds locations in `from.krate` from which `item` can be imported by `from`.
-fn find_local_import_locations<'db>(
- ctx: &'db FindPathCtx<'db>,
+fn find_local_import_locations(
+ ctx: &FindPathCtx<'_>,
item: ItemInNs,
- visited_modules: &mut FxHashSet<(ItemInNs, ModuleIdLt<'db>)>,
- mut cb: impl FnMut(&mut FxHashSet<(ItemInNs, ModuleIdLt<'db>)>, &Name, ModuleIdLt<'db>),
+ visited_modules: &mut FxHashSet<(ItemInNs, ModuleId)>,
+ mut cb: impl FnMut(&mut FxHashSet<(ItemInNs, ModuleId)>, &Name, ModuleId),
) {
let _p = tracing::info_span!("find_local_import_locations").entered();
let db = ctx.db;