aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/infer')
-rw-r--r--crates/ra_hir/src/ty/infer/unify.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/crates/ra_hir/src/ty/infer/unify.rs b/crates/ra_hir/src/ty/infer/unify.rs
index a24e5eb5c..ad2eefcaf 100644
--- a/crates/ra_hir/src/ty/infer/unify.rs
+++ b/crates/ra_hir/src/ty/infer/unify.rs
@@ -2,7 +2,9 @@
2 2
3use super::InferenceContext; 3use super::InferenceContext;
4use crate::db::HirDatabase; 4use crate::db::HirDatabase;
5use crate::ty::{Canonical, InferTy, ProjectionPredicate, ProjectionTy, TraitRef, Ty}; 5use crate::ty::{
6 Canonical, InEnvironment, InferTy, ProjectionPredicate, ProjectionTy, TraitRef, Ty,
7};
6 8
7impl<'a, D: HirDatabase> InferenceContext<'a, D> { 9impl<'a, D: HirDatabase> InferenceContext<'a, D> {
8 pub(super) fn canonicalizer<'b>(&'b mut self) -> Canonicalizer<'a, 'b, D> 10 pub(super) fn canonicalizer<'b>(&'b mut self) -> Canonicalizer<'a, 'b, D>
@@ -105,14 +107,24 @@ where
105 ProjectionPredicate { ty, projection_ty } 107 ProjectionPredicate { ty, projection_ty }
106 } 108 }
107 109
110 // FIXME: add some point, we need to introduce a `Fold` trait that abstracts
111 // over all the things that can be canonicalized (like Chalk and rustc have)
112
108 pub fn canonicalize_ty(mut self, ty: Ty) -> Canonicalized<Ty> { 113 pub fn canonicalize_ty(mut self, ty: Ty) -> Canonicalized<Ty> {
109 let result = self.do_canonicalize_ty(ty); 114 let result = self.do_canonicalize_ty(ty);
110 self.into_canonicalized(result) 115 self.into_canonicalized(result)
111 } 116 }
112 117
113 pub fn canonicalize_trait_ref(mut self, trait_ref: TraitRef) -> Canonicalized<TraitRef> { 118 pub fn canonicalize_trait_ref(
114 let result = self.do_canonicalize_trait_ref(trait_ref); 119 mut self,
115 self.into_canonicalized(result) 120 trait_ref_in_env: InEnvironment<TraitRef>,
121 ) -> Canonicalized<InEnvironment<TraitRef>> {
122 let result = self.do_canonicalize_trait_ref(trait_ref_in_env.value);
123 // FIXME canonicalize env
124 self.into_canonicalized(InEnvironment {
125 value: result,
126 environment: trait_ref_in_env.environment,
127 })
116 } 128 }
117 129
118 pub fn canonicalize_projection( 130 pub fn canonicalize_projection(