From 20770044631fd0c21caa12f9bc87489ea6c848ee Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 15 Jul 2020 21:47:45 +0200 Subject: Remove TypeCtor interning Our TypeCtor and Chalk's TypeName match now! --- crates/ra_hir_ty/src/traits/chalk/mapping.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir_ty/src/traits/chalk/mapping.rs') diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/ra_hir_ty/src/traits/chalk/mapping.rs index 796947e69..a852ce2ac 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs @@ -316,20 +316,19 @@ impl ToChalk for TypeCtor { TypeName::Closure(closure_id.into()) } - TypeCtor::FnPtr { .. } => panic!("Trying to convert FnPtr to TypeName"), + TypeCtor::Adt(adt_id) => TypeName::Adt(chalk_ir::AdtId(adt_id)), - TypeCtor::Adt(_) => { - // FIXME no interning needed anymore - // other TypeCtors get interned and turned into a chalk StructId - let struct_id = db.intern_type_ctor(self).into(); - TypeName::Adt(struct_id) + TypeCtor::FnPtr { .. } => { + // This should not be reached, since Chalk doesn't represent + // function pointers with TypeName + unreachable!() } } } fn from_chalk(db: &dyn HirDatabase, type_name: TypeName) -> TypeCtor { match type_name { - TypeName::Adt(struct_id) => db.lookup_intern_type_ctor(struct_id.into()), + TypeName::Adt(struct_id) => TypeCtor::Adt(struct_id.0), TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)), TypeName::OpaqueType(opaque_type_id) => { TypeCtor::OpaqueType(from_chalk(db, opaque_type_id)) -- cgit v1.2.3