diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-04-15 23:55:10 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-04-15 23:55:10 +0300 |
| commit | e56b119bac1ded9396e97f8326f6b0567935ca31 (patch) | |
| tree | de3f7c6e1dfb46dea46270137e51630d2c095f90 | |
| parent | 99f5c8593b1778947830d1da580c55b70680b919 (diff) | |
rustc_typeck: keep register_infer_ok_obligations calls out of snapshots.
| -rw-r--r-- | src/librustc_typeck/check/coercion.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 2e9057800a5..c6a1f6cfc0d 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -711,16 +711,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let cause = self.cause(expr.span, ObligationCauseCode::ExprAssignable); let coerce = Coerce::new(self, cause); - self.commit_if_ok(|_| { - let ok = coerce.coerce(&[expr], source, target)?; - let adjustment = self.register_infer_ok_obligations(ok); - self.apply_adjustment(expr.id, adjustment); - - // We should now have added sufficient adjustments etc to - // ensure that the type of expression, post-adjustment, is - // a subtype of target. - Ok(target) - }) + let ok = self.commit_if_ok(|_| coerce.coerce(&[expr], source, target))?; + + let adjustment = self.register_infer_ok_obligations(ok); + self.apply_adjustment(expr.id, adjustment); + + // We should now have added sufficient adjustments etc to + // ensure that the type of expression, post-adjustment, is + // a subtype of target. + Ok(target) } /// Given some expressions, their known unified type and another expression, |
