remove commit_unconditionally
This commit is contained in:
@@ -813,18 +813,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||||||
self.inner.borrow_mut().commit(undo_snapshot);
|
self.inner.borrow_mut().commit(undo_snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Executes `f` and commit the bindings.
|
|
||||||
#[instrument(skip(self, f), level = "debug")]
|
|
||||||
pub fn commit_unconditionally<R, F>(&self, f: F) -> R
|
|
||||||
where
|
|
||||||
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> R,
|
|
||||||
{
|
|
||||||
let snapshot = self.start_snapshot();
|
|
||||||
let r = f(&snapshot);
|
|
||||||
self.commit_from(snapshot);
|
|
||||||
r
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Execute `f` and commit the bindings if closure `f` returns `Ok(_)`.
|
/// Execute `f` and commit the bindings if closure `f` returns `Ok(_)`.
|
||||||
#[instrument(skip(self, f), level = "debug")]
|
#[instrument(skip(self, f), level = "debug")]
|
||||||
pub fn commit_if_ok<T, E, F>(&self, f: F) -> Result<T, E>
|
pub fn commit_if_ok<T, E, F>(&self, f: F) -> Result<T, E>
|
||||||
|
|||||||
@@ -737,7 +737,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
|||||||
F: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
|
F: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
|
||||||
G: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
|
G: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
|
||||||
{
|
{
|
||||||
self.commit_unconditionally(|snapshot| {
|
self.commit_if_ok(|snapshot| {
|
||||||
let result = if let ty::FnPtr(fn_ty_b) = b.kind()
|
let result = if let ty::FnPtr(fn_ty_b) = b.kind()
|
||||||
&& let (hir::Unsafety::Normal, hir::Unsafety::Unsafe) =
|
&& let (hir::Unsafety::Normal, hir::Unsafety::Unsafe) =
|
||||||
(fn_ty_a.unsafety(), fn_ty_b.unsafety())
|
(fn_ty_a.unsafety(), fn_ty_b.unsafety())
|
||||||
|
|||||||
Reference in New Issue
Block a user