aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer/unify.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/infer/unify.rs')
-rw-r--r--crates/ra_hir/src/ty/infer/unify.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/crates/ra_hir/src/ty/infer/unify.rs b/crates/ra_hir/src/ty/infer/unify.rs
index d161aa6b3..014c7981f 100644
--- a/crates/ra_hir/src/ty/infer/unify.rs
+++ b/crates/ra_hir/src/ty/infer/unify.rs
@@ -6,6 +6,7 @@ use crate::ty::{
6 Canonical, InEnvironment, InferTy, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, 6 Canonical, InEnvironment, InferTy, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty,
7 TypeWalk, 7 TypeWalk,
8}; 8};
9use crate::util::make_mut_slice;
9 10
10impl<'a, D: HirDatabase> InferenceContext<'a, D> { 11impl<'a, D: HirDatabase> InferenceContext<'a, D> {
11 pub(super) fn canonicalizer<'b>(&'b mut self) -> Canonicalizer<'a, 'b, D> 12 pub(super) fn canonicalizer<'b>(&'b mut self) -> Canonicalizer<'a, 'b, D>
@@ -74,10 +75,11 @@ where
74 }) 75 })
75 } 76 }
76 77
77 fn do_canonicalize_trait_ref(&mut self, trait_ref: TraitRef) -> TraitRef { 78 fn do_canonicalize_trait_ref(&mut self, mut trait_ref: TraitRef) -> TraitRef {
78 let substs = 79 for ty in make_mut_slice(&mut trait_ref.substs.0) {
79 trait_ref.substs.iter().map(|ty| self.do_canonicalize_ty(ty.clone())).collect(); 80 *ty = self.do_canonicalize_ty(ty.clone());
80 TraitRef { trait_: trait_ref.trait_, substs: Substs(substs) } 81 }
82 trait_ref
81 } 83 }
82 84
83 fn into_canonicalized<T>(self, result: T) -> Canonicalized<T> { 85 fn into_canonicalized<T>(self, result: T) -> Canonicalized<T> {
@@ -87,10 +89,11 @@ where
87 } 89 }
88 } 90 }
89 91
90 fn do_canonicalize_projection_ty(&mut self, projection_ty: ProjectionTy) -> ProjectionTy { 92 fn do_canonicalize_projection_ty(&mut self, mut projection_ty: ProjectionTy) -> ProjectionTy {
91 let params = 93 for ty in make_mut_slice(&mut projection_ty.parameters.0) {
92 projection_ty.parameters.iter().map(|ty| self.do_canonicalize_ty(ty.clone())).collect(); 94 *ty = self.do_canonicalize_ty(ty.clone());
93 ProjectionTy { associated_ty: projection_ty.associated_ty, parameters: Substs(params) } 95 }
96 projection_ty
94 } 97 }
95 98
96 fn do_canonicalize_projection_predicate( 99 fn do_canonicalize_projection_predicate(