aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/lib.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-20 09:25:02 +0000
committerAleksey Kladov <[email protected]>2019-11-20 09:34:48 +0000
commite1a6e38767c1e47e5e88a97a9ef5b4547390803c (patch)
treebe32707506b562828759e3c9dc72414796a817ca /crates/ra_hir_def/src/lib.rs
parent0e771915faf057ec4561224b75ec9b5be93d71c8 (diff)
Move Generics to hir_def
Diffstat (limited to 'crates/ra_hir_def/src/lib.rs')
-rw-r--r--crates/ra_hir_def/src/lib.rs24
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;
17pub mod diagnostics; 17pub mod diagnostics;
18pub mod expr; 18pub mod expr;
19pub mod body; 19pub mod body;
20pub mod generics;
20 21
21#[cfg(test)] 22#[cfg(test)]
22mod test_db; 23mod 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.
410impl_froms!(AssocItemId: FunctionId, ConstId, TypeAliasId); 411impl_froms!(AssocItemId: FunctionId, ConstId, TypeAliasId);
412
413#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
414pub 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}
426impl_froms!(
427 GenericDefId: FunctionId,
428 AdtId(StructId, EnumId, UnionId),
429 TraitId,
430 TypeAliasId,
431 ImplId,
432 EnumVariantId,
433 ConstId
434);