mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
internal: Add a CrateRootModuleId that encodes a module id that is always a crate root
This commit is contained in:
parent
6b3659d38f
commit
cf178cba8f
9 changed files with 102 additions and 65 deletions
|
@ -81,7 +81,7 @@ fn find_path_inner(
|
|||
}
|
||||
|
||||
let def_map = from.def_map(db);
|
||||
let crate_root = def_map.crate_root();
|
||||
let crate_root = def_map.crate_root().into();
|
||||
// - if the item is a module, jump straight to module search
|
||||
if let ItemInNs::Types(ModuleDefId::ModuleId(module_id)) = item {
|
||||
let mut visited_modules = FxHashSet::default();
|
||||
|
@ -374,7 +374,7 @@ fn calculate_best_path(
|
|||
}
|
||||
}
|
||||
if let Some(module) = item.module(db) {
|
||||
if module.def_map(db).block_id().is_some() && prefixed.is_some() {
|
||||
if module.containing_block().is_some() && prefixed.is_some() {
|
||||
cov_mark::hit!(prefixed_in_block_expression);
|
||||
prefixed = Some(PrefixKind::Plain);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue