aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/from_id.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-21 13:32:40 +0000
committerGitHub <[email protected]>2019-11-21 13:32:40 +0000
commit0630bbabfc19126be5fa47933c5ea03d48030582 (patch)
treed7e8fc2fc2234c4bd28c2274bdc761f74a78940a /crates/ra_hir/src/from_id.rs
parent1f61915bde4c5d8d4fe2e9b8dfa9445008730b79 (diff)
parent952405cb4180993af0f5c939d5276dbdf2a19152 (diff)
Merge #2338
2338: Remove old hir::generics module r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/from_id.rs')
-rw-r--r--crates/ra_hir/src/from_id.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs
index a3e9d8525..e8ed04056 100644
--- a/crates/ra_hir/src/from_id.rs
+++ b/crates/ra_hir/src/from_id.rs
@@ -9,8 +9,9 @@ use hir_def::{
9}; 9};
10 10
11use crate::{ 11use crate::{
12 ty::TypableDef, Adt, AssocItem, Const, Crate, DefWithBody, EnumVariant, Function, GenericDef, 12 ty::{CallableDef, TypableDef},
13 ModuleDef, Static, TypeAlias, 13 Adt, AssocItem, Const, Crate, DefWithBody, EnumVariant, Function, GenericDef, ModuleDef,
14 Static, TypeAlias,
14}; 15};
15 16
16impl From<ra_db::CrateId> for Crate { 17impl From<ra_db::CrateId> for Crate {
@@ -206,3 +207,15 @@ impl From<Adt> for GenericDefId {
206 } 207 }
207 } 208 }
208} 209}
210
211impl From<CallableDef> for GenericDefId {
212 fn from(def: CallableDef) -> Self {
213 match def {
214 CallableDef::Function(it) => it.id.into(),
215 CallableDef::Struct(it) => it.id.into(),
216 CallableDef::EnumVariant(it) => {
217 EnumVariantId { parent: it.parent.id, local_id: it.id }.into()
218 }
219 }
220 }
221}