aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs20
1 files changed, 7 insertions, 13 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index 4001aa941..7a0f99dec 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -27,6 +27,7 @@ impl chalk_ir::interner::Interner for Interner {
27 type InternedGoal = Arc<GoalData<Self>>; 27 type InternedGoal = Arc<GoalData<Self>>;
28 type InternedGoals = Vec<Goal<Self>>; 28 type InternedGoals = Vec<Goal<Self>>;
29 type InternedSubstitution = Vec<Parameter<Self>>; 29 type InternedSubstitution = Vec<Parameter<Self>>;
30 type Identifier = lalrpop_intern::InternedString;
30 type DefId = InternId; 31 type DefId = InternId;
31 32
32 // FIXME: implement these 33 // FIXME: implement these
@@ -121,7 +122,7 @@ pub type StructId = chalk_ir::StructId<Interner>;
121pub type StructDatum = chalk_rust_ir::StructDatum<Interner>; 122pub type StructDatum = chalk_rust_ir::StructDatum<Interner>;
122pub type ImplId = chalk_ir::ImplId<Interner>; 123pub type ImplId = chalk_ir::ImplId<Interner>;
123pub type ImplDatum = chalk_rust_ir::ImplDatum<Interner>; 124pub type ImplDatum = chalk_rust_ir::ImplDatum<Interner>;
124pub type AssociatedTyValueId = chalk_rust_ir::AssociatedTyValueId; 125pub type AssociatedTyValueId = chalk_rust_ir::AssociatedTyValueId<Interner>;
125pub type AssociatedTyValue = chalk_rust_ir::AssociatedTyValue<Interner>; 126pub type AssociatedTyValue = chalk_rust_ir::AssociatedTyValue<Interner>;
126 127
127pub(super) trait ToChalk { 128pub(super) trait ToChalk {
@@ -822,13 +823,6 @@ fn type_alias_associated_ty_value(
822 Arc::new(value) 823 Arc::new(value)
823} 824}
824 825
825fn id_from_chalk<T: InternKey>(chalk_id: chalk_ir::RawId) -> T {
826 T::from_intern_id(InternId::from(chalk_id.index))
827}
828fn id_to_chalk<T: InternKey>(salsa_id: T) -> chalk_ir::RawId {
829 chalk_ir::RawId { index: salsa_id.as_intern_id().as_u32() }
830}
831
832impl From<StructId> for crate::TypeCtorId { 826impl From<StructId> for crate::TypeCtorId {
833 fn from(struct_id: StructId) -> Self { 827 fn from(struct_id: StructId) -> Self {
834 InternKey::from_intern_id(struct_id.0) 828 InternKey::from_intern_id(struct_id.0)
@@ -853,14 +847,14 @@ impl From<crate::traits::GlobalImplId> for ImplId {
853 } 847 }
854} 848}
855 849
856impl From<chalk_rust_ir::AssociatedTyValueId> for crate::traits::AssocTyValueId { 850impl From<chalk_rust_ir::AssociatedTyValueId<Interner>> for crate::traits::AssocTyValueId {
857 fn from(id: chalk_rust_ir::AssociatedTyValueId) -> Self { 851 fn from(id: chalk_rust_ir::AssociatedTyValueId<Interner>) -> Self {
858 id_from_chalk(id.0) 852 Self::from_intern_id(id.0)
859 } 853 }
860} 854}
861 855
862impl From<crate::traits::AssocTyValueId> for chalk_rust_ir::AssociatedTyValueId { 856impl From<crate::traits::AssocTyValueId> for chalk_rust_ir::AssociatedTyValueId<Interner> {
863 fn from(assoc_ty_value_id: crate::traits::AssocTyValueId) -> Self { 857 fn from(assoc_ty_value_id: crate::traits::AssocTyValueId) -> Self {
864 chalk_rust_ir::AssociatedTyValueId(id_to_chalk(assoc_ty_value_id)) 858 chalk_rust_ir::AssociatedTyValueId(assoc_ty_value_id.as_intern_id())
865 } 859 }
866} 860}