Skip to content

Commit b47bcc2

Browse files
committed
fix other cases of registering obligations in a snapshot
No test cases for these ones, but they would all ICE if they ever run with a non-empty set of obligations.
1 parent e002634 commit b47bcc2

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/librustc_typeck/check/coercion.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
883883
return self.commit_if_ok(|_| {
884884
self.at(cause, self.param_env)
885885
.lub(prev_ty, new_ty)
886-
.map(|ok| self.register_infer_ok_obligations(ok))
887-
});
886+
}).map(|ok| self.register_infer_ok_obligations(ok));
888887
}
889888
}
890889

@@ -897,8 +896,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
897896
self.commit_if_ok(|_| {
898897
self.at(cause, self.param_env)
899898
.lub(prev_ty, new_ty)
900-
.map(|ok| self.register_infer_ok_obligations(ok))
901-
})
899+
}).map(|ok| self.register_infer_ok_obligations(ok))
902900
}
903901
}
904902
Ok(ok) => {

src/librustc_typeck/check/regionck.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1815,12 +1815,12 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> {
18151815
// check whether this predicate applies to our current projection
18161816
let cause = self.fcx.misc(span);
18171817
match self.at(&cause, self.fcx.param_env).eq(outlives.0, ty) {
1818-
Ok(ok) => {
1819-
self.register_infer_ok_obligations(ok);
1820-
Ok(outlives.1)
1821-
}
1822-
Err(_) => { Err(()) }
1818+
Ok(ok) => Ok((ok, outlives.1)),
1819+
Err(_) => Err(())
18231820
}
1821+
}).map(|(ok, result)| {
1822+
self.register_infer_ok_obligations(ok);
1823+
result
18241824
});
18251825

18261826
debug!("projection_bounds: region_result={:?}",

0 commit comments

Comments
 (0)