-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Make trait/impl where
clause mismatch on region error a bit more actionable
#106208
Conversation
r? @estebank (rustbot has picked a reviewer for you, use r? to override) |
src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr
Show resolved
Hide resolved
src/test/ui/generic-associated-types/mismatched-where-clause-regions.stderr
Show resolved
Hide resolved
☔ 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() |
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.
you have a few unwrap
s 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, |
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.
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.
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.
r=me with whatever nitpicks you want to address
c649d7e
to
358b871
Compare
358b871
to
6e794dc
Compare
@bors r=estebank |
…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)
…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
…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
Improve
where
clause suggestions for GATs/methods that have incompatible region predicates in theirwhere
clauses.Also addresses this diagnostic that went away #106129 (comment)