From abe040d876f697ef86b1ad395caf68c03ecbf046 Mon Sep 17 00:00:00 2001 From: kadmin Date: Sun, 4 Dec 2022 19:58:03 +0000 Subject: Change commit_if_ok to probe --- .../rustc_trait_selection/src/traits/const_evaluatable.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'compiler/rustc_trait_selection/src') diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index f8efe9bfa9f..f449d360c16 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -173,16 +173,11 @@ fn satisfied_from_param_env<'tcx>( type BreakTy = (); fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow { debug!("is_const_evaluatable: candidate={:?}", c); - if let Ok(()) = self.infcx.commit_if_ok(|_| { + if self.infcx.probe(|_| { let ocx = ObligationCtxt::new_in_snapshot(self.infcx); - if let Ok(()) = ocx.eq(&ObligationCause::dummy(), self.param_env, c.ty(), self.ct.ty()) - && let Ok(()) = ocx.eq(&ObligationCause::dummy(), self.param_env, c, self.ct) + ocx.eq(&ObligationCause::dummy(), self.param_env, c.ty(), self.ct.ty()).is_ok() + && ocx.eq(&ObligationCause::dummy(), self.param_env, c, self.ct).is_ok() && ocx.select_all_or_error().is_empty() - { - Ok(()) - } else { - Err(()) - } }) { ControlFlow::BREAK } else if let ty::ConstKind::Expr(e) = c.kind() { -- cgit 1.4.1-3-g733a5