diff options
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 539e12420..d872cdd58 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -307,12 +307,12 @@ impl<'a> InferenceTable<'a> { | |||
307 | /// Unify two types and register new trait goals that arise from that. | 307 | /// Unify two types and register new trait goals that arise from that. |
308 | // TODO give these two functions better names | 308 | // TODO give these two functions better names |
309 | pub(crate) fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool { | 309 | pub(crate) fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool { |
310 | let _result = if let Ok(r) = self.unify_inner(ty1, ty2) { | 310 | let result = if let Ok(r) = self.unify_inner(ty1, ty2) { |
311 | r | 311 | r |
312 | } else { | 312 | } else { |
313 | return false; | 313 | return false; |
314 | }; | 314 | }; |
315 | // TODO deal with new goals | 315 | self.register_infer_ok(result); |
316 | true | 316 | true |
317 | } | 317 | } |
318 | 318 | ||
@@ -327,10 +327,7 @@ impl<'a> InferenceTable<'a> { | |||
327 | t1, | 327 | t1, |
328 | t2, | 328 | t2, |
329 | ) { | 329 | ) { |
330 | Ok(_result) => { | 330 | Ok(result) => Ok(InferOk { goals: result.goals }), |
331 | // TODO deal with new goals | ||
332 | Ok(InferOk {}) | ||
333 | } | ||
334 | Err(chalk_ir::NoSolution) => Err(TypeError), | 331 | Err(chalk_ir::NoSolution) => Err(TypeError), |
335 | } | 332 | } |
336 | } | 333 | } |
@@ -353,6 +350,10 @@ impl<'a> InferenceTable<'a> { | |||
353 | } | 350 | } |
354 | } | 351 | } |
355 | 352 | ||
353 | pub fn register_infer_ok(&mut self, infer_ok: InferOk) { | ||
354 | infer_ok.goals.into_iter().for_each(|goal| self.register_obligation_in_env(goal)); | ||
355 | } | ||
356 | |||
356 | pub fn resolve_obligations_as_possible(&mut self) { | 357 | pub fn resolve_obligations_as_possible(&mut self) { |
357 | let _span = profile::span("resolve_obligations_as_possible"); | 358 | let _span = profile::span("resolve_obligations_as_possible"); |
358 | let mut changed = true; | 359 | let mut changed = true; |