From c4fd3f47f5b4f34476f8f085f2412a46aa0fd24f Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 21 Mar 2021 20:19:07 +0100 Subject: Align InEnvironment with Chalk This in particular means storing a chalk_ir::Environment, not our TraitEnvironment. This makes InEnvironment not usable for Type, where we need to keep the full TraitEnvironment. --- 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 0abe8f0a3..8e986ddde 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -376,7 +376,7 @@ fn iterate_method_candidates_impl( // Also note that when we've got a receiver like &S, even if the method we // find in the end takes &self, we still do the autoderef step (just as // rustc does an autoderef and then autoref again). - let ty = InEnvironment { value: ty.clone(), environment: env.clone() }; + let ty = InEnvironment { goal: ty.clone(), environment: env.env.clone() }; // We have to be careful about the order we're looking at candidates // in here. Consider the case where we're resolving `x.clone()` @@ -622,7 +622,7 @@ pub fn resolve_indexing_op( krate: CrateId, index_trait: TraitId, ) -> Option> { - let ty = InEnvironment { value: ty.clone(), environment: env.clone() }; + let ty = InEnvironment { goal: ty.clone(), environment: env.env.clone() }; let deref_chain = autoderef_method_receiver(db, krate, ty); for ty in deref_chain { let goal = generic_implements_goal(db, env.clone(), index_trait, ty.clone()); @@ -794,7 +794,7 @@ fn generic_implements_goal( let obligation = trait_ref.cast(&Interner); Canonical { binders: CanonicalVarKinds::from_iter(&Interner, kinds), - value: InEnvironment::new(env, obligation), + value: InEnvironment::new(env.env.clone(), obligation), } } -- cgit v1.2.3