diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index b3dc2e586d2..a551abf58d1 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -813,18 +813,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { self.inner.borrow_mut().commit(undo_snapshot); } - /// Executes `f` and commit the bindings. - #[instrument(skip(self, f), level = "debug")] - pub fn commit_unconditionally(&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(_)`. #[instrument(skip(self, f), level = "debug")] pub fn commit_if_ok(&self, f: F) -> Result diff --git a/compiler/rustc_typeck/src/check/coercion.rs b/compiler/rustc_typeck/src/check/coercion.rs index 9c9a2096ae9..0a61674517b 100644 --- a/compiler/rustc_typeck/src/check/coercion.rs +++ b/compiler/rustc_typeck/src/check/coercion.rs @@ -737,7 +737,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { F: FnOnce(Ty<'tcx>) -> Vec>, G: FnOnce(Ty<'tcx>) -> Vec>, { - self.commit_unconditionally(|snapshot| { + self.commit_if_ok(|snapshot| { let result = if let ty::FnPtr(fn_ty_b) = b.kind() && let (hir::Unsafety::Normal, hir::Unsafety::Unsafe) = (fn_ty_a.unsafety(), fn_ty_b.unsafety())