mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Move body queries to hir_def
This commit is contained in:
parent
ef02296b9f
commit
1583ab1558
12 changed files with 110 additions and 75 deletions
|
@ -3,9 +3,9 @@
|
|||
//! It's unclear if we need this long-term, but it's definitelly useful while we
|
||||
//! are splitting the hir.
|
||||
|
||||
use hir_def::{AdtId, EnumVariantId, ModuleDefId};
|
||||
use hir_def::{AdtId, DefWithBodyId, EnumVariantId, ModuleDefId};
|
||||
|
||||
use crate::{Adt, EnumVariant, ModuleDef};
|
||||
use crate::{Adt, DefWithBody, EnumVariant, ModuleDef};
|
||||
|
||||
macro_rules! from_id {
|
||||
($(($id:path, $ty:path)),*) => {$(
|
||||
|
@ -61,3 +61,13 @@ impl From<ModuleDefId> for ModuleDef {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DefWithBody> for DefWithBodyId {
|
||||
fn from(def: DefWithBody) -> Self {
|
||||
match def {
|
||||
DefWithBody::Function(it) => DefWithBodyId::FunctionId(it.id),
|
||||
DefWithBody::Static(it) => DefWithBodyId::StaticId(it.id),
|
||||
DefWithBody::Const(it) => DefWithBodyId::ConstId(it.id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue