diff options
author | Florian Diebold <[email protected]> | 2021-03-21 19:19:07 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-03-21 19:19:07 +0000 |
commit | c4fd3f47f5b4f34476f8f085f2412a46aa0fd24f (patch) | |
tree | 82b6b318da1564cabd0225dfb3c67433f80b8ab8 /crates/hir_ty/src/method_resolution.rs | |
parent | f7be314579db29f64ef660aef1896da33d420ad6 (diff) |
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.
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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( | |||
376 | // Also note that when we've got a receiver like &S, even if the method we | 376 | // Also note that when we've got a receiver like &S, even if the method we |
377 | // find in the end takes &self, we still do the autoderef step (just as | 377 | // find in the end takes &self, we still do the autoderef step (just as |
378 | // rustc does an autoderef and then autoref again). | 378 | // rustc does an autoderef and then autoref again). |
379 | let ty = InEnvironment { value: ty.clone(), environment: env.clone() }; | 379 | let ty = InEnvironment { goal: ty.clone(), environment: env.env.clone() }; |
380 | 380 | ||
381 | // We have to be careful about the order we're looking at candidates | 381 | // We have to be careful about the order we're looking at candidates |
382 | // in here. Consider the case where we're resolving `x.clone()` | 382 | // in here. Consider the case where we're resolving `x.clone()` |
@@ -622,7 +622,7 @@ pub fn resolve_indexing_op( | |||
622 | krate: CrateId, | 622 | krate: CrateId, |
623 | index_trait: TraitId, | 623 | index_trait: TraitId, |
624 | ) -> Option<Canonical<Ty>> { | 624 | ) -> Option<Canonical<Ty>> { |
625 | let ty = InEnvironment { value: ty.clone(), environment: env.clone() }; | 625 | let ty = InEnvironment { goal: ty.clone(), environment: env.env.clone() }; |
626 | let deref_chain = autoderef_method_receiver(db, krate, ty); | 626 | let deref_chain = autoderef_method_receiver(db, krate, ty); |
627 | for ty in deref_chain { | 627 | for ty in deref_chain { |
628 | let goal = generic_implements_goal(db, env.clone(), index_trait, ty.clone()); | 628 | let goal = generic_implements_goal(db, env.clone(), index_trait, ty.clone()); |
@@ -794,7 +794,7 @@ fn generic_implements_goal( | |||
794 | let obligation = trait_ref.cast(&Interner); | 794 | let obligation = trait_ref.cast(&Interner); |
795 | Canonical { | 795 | Canonical { |
796 | binders: CanonicalVarKinds::from_iter(&Interner, kinds), | 796 | binders: CanonicalVarKinds::from_iter(&Interner, kinds), |
797 | value: InEnvironment::new(env, obligation), | 797 | value: InEnvironment::new(env.env.clone(), obligation), |
798 | } | 798 | } |
799 | } | 799 | } |
800 | 800 | ||