mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Resolve trait associated items
E.g. `Default::default` or `<Foo as Default>::default`.
This commit is contained in:
parent
5704485063
commit
c35ef5013c
5 changed files with 78 additions and 19 deletions
|
@ -1055,3 +1055,13 @@ pub enum AssocItem {
|
|||
// require not implementing From, and instead having some checked way of
|
||||
// casting them, and somehow making the constructors private, which would be annoying.
|
||||
impl_froms!(AssocItem: Function, Const, TypeAlias);
|
||||
|
||||
impl From<AssocItem> for crate::generics::GenericDef {
|
||||
fn from(item: AssocItem) -> Self {
|
||||
match item {
|
||||
AssocItem::Function(f) => f.into(),
|
||||
AssocItem::Const(c) => c.into(),
|
||||
AssocItem::TypeAlias(t) => t.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue