diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2022-11-21 11:26:23 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2022-11-21 11:26:23 -0300 |
| commit | 16c9e39021924216005d823b67aa601950bc2184 (patch) | |
| tree | 7bebc837dd3f26dc52cb111bfeeaa82d5dcb28e2 /compiler/rustc_trait_selection/src/traits | |
| parent | 2faad3b699b7b80b08f4af7cfc67fff097256630 (diff) | |
| download | rust-16c9e39021924216005d823b67aa601950bc2184.tar.gz rust-16c9e39021924216005d823b67aa601950bc2184.zip | |
negative_impl_exists should take an InferCtxt
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/coherence.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 8dd96934510..1ef77e06b48 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -327,11 +327,10 @@ fn equate<'tcx>( return true; }; - let selcx = &mut SelectionContext::new(&infcx); let opt_failing_obligation = obligations .into_iter() .chain(more_obligations) - .find(|o| negative_impl_exists(selcx, o, body_def_id)); + .find(|o| negative_impl_exists(infcx, o, body_def_id)); if let Some(failing_obligation) = opt_failing_obligation { debug!("overlap: obligation unsatisfiable {:?}", failing_obligation); @@ -342,19 +341,19 @@ fn equate<'tcx>( } /// Try to prove that a negative impl exist for the given obligation and its super predicates. -#[instrument(level = "debug", skip(selcx))] -fn negative_impl_exists<'cx, 'tcx>( - selcx: &SelectionContext<'cx, 'tcx>, +#[instrument(level = "debug", skip(infcx))] +fn negative_impl_exists<'tcx>( + infcx: &InferCtxt<'tcx>, o: &PredicateObligation<'tcx>, body_def_id: DefId, ) -> bool { - if resolve_negative_obligation(selcx.infcx().fork(), o, body_def_id) { + if resolve_negative_obligation(infcx.fork(), o, body_def_id) { return true; } // Try to prove a negative obligation exists for super predicates - for o in util::elaborate_predicates(selcx.tcx(), iter::once(o.predicate)) { - if resolve_negative_obligation(selcx.infcx().fork(), &o, body_def_id) { + for o in util::elaborate_predicates(infcx.tcx, iter::once(o.predicate)) { + if resolve_negative_obligation(infcx.fork(), &o, body_def_id) { return true; } } |
