mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
HIR ExternCrateDecl
This commit is contained in:
parent
0bde3fc77e
commit
9476fdaaa9
10 changed files with 75 additions and 16 deletions
|
@ -831,6 +831,7 @@ pub enum AttrDefId {
|
|||
ImplId(ImplId),
|
||||
GenericParamId(GenericParamId),
|
||||
ExternBlockId(ExternBlockId),
|
||||
ExternCrateId(ExternCrateId),
|
||||
}
|
||||
|
||||
impl_from!(
|
||||
|
@ -845,7 +846,8 @@ impl_from!(
|
|||
TypeAliasId,
|
||||
MacroId(Macro2Id, MacroRulesId, ProcMacroId),
|
||||
ImplId,
|
||||
GenericParamId
|
||||
GenericParamId,
|
||||
ExternCrateId
|
||||
for AttrDefId
|
||||
);
|
||||
|
||||
|
@ -937,6 +939,12 @@ impl HasModule for AdtId {
|
|||
}
|
||||
}
|
||||
|
||||
impl HasModule for ExternCrateId {
|
||||
fn module(&self, db: &dyn db::DefDatabase) -> ModuleId {
|
||||
self.lookup(db).container
|
||||
}
|
||||
}
|
||||
|
||||
impl HasModule for VariantId {
|
||||
fn module(&self, db: &dyn db::DefDatabase) -> ModuleId {
|
||||
match self {
|
||||
|
@ -1060,6 +1068,7 @@ impl AttrDefId {
|
|||
.krate
|
||||
}
|
||||
AttrDefId::MacroId(it) => it.module(db).krate,
|
||||
AttrDefId::ExternCrateId(it) => it.lookup(db).container.krate,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue