Skip to content

Commit 2faad3b

Browse files
committed
negative_impl should take a TyCtxt
1 parent 736c675 commit 2faad3b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ fn overlap_within_probe<'cx, 'tcx>(
162162
let infcx = selcx.infcx();
163163

164164
if overlap_mode.use_negative_impl() {
165-
if negative_impl(selcx, impl1_def_id, impl2_def_id)
166-
|| negative_impl(selcx, impl2_def_id, impl1_def_id)
165+
if negative_impl(infcx.tcx, impl1_def_id, impl2_def_id)
166+
|| negative_impl(infcx.tcx, impl2_def_id, impl1_def_id)
167167
{
168168
return None;
169169
}
@@ -279,13 +279,8 @@ fn implicit_negative<'cx, 'tcx>(
279279

280280
/// Given impl1 and impl2 check if both impls are never satisfied by a common type (including
281281
/// where-clauses) If so, return true, they are disjoint and false otherwise.
282-
fn negative_impl<'cx, 'tcx>(
283-
selcx: &mut SelectionContext<'cx, 'tcx>,
284-
impl1_def_id: DefId,
285-
impl2_def_id: DefId,
286-
) -> bool {
282+
fn negative_impl<'tcx>(tcx: TyCtxt<'tcx>, impl1_def_id: DefId, impl2_def_id: DefId) -> bool {
287283
debug!("negative_impl(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id);
288-
let tcx = selcx.infcx().tcx;
289284

290285
// Create an infcx, taking the predicates of impl1 as assumptions:
291286
let infcx = tcx.infer_ctxt().build();

0 commit comments

Comments
 (0)