mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Add generic params to impl blocks
This commit is contained in:
parent
ccfc6b11c1
commit
da7056245d
4 changed files with 16 additions and 9 deletions
|
@ -7,7 +7,7 @@ use std::sync::Arc;
|
|||
|
||||
use ra_syntax::ast::{self, NameOwner, TypeParamsOwner};
|
||||
|
||||
use crate::{db::PersistentHirDatabase, Name, AsName, Function, Struct, Enum, Trait, Type};
|
||||
use crate::{db::PersistentHirDatabase, Name, AsName, Function, Struct, Enum, Trait, Type, ImplBlock};
|
||||
|
||||
/// Data about a generic parameter (to a function, struct, impl, ...).
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
|
@ -30,8 +30,9 @@ pub enum GenericDef {
|
|||
Enum(Enum),
|
||||
Trait(Trait),
|
||||
Type(Type),
|
||||
ImplBlock(ImplBlock),
|
||||
}
|
||||
impl_froms!(GenericDef: Function, Struct, Enum, Trait, Type);
|
||||
impl_froms!(GenericDef: Function, Struct, Enum, Trait, Type, ImplBlock);
|
||||
|
||||
impl GenericParams {
|
||||
pub(crate) fn generic_params_query(
|
||||
|
@ -45,6 +46,7 @@ impl GenericParams {
|
|||
GenericDef::Enum(it) => generics.fill(&*it.source(db).1),
|
||||
GenericDef::Trait(it) => generics.fill(&*it.source(db).1),
|
||||
GenericDef::Type(it) => generics.fill(&*it.source(db).1),
|
||||
GenericDef::ImplBlock(it) => generics.fill(&*it.source(db).1),
|
||||
}
|
||||
|
||||
Arc::new(generics)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue