diff options
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 7795f446f..b2d4f67b3 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -8,7 +8,7 @@ use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; | |||
8 | use super::{InferenceContext, Obligation}; | 8 | use super::{InferenceContext, Obligation}; |
9 | use crate::{ | 9 | use crate::{ |
10 | BoundVar, Canonical, DebruijnIndex, FnPointer, GenericPredicate, InEnvironment, InferenceVar, | 10 | BoundVar, Canonical, DebruijnIndex, FnPointer, GenericPredicate, InEnvironment, InferenceVar, |
11 | Interner, Scalar, Substs, Ty, TyKind, TypeWalk, | 11 | Interner, Scalar, Substitution, Ty, TyKind, TypeWalk, |
12 | }; | 12 | }; |
13 | 13 | ||
14 | impl<'a> InferenceContext<'a> { | 14 | impl<'a> InferenceContext<'a> { |
@@ -123,10 +123,10 @@ impl<T> Canonicalized<T> { | |||
123 | pub(super) fn apply_solution( | 123 | pub(super) fn apply_solution( |
124 | &self, | 124 | &self, |
125 | ctx: &mut InferenceContext<'_>, | 125 | ctx: &mut InferenceContext<'_>, |
126 | solution: Canonical<Substs>, | 126 | solution: Canonical<Substitution>, |
127 | ) { | 127 | ) { |
128 | // the solution may contain new variables, which we need to convert to new inference vars | 128 | // the solution may contain new variables, which we need to convert to new inference vars |
129 | let new_vars = Substs( | 129 | let new_vars = Substitution( |
130 | solution | 130 | solution |
131 | .kinds | 131 | .kinds |
132 | .iter() | 132 | .iter() |
@@ -147,9 +147,9 @@ impl<T> Canonicalized<T> { | |||
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | pub(crate) fn unify(tys: &Canonical<(Ty, Ty)>) -> Option<Substs> { | 150 | pub(crate) fn unify(tys: &Canonical<(Ty, Ty)>) -> Option<Substitution> { |
151 | let mut table = InferenceTable::new(); | 151 | let mut table = InferenceTable::new(); |
152 | let vars = Substs( | 152 | let vars = Substitution( |
153 | tys.kinds | 153 | tys.kinds |
154 | .iter() | 154 | .iter() |
155 | // we always use type vars here because we want everything to | 155 | // we always use type vars here because we want everything to |
@@ -173,7 +173,7 @@ pub(crate) fn unify(tys: &Canonical<(Ty, Ty)>) -> Option<Substs> { | |||
173 | } | 173 | } |
174 | } | 174 | } |
175 | Some( | 175 | Some( |
176 | Substs::builder(tys.kinds.len()) | 176 | Substitution::builder(tys.kinds.len()) |
177 | .fill(vars.iter().map(|v| table.resolve_ty_completely(v.clone()))) | 177 | .fill(vars.iter().map(|v| table.resolve_ty_completely(v.clone()))) |
178 | .build(), | 178 | .build(), |
179 | ) | 179 | ) |
@@ -264,8 +264,8 @@ impl InferenceTable { | |||
264 | 264 | ||
265 | pub(crate) fn unify_substs( | 265 | pub(crate) fn unify_substs( |
266 | &mut self, | 266 | &mut self, |
267 | substs1: &Substs, | 267 | substs1: &Substitution, |
268 | substs2: &Substs, | 268 | substs2: &Substitution, |
269 | depth: usize, | 269 | depth: usize, |
270 | ) -> bool { | 270 | ) -> bool { |
271 | substs1.0.iter().zip(substs2.0.iter()).all(|(t1, t2)| self.unify_inner(t1, t2, depth)) | 271 | substs1.0.iter().zip(substs2.0.iter()).all(|(t1, t2)| self.unify_inner(t1, t2, depth)) |