diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 3cf2959a9ff..8dd96934510 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -162,8 +162,8 @@ fn overlap_within_probe<'cx, 'tcx>( let infcx = selcx.infcx(); if overlap_mode.use_negative_impl() { - if negative_impl(selcx, impl1_def_id, impl2_def_id) - || negative_impl(selcx, impl2_def_id, impl1_def_id) + if negative_impl(infcx.tcx, impl1_def_id, impl2_def_id) + || negative_impl(infcx.tcx, impl2_def_id, impl1_def_id) { return None; } @@ -279,13 +279,8 @@ fn implicit_negative<'cx, 'tcx>( /// Given impl1 and impl2 check if both impls are never satisfied by a common type (including /// where-clauses) If so, return true, they are disjoint and false otherwise. -fn negative_impl<'cx, 'tcx>( - selcx: &mut SelectionContext<'cx, 'tcx>, - impl1_def_id: DefId, - impl2_def_id: DefId, -) -> bool { +fn negative_impl<'tcx>(tcx: TyCtxt<'tcx>, impl1_def_id: DefId, impl2_def_id: DefId) -> bool { debug!("negative_impl(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id); - let tcx = selcx.infcx().tcx; // Create an infcx, taking the predicates of impl1 as assumptions: let infcx = tcx.infer_ctxt().build();