mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Create TraitEnvironment through a query
This commit is contained in:
parent
17eeb2a6d2
commit
c82d1823a1
6 changed files with 77 additions and 51 deletions
|
|
@ -341,6 +341,16 @@ pub enum DefWithBodyId {
|
|||
|
||||
impl_from!(FunctionId, ConstId, StaticId for DefWithBodyId);
|
||||
|
||||
impl DefWithBodyId {
|
||||
pub fn as_generic_def_id(self) -> Option<GenericDefId> {
|
||||
match self {
|
||||
DefWithBodyId::FunctionId(f) => Some(f.into()),
|
||||
DefWithBodyId::StaticId(_) => None,
|
||||
DefWithBodyId::ConstId(c) => Some(c.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum AssocItemId {
|
||||
FunctionId(FunctionId),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue