-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Improve docs/clean up negative overlap functions #112605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -365,7 +365,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { | |||
} | |||
|
|||
if !candidate_set.ambiguous && no_candidates_apply { | |||
let trait_ref = stack.obligation.predicate.skip_binder().trait_ref; | |||
let trait_ref = self.infcx.resolve_vars_if_possible( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this because I removed .map(|p| infcx.resolve_vars_if_possible(p))
from above. It's clearer to be resolving when the trait ref is being used, IMO.
#[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(infcx.fork(), o, body_def_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is redundant with the elaborate below.
!equate(&infcx, impl_env, subject1, subject2, obligations, impl1_def_id) | ||
} | ||
|
||
fn equate<'tcx>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I inlined this function because it didn't seem clear why this needed to be a separate method, especially because we invert the bool that it returns.
@bors r+ rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#112584 (loongarch64-none*: Remove environment component from llvm target) - rust-lang#112600 (Introduce a `Stable` trait to translate MIR to SMIR) - rust-lang#112605 (Improve docs/clean up negative overlap functions) - rust-lang#112611 (Error on unconstrained lifetime in RPITIT) - rust-lang#112612 (Fix explicit-outlives-requirements lint span) - rust-lang#112613 (Fix rustdoc-gui tests on Windows) - rust-lang#112620 (Fix small typo) r? `@ghost` `@rustbot` modify labels: rollup
Clean up some functions in ways that should not affect behavior, change some names to be clearer (
negative_impl
andimplicit_negative
are not really clear imo), and add some documentation examples.r? @spastorino