Skip to content
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

Make trait/impl where clause mismatch on region error a bit more actionable #106208

Merged
merged 3 commits into from
Dec 29, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Dec 28, 2022

Improve where clause suggestions for GATs/methods that have incompatible region predicates in their where clauses.

Also addresses this diagnostic that went away #106129 (comment)

@rustbot
Copy link
Collaborator

rustbot commented Dec 28, 2022

r? @estebank

(rustbot has picked a reviewer for you, use r? to override)

@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 Dec 28, 2022
@bors
Copy link
Contributor

bors commented Dec 28, 2022

☔ The latest upstream changes (presumably #106129) made this pull request unmergeable. Please resolve the merge conflicts.

let trait_substs = self
.tcx
.impl_trait_ref(impl_def_id)
.unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have a few unwraps that I'd be more comfortable turning to else { return; };s if possible, but don't care that much either way (it protects users from weird ICEs in the face of broken invariants, but we would still want to know about them, right?)

if is_suggestable {
if trait_predicates.is_empty() {
err.span_suggestion_verbose(
generics.where_clause_span,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding your concern with spaces:

There are two things we could do: change generics.where_clause_span to include the previous spaces, or get the whole item instead of just the generics and do ty.span.to(where_clause_span) to include the space.

Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with whatever nitpicks you want to address

@compiler-errors
Copy link
Member Author

@bors r=estebank

@bors
Copy link
Contributor

bors commented Dec 28, 2022

📌 Commit 6e794dc has been approved by estebank

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 Dec 28, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 29, 2022
…n-err, r=estebank

Make trait/impl `where` clause mismatch on region error a bit more actionable

Improve `where` clause suggestions for GATs/methods that have incompatible region predicates in their `where` clauses.

Also addresses this diagnostic that went away rust-lang#106129 (comment)
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 29, 2022
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#106208 (Make trait/impl `where` clause mismatch on region error a bit more actionable)
 - rust-lang#106216 (Powershell: Use `WaitForExit` instead of `-Wait`)
 - rust-lang#106217 (rustdoc: remove unnecessary `.tooltip::after { text-align: center }`)
 - rust-lang#106218 (Migrate css var scraped examples)
 - rust-lang#106221 (Rename `Rptr` to `Ref` in AST and HIR)
 - rust-lang#106223 (On unsized locals with explicit types suggest `&`)
 - rust-lang#106225 (Remove CraftSpider from review rotation)
 - rust-lang#106229 (update Miri)
 - rust-lang#106242 (Detect diff markers in the parser)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 497d214 into rust-lang:master Dec 29, 2022
@rustbot rustbot added this to the 1.68.0 milestone Dec 29, 2022
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#106208 (Make trait/impl `where` clause mismatch on region error a bit more actionable)
 - rust-lang#106216 (Powershell: Use `WaitForExit` instead of `-Wait`)
 - rust-lang#106217 (rustdoc: remove unnecessary `.tooltip::after { text-align: center }`)
 - rust-lang#106218 (Migrate css var scraped examples)
 - rust-lang#106221 (Rename `Rptr` to `Ref` in AST and HIR)
 - rust-lang#106223 (On unsized locals with explicit types suggest `&`)
 - rust-lang#106225 (Remove CraftSpider from review rotation)
 - rust-lang#106229 (update Miri)
 - rust-lang#106242 (Detect diff markers in the parser)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@compiler-errors compiler-errors deleted the compare-item-region-err branch August 11, 2023 19:57
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