diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-03 14:02:23 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-03 14:02:23 +0000 |
commit | 15f143f0c33cbd382a2ad7a407d9601cb843d164 (patch) | |
tree | 0a357e2d3333a06e37f5cb8d6613733c1c0c78ac /crates/ra_hir_ty/src/infer/unify.rs | |
parent | ba4f7fa02f746e5bb3efdaa06c2b35beaa4e3440 (diff) | |
parent | e4add45951511f9afe348bf6066a724deb0d3ccf (diff) |
Merge #2468
2468: Fix #2467 r=flodiebold a=flodiebold
The stand-alone `unify` requires that the type doesn't contain any type
variables. So we can't share the code here for now (without more refactoring)...
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/infer/unify.rs')
-rw-r--r-- | crates/ra_hir_ty/src/infer/unify.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_hir_ty/src/infer/unify.rs b/crates/ra_hir_ty/src/infer/unify.rs index 8ed2a6090..fe05642ae 100644 --- a/crates/ra_hir_ty/src/infer/unify.rs +++ b/crates/ra_hir_ty/src/infer/unify.rs | |||
@@ -167,12 +167,12 @@ impl<T> Canonicalized<T> { | |||
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | pub fn unify(ty1: Canonical<&Ty>, ty2: &Ty) -> Option<Substs> { | 170 | pub fn unify(ty1: &Canonical<Ty>, ty2: &Canonical<Ty>) -> Option<Substs> { |
171 | let mut table = InferenceTable::new(); | 171 | let mut table = InferenceTable::new(); |
172 | let vars = | 172 | let vars = |
173 | Substs::builder(ty1.num_vars).fill(std::iter::repeat_with(|| table.new_type_var())).build(); | 173 | Substs::builder(ty1.num_vars).fill(std::iter::repeat_with(|| table.new_type_var())).build(); |
174 | let ty_with_vars = ty1.value.clone().subst_bound_vars(&vars); | 174 | let ty_with_vars = ty1.value.clone().subst_bound_vars(&vars); |
175 | if !table.unify(&ty_with_vars, ty2) { | 175 | if !table.unify(&ty_with_vars, &ty2.value) { |
176 | return None; | 176 | return None; |
177 | } | 177 | } |
178 | Some( | 178 | Some( |