Record import source IDs

This commit is contained in:
Lukas Wirth 2023-08-09 15:20:42 +02:00
parent 4bed01c36e
commit 992b928a93
7 changed files with 217 additions and 157 deletions

View file

@ -109,6 +109,17 @@ impl CrateRootModuleId {
}
}
impl PartialEq<ModuleId> for CrateRootModuleId {
fn eq(&self, other: &ModuleId) -> bool {
other.block.is_none() && other.local_id == DefMap::ROOT && self.krate == other.krate
}
}
impl PartialEq<CrateRootModuleId> for ModuleId {
fn eq(&self, other: &CrateRootModuleId) -> bool {
other == self
}
}
impl From<CrateRootModuleId> for ModuleId {
fn from(CrateRootModuleId { krate }: CrateRootModuleId) -> Self {
ModuleId { krate, block: None, local_id: DefMap::ROOT }