Skip to content

Commit 3e48434

Browse files
Use ObligationCtxt in impossible_predicates
1 parent 61d9b16 commit 3e48434

File tree

1 file changed

+5
-12
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+5
-12
lines changed

compiler/rustc_trait_selection/src/traits/mod.rs

+5-12
Original file line numberDiff line numberDiff line change
@@ -427,20 +427,13 @@ pub fn impossible_predicates<'tcx>(
427427
infcx.set_tainted_by_errors();
428428

429429
let param_env = ty::ParamEnv::reveal_all();
430-
let mut selcx = SelectionContext::new(&infcx);
431-
let mut fulfill_cx = FulfillmentContext::new();
432-
let cause = ObligationCause::dummy();
433-
let Normalized { value: predicates, obligations } =
434-
normalize(&mut selcx, param_env, cause.clone(), predicates);
435-
for obligation in obligations {
436-
fulfill_cx.register_predicate_obligation(&infcx, obligation);
437-
}
430+
let ocx = ObligationCtxt::new(&infcx);
431+
let predicates = ocx.normalize(ObligationCause::dummy(), param_env, predicates);
438432
for predicate in predicates {
439-
let obligation = Obligation::new(cause.clone(), param_env, predicate);
440-
fulfill_cx.register_predicate_obligation(&infcx, obligation);
433+
let obligation = Obligation::new(ObligationCause::dummy(), param_env, predicate);
434+
ocx.register_obligation(obligation);
441435
}
442-
443-
let errors = fulfill_cx.select_all_or_error(&infcx);
436+
let errors = ocx.select_all_or_error();
444437

445438
// Clean up after ourselves
446439
let _ = infcx.inner.borrow_mut().opaque_type_storage.take_opaque_types();

0 commit comments

Comments
 (0)