diff options
Diffstat (limited to 'crates/ra_hir/src/generics.rs')
-rw-r--r-- | crates/ra_hir/src/generics.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs index 74435c20a..77fb76bfc 100644 --- a/crates/ra_hir/src/generics.rs +++ b/crates/ra_hir/src/generics.rs | |||
@@ -12,8 +12,8 @@ use crate::{ | |||
12 | name::SELF_TYPE, | 12 | name::SELF_TYPE, |
13 | path::Path, | 13 | path::Path, |
14 | type_ref::{TypeBound, TypeRef}, | 14 | type_ref::{TypeBound, TypeRef}, |
15 | AdtDef, AsName, Container, Enum, EnumVariant, Function, HasSource, ImplBlock, Name, Struct, | 15 | Adt, AsName, Container, Enum, EnumVariant, Function, HasSource, ImplBlock, Name, Struct, Trait, |
16 | Trait, TypeAlias, Union, | 16 | TypeAlias, Union, |
17 | }; | 17 | }; |
18 | 18 | ||
19 | /// Data about a generic parameter (to a function, struct, impl, ...). | 19 | /// Data about a generic parameter (to a function, struct, impl, ...). |
@@ -47,7 +47,7 @@ pub struct WherePredicate { | |||
47 | #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] | 47 | #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] |
48 | pub enum GenericDef { | 48 | pub enum GenericDef { |
49 | Function(Function), | 49 | Function(Function), |
50 | AdtDef(AdtDef), | 50 | Adt(Adt), |
51 | Trait(Trait), | 51 | Trait(Trait), |
52 | TypeAlias(TypeAlias), | 52 | TypeAlias(TypeAlias), |
53 | ImplBlock(ImplBlock), | 53 | ImplBlock(ImplBlock), |
@@ -57,7 +57,7 @@ pub enum GenericDef { | |||
57 | } | 57 | } |
58 | impl_froms!( | 58 | impl_froms!( |
59 | GenericDef: Function, | 59 | GenericDef: Function, |
60 | AdtDef(Struct, Enum, Union), | 60 | Adt(Struct, Enum, Union), |
61 | Trait, | 61 | Trait, |
62 | TypeAlias, | 62 | TypeAlias, |
63 | ImplBlock, | 63 | ImplBlock, |
@@ -74,7 +74,7 @@ impl GenericParams { | |||
74 | GenericDef::Function(it) => it.container(db).map(GenericDef::from), | 74 | GenericDef::Function(it) => it.container(db).map(GenericDef::from), |
75 | GenericDef::TypeAlias(it) => it.container(db).map(GenericDef::from), | 75 | GenericDef::TypeAlias(it) => it.container(db).map(GenericDef::from), |
76 | GenericDef::EnumVariant(it) => Some(it.parent_enum(db).into()), | 76 | GenericDef::EnumVariant(it) => Some(it.parent_enum(db).into()), |
77 | GenericDef::AdtDef(_) | GenericDef::Trait(_) => None, | 77 | GenericDef::Adt(_) | GenericDef::Trait(_) => None, |
78 | GenericDef::ImplBlock(_) => None, | 78 | GenericDef::ImplBlock(_) => None, |
79 | }; | 79 | }; |
80 | generics.parent_params = parent.map(|p| db.generic_params(p)); | 80 | generics.parent_params = parent.map(|p| db.generic_params(p)); |
@@ -82,9 +82,9 @@ impl GenericParams { | |||
82 | // FIXME: add `: Sized` bound for everything except for `Self` in traits | 82 | // FIXME: add `: Sized` bound for everything except for `Self` in traits |
83 | match def { | 83 | match def { |
84 | GenericDef::Function(it) => generics.fill(&it.source(db).ast, start), | 84 | GenericDef::Function(it) => generics.fill(&it.source(db).ast, start), |
85 | GenericDef::AdtDef(AdtDef::Struct(it)) => generics.fill(&it.source(db).ast, start), | 85 | GenericDef::Adt(Adt::Struct(it)) => generics.fill(&it.source(db).ast, start), |
86 | GenericDef::AdtDef(AdtDef::Union(it)) => generics.fill(&it.source(db).ast, start), | 86 | GenericDef::Adt(Adt::Union(it)) => generics.fill(&it.source(db).ast, start), |
87 | GenericDef::AdtDef(AdtDef::Enum(it)) => generics.fill(&it.source(db).ast, start), | 87 | GenericDef::Adt(Adt::Enum(it)) => generics.fill(&it.source(db).ast, start), |
88 | GenericDef::Trait(it) => { | 88 | GenericDef::Trait(it) => { |
89 | // traits get the Self type as an implicit first type parameter | 89 | // traits get the Self type as an implicit first type parameter |
90 | generics.params.push(GenericParam { idx: start, name: SELF_TYPE, default: None }); | 90 | generics.params.push(GenericParam { idx: start, name: SELF_TYPE, default: None }); |
@@ -188,7 +188,7 @@ impl GenericDef { | |||
188 | pub(crate) fn resolver(&self, db: &impl HirDatabase) -> crate::Resolver { | 188 | pub(crate) fn resolver(&self, db: &impl HirDatabase) -> crate::Resolver { |
189 | match self { | 189 | match self { |
190 | GenericDef::Function(inner) => inner.resolver(db), | 190 | GenericDef::Function(inner) => inner.resolver(db), |
191 | GenericDef::AdtDef(adt) => adt.resolver(db), | 191 | GenericDef::Adt(adt) => adt.resolver(db), |
192 | GenericDef::Trait(inner) => inner.resolver(db), | 192 | GenericDef::Trait(inner) => inner.resolver(db), |
193 | GenericDef::TypeAlias(inner) => inner.resolver(db), | 193 | GenericDef::TypeAlias(inner) => inner.resolver(db), |
194 | GenericDef::ImplBlock(inner) => inner.resolver(db), | 194 | GenericDef::ImplBlock(inner) => inner.resolver(db), |