Skip to content

Conversation

compiler-errors
Copy link
Member

Clean up some functions in ways that should not affect behavior, change some names to be clearer (negative_impl and implicit_negative are not really clear imo), and add some documentation examples.

r? @spastorino

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 14, 2023
@@ -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(
Copy link
Member Author

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) {
Copy link
Member Author

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>(
Copy link
Member Author

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.

@spastorino
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 14, 2023

📌 Commit 9e21052 has been approved by spastorino

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 14, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 14, 2023
…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
@bors bors merged commit 7240943 into rust-lang:master Jun 14, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 14, 2023
@compiler-errors compiler-errors deleted the negative-docs branch August 11, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants