diff options
Diffstat (limited to 'crates/ra_hir_def/src/lib.rs')
-rw-r--r-- | crates/ra_hir_def/src/lib.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 50caf4f83..dffc82ff8 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -17,6 +17,7 @@ pub mod imp; | |||
17 | pub mod diagnostics; | 17 | pub mod diagnostics; |
18 | pub mod expr; | 18 | pub mod expr; |
19 | pub mod body; | 19 | pub mod body; |
20 | pub mod generics; | ||
20 | 21 | ||
21 | #[cfg(test)] | 22 | #[cfg(test)] |
22 | mod test_db; | 23 | mod test_db; |
@@ -408,3 +409,26 @@ pub enum AssocItemId { | |||
408 | // require not implementing From, and instead having some checked way of | 409 | // require not implementing From, and instead having some checked way of |
409 | // casting them, and somehow making the constructors private, which would be annoying. | 410 | // casting them, and somehow making the constructors private, which would be annoying. |
410 | impl_froms!(AssocItemId: FunctionId, ConstId, TypeAliasId); | 411 | impl_froms!(AssocItemId: FunctionId, ConstId, TypeAliasId); |
412 | |||
413 | #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] | ||
414 | pub enum GenericDefId { | ||
415 | FunctionId(FunctionId), | ||
416 | AdtId(AdtId), | ||
417 | TraitId(TraitId), | ||
418 | TypeAliasId(TypeAliasId), | ||
419 | ImplId(ImplId), | ||
420 | // enum variants cannot have generics themselves, but their parent enums | ||
421 | // can, and this makes some code easier to write | ||
422 | EnumVariantId(EnumVariantId), | ||
423 | // consts can have type parameters from their parents (i.e. associated consts of traits) | ||
424 | ConstId(ConstId), | ||
425 | } | ||
426 | impl_froms!( | ||
427 | GenericDefId: FunctionId, | ||
428 | AdtId(StructId, EnumId, UnionId), | ||
429 | TraitId, | ||
430 | TypeAliasId, | ||
431 | ImplId, | ||
432 | EnumVariantId, | ||
433 | ConstId | ||
434 | ); | ||