From 58e338a72996edc4b29f4fdada9d5b33c54ad608 Mon Sep 17 00:00:00 2001 From: Wilco Kusee Date: Mon, 13 Jul 2020 22:03:26 +0200 Subject: Print chalk programs in debug output --- crates/hir_ty/src/traits/chalk.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'crates/hir_ty/src/traits') diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index b33653417..08c2c9a3e 100644 --- a/crates/hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs @@ -240,20 +240,22 @@ impl<'a> chalk_solve::RustIrDatabase for ChalkContext<'a> { Substs::empty().to_chalk(self.db) } - fn trait_name(&self, _trait_id: chalk_ir::TraitId) -> String { - unimplemented!() + fn trait_name(&self, trait_id: chalk_ir::TraitId) -> String { + let id = from_chalk(self.db, trait_id); + self.db.trait_data(id).name.to_string() } - fn adt_name(&self, _struct_id: chalk_ir::AdtId) -> String { - unimplemented!() + // FIXME: lookup names + fn adt_name(&self, struct_id: chalk_ir::AdtId) -> String { + format!("Adt_{:?}", struct_id.0).replace("TypeCtorId(", "").replace(")", "") } - fn assoc_type_name(&self, _assoc_ty_id: chalk_ir::AssocTypeId) -> String { - unimplemented!() + fn assoc_type_name(&self, assoc_ty_id: chalk_ir::AssocTypeId) -> String { + format!("Assoc_{}", assoc_ty_id.0) } - fn opaque_type_name(&self, _opaque_ty_id: chalk_ir::OpaqueTyId) -> String { - unimplemented!() + fn opaque_type_name(&self, opaque_ty_id: chalk_ir::OpaqueTyId) -> String { + format!("Opaque_{}", opaque_ty_id.0) } - fn fn_def_name(&self, _fn_def_id: chalk_ir::FnDefId) -> String { - unimplemented!() + fn fn_def_name(&self, fn_def_id: chalk_ir::FnDefId) -> String { + format!("fn_{}", fn_def_id.0) } } -- cgit v1.2.3