diff options
| author | kadmin <julianknodt@gmail.com> | 2022-12-04 19:58:03 +0000 |
|---|---|---|
| committer | kadmin <julianknodt@gmail.com> | 2023-01-09 08:41:21 +0000 |
| commit | abe040d876f697ef86b1ad395caf68c03ecbf046 (patch) | |
| tree | 4ce6a171da739b7492ac1b007f328b040ff9ad7e /compiler/rustc_trait_selection/src | |
| parent | 2e677c0645862d17a12c6d04b3019203c8e23fcc (diff) | |
| download | rust-abe040d876f697ef86b1ad395caf68c03ecbf046.tar.gz rust-abe040d876f697ef86b1ad395caf68c03ecbf046.zip | |
Change commit_if_ok to probe
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/const_evaluatable.rs | 11 |
1 files changed, 3 insertions, 8 deletions
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<Self::BreakTy> { 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() { |
