Skip to content

Commit e56b119

Browse files
committed
rustc_typeck: keep register_infer_ok_obligations calls out of snapshots.
1 parent 99f5c85 commit e56b119

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/librustc_typeck/check/coercion.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -711,16 +711,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
711711

712712
let cause = self.cause(expr.span, ObligationCauseCode::ExprAssignable);
713713
let coerce = Coerce::new(self, cause);
714-
self.commit_if_ok(|_| {
715-
let ok = coerce.coerce(&[expr], source, target)?;
716-
let adjustment = self.register_infer_ok_obligations(ok);
717-
self.apply_adjustment(expr.id, adjustment);
718-
719-
// We should now have added sufficient adjustments etc to
720-
// ensure that the type of expression, post-adjustment, is
721-
// a subtype of target.
722-
Ok(target)
723-
})
714+
let ok = self.commit_if_ok(|_| coerce.coerce(&[expr], source, target))?;
715+
716+
let adjustment = self.register_infer_ok_obligations(ok);
717+
self.apply_adjustment(expr.id, adjustment);
718+
719+
// We should now have added sufficient adjustments etc to
720+
// ensure that the type of expression, post-adjustment, is
721+
// a subtype of target.
722+
Ok(target)
724723
}
725724

726725
/// Given some expressions, their known unified type and another expression,

0 commit comments

Comments
 (0)