aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/db.rs8
-rw-r--r--crates/ra_hir_ty/src/lib.rs8
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs6
3 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index 608bab1b1..cad3856c9 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -77,7 +77,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
77 77
78 // Interned IDs for Chalk integration 78 // Interned IDs for Chalk integration
79 #[salsa::interned] 79 #[salsa::interned]
80 fn intern_callable_def(&self, callable_def: CallableDef) -> crate::CallableDefId; 80 fn intern_callable_def(&self, callable_def: CallableDef) -> InternedCallableDefId;
81 #[salsa::interned] 81 #[salsa::interned]
82 fn intern_type_param_id(&self, param_id: TypeParamId) -> GlobalTypeParamId; 82 fn intern_type_param_id(&self, param_id: TypeParamId) -> GlobalTypeParamId;
83 #[salsa::interned] 83 #[salsa::interned]
@@ -151,3 +151,9 @@ impl_intern_key!(InternedOpaqueTyId);
151#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 151#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
152pub struct ClosureId(salsa::InternId); 152pub struct ClosureId(salsa::InternId);
153impl_intern_key!(ClosureId); 153impl_intern_key!(ClosureId);
154
155/// This exists just for Chalk, because Chalk just has a single `FnDefId` where
156/// we have different IDs for struct and enum variant constructors.
157#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd)]
158pub struct InternedCallableDefId(salsa::InternId);
159impl_intern_key!(InternedCallableDefId);
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index 9f034eca5..72b089604 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -33,7 +33,7 @@ use hir_def::{
33 TypeParamId, 33 TypeParamId,
34}; 34};
35use itertools::Itertools; 35use itertools::Itertools;
36use ra_db::{impl_intern_key, salsa, CrateId}; 36use ra_db::{salsa, CrateId};
37 37
38use crate::{ 38use crate::{
39 db::HirDatabase, 39 db::HirDatabase,
@@ -140,12 +140,6 @@ pub enum TypeCtor {
140 Closure { def: DefWithBodyId, expr: ExprId }, 140 Closure { def: DefWithBodyId, expr: ExprId },
141} 141}
142 142
143/// This exists just for Chalk, because Chalk just has a single `FnDefId` where
144/// we have different IDs for struct and enum variant constructors.
145#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd)]
146pub struct CallableDefId(salsa::InternId);
147impl_intern_key!(CallableDefId);
148
149impl TypeCtor { 143impl TypeCtor {
150 pub fn num_ty_params(self, db: &dyn HirDatabase) -> usize { 144 pub fn num_ty_params(self, db: &dyn HirDatabase) -> usize {
151 match self { 145 match self {
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index 1ef5baa05..e0a6cfe88 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -552,14 +552,14 @@ pub(crate) fn fn_def_datum_query(
552 Arc::new(datum) 552 Arc::new(datum)
553} 553}
554 554
555impl From<FnDefId> for crate::CallableDefId { 555impl From<FnDefId> for crate::db::InternedCallableDefId {
556 fn from(fn_def_id: FnDefId) -> Self { 556 fn from(fn_def_id: FnDefId) -> Self {
557 InternKey::from_intern_id(fn_def_id.0) 557 InternKey::from_intern_id(fn_def_id.0)
558 } 558 }
559} 559}
560 560
561impl From<crate::CallableDefId> for FnDefId { 561impl From<crate::db::InternedCallableDefId> for FnDefId {
562 fn from(callable_def_id: crate::CallableDefId) -> Self { 562 fn from(callable_def_id: crate::db::InternedCallableDefId) -> Self {
563 chalk_ir::FnDefId(callable_def_id.as_intern_id()) 563 chalk_ir::FnDefId(callable_def_id.as_intern_id())
564 } 564 }
565} 565}