From 3e48434cc7041ac7c136d7bd1e7cadc3521f8abc Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 26 Jul 2022 04:01:34 +0000 Subject: [PATCH] Use ObligationCtxt in impossible_predicates --- .../rustc_trait_selection/src/traits/mod.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 8e1fa956fd6..b8cbfcb8b79 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -427,20 +427,13 @@ pub fn impossible_predicates<'tcx>( infcx.set_tainted_by_errors(); let param_env = ty::ParamEnv::reveal_all(); - let mut selcx = SelectionContext::new(&infcx); - let mut fulfill_cx = FulfillmentContext::new(); - let cause = ObligationCause::dummy(); - let Normalized { value: predicates, obligations } = - normalize(&mut selcx, param_env, cause.clone(), predicates); - for obligation in obligations { - fulfill_cx.register_predicate_obligation(&infcx, obligation); - } + let ocx = ObligationCtxt::new(&infcx); + let predicates = ocx.normalize(ObligationCause::dummy(), param_env, predicates); for predicate in predicates { - let obligation = Obligation::new(cause.clone(), param_env, predicate); - fulfill_cx.register_predicate_obligation(&infcx, obligation); + let obligation = Obligation::new(ObligationCause::dummy(), param_env, predicate); + ocx.register_obligation(obligation); } - - let errors = fulfill_cx.select_all_or_error(&infcx); + let errors = ocx.select_all_or_error(); // Clean up after ourselves let _ = infcx.inner.borrow_mut().opaque_type_storage.take_opaque_types(); -- 2.44.0