From 6d2ec8765d418b365dfaf472ab9b2b53b8eeafa9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 Nov 2019 18:44:36 +0300 Subject: Use TypeAliasId in Ty, pt 1 --- crates/ra_hir/src/ty/traits/chalk.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 0272dd9ae..fd2f1b174 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs @@ -9,7 +9,7 @@ use chalk_ir::{ }; use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum}; -use hir_def::{lang_item::LangItemTarget, GenericDefId}; +use hir_def::{lang_item::LangItemTarget, GenericDefId, TypeAliasId}; use hir_expand::name; use ra_db::salsa::{InternId, InternKey}; @@ -215,6 +215,18 @@ impl ToChalk for TypeAlias { } } +impl ToChalk for TypeAliasId { + type Chalk = chalk_ir::TypeId; + + fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TypeId { + chalk_ir::TypeId(id_to_chalk(self)) + } + + fn from_chalk(_db: &impl HirDatabase, type_alias_id: chalk_ir::TypeId) -> TypeAliasId { + id_from_chalk(type_alias_id.0) + } +} + impl ToChalk for AssocTyValue { type Chalk = chalk_rust_ir::AssociatedTyValueId; -- cgit v1.2.3