From 7ec3b66f7a3ac0a33cf435bc3596fdac542fc52a Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 20 Mar 2021 11:23:59 +0100 Subject: Turn Obligation into something similar to chalk_ir::DomainGoal This includes starting to make use of Chalk's `Cast` trait. --- crates/hir_ty/src/method_resolution.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/hir_ty/src/method_resolution.rs') diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 01b78fb44..da6bc2a4a 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -6,7 +6,7 @@ use std::{iter, sync::Arc}; use arrayvec::ArrayVec; use base_db::CrateId; -use chalk_ir::Mutability; +use chalk_ir::{cast::Cast, Mutability}; use hir_def::{ lang_item::LangItemTarget, AssocContainerId, AssocItemId, FunctionId, GenericDefId, HasModule, ImplId, Lookup, ModuleId, TraitId, @@ -767,7 +767,7 @@ fn generic_implements_goal( env: Arc, trait_: TraitId, self_ty: Canonical, -) -> Canonical> { +) -> Canonical> { let mut kinds = self_ty.kinds.to_vec(); let substs = super::Substitution::build_for_def(db, trait_) .push(self_ty.value) @@ -775,7 +775,7 @@ fn generic_implements_goal( .build(); kinds.extend(iter::repeat(chalk_ir::TyVariableKind::General).take(substs.len() - 1)); let trait_ref = TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs }; - let obligation = super::Obligation::Trait(trait_ref); + let obligation = trait_ref.cast(&Interner); Canonical { kinds: kinds.into(), value: InEnvironment::new(env, obligation) } } -- cgit v1.2.3