Skip to content

Commit 16c9e39

Browse files
committed
negative_impl_exists should take an InferCtxt
1 parent 2faad3b commit 16c9e39

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,10 @@ fn equate<'tcx>(
327327
return true;
328328
};
329329

330-
let selcx = &mut SelectionContext::new(&infcx);
331330
let opt_failing_obligation = obligations
332331
.into_iter()
333332
.chain(more_obligations)
334-
.find(|o| negative_impl_exists(selcx, o, body_def_id));
333+
.find(|o| negative_impl_exists(infcx, o, body_def_id));
335334

336335
if let Some(failing_obligation) = opt_failing_obligation {
337336
debug!("overlap: obligation unsatisfiable {:?}", failing_obligation);
@@ -342,19 +341,19 @@ fn equate<'tcx>(
342341
}
343342

344343
/// Try to prove that a negative impl exist for the given obligation and its super predicates.
345-
#[instrument(level = "debug", skip(selcx))]
346-
fn negative_impl_exists<'cx, 'tcx>(
347-
selcx: &SelectionContext<'cx, 'tcx>,
344+
#[instrument(level = "debug", skip(infcx))]
345+
fn negative_impl_exists<'tcx>(
346+
infcx: &InferCtxt<'tcx>,
348347
o: &PredicateObligation<'tcx>,
349348
body_def_id: DefId,
350349
) -> bool {
351-
if resolve_negative_obligation(selcx.infcx().fork(), o, body_def_id) {
350+
if resolve_negative_obligation(infcx.fork(), o, body_def_id) {
352351
return true;
353352
}
354353

355354
// Try to prove a negative obligation exists for super predicates
356-
for o in util::elaborate_predicates(selcx.tcx(), iter::once(o.predicate)) {
357-
if resolve_negative_obligation(selcx.infcx().fork(), &o, body_def_id) {
355+
for o in util::elaborate_predicates(infcx.tcx, iter::once(o.predicate)) {
356+
if resolve_negative_obligation(infcx.fork(), &o, body_def_id) {
358357
return true;
359358
}
360359
}

0 commit comments

Comments
 (0)