mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
fix: Fix general find-path inconsistencies
This commit is contained in:
parent
21ec8f5238
commit
c88b421853
32 changed files with 242 additions and 193 deletions
|
@ -106,6 +106,9 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
type FxIndexMap<K, V> =
|
||||
indexmap::IndexMap<K, V, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ItemLoc<N: ItemTreeNode> {
|
||||
pub container: ModuleId,
|
||||
|
@ -455,6 +458,26 @@ impl ModuleId {
|
|||
pub fn is_block_module(self) -> bool {
|
||||
self.block.is_some() && self.local_id == DefMap::ROOT
|
||||
}
|
||||
|
||||
pub fn is_within_block(self) -> bool {
|
||||
self.block.is_some()
|
||||
}
|
||||
|
||||
pub fn as_crate_root(&self) -> Option<CrateRootModuleId> {
|
||||
if self.local_id == DefMap::ROOT && self.block.is_none() {
|
||||
Some(CrateRootModuleId { krate: self.krate })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn derive_crate_root(&self) -> CrateRootModuleId {
|
||||
CrateRootModuleId { krate: self.krate }
|
||||
}
|
||||
|
||||
fn is_crate_root(&self) -> bool {
|
||||
self.local_id == DefMap::ROOT && self.block.is_none()
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<CrateRootModuleId> for ModuleId {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue