-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Point to where clause for GATs to add bound #87478
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #87948) made this pull request unmergeable. Please resolve the merge conflicts. |
if !generics.where_clause.predicates.is_empty() { "," } else { " where" }, | ||
pred, | ||
); | ||
err.span_suggestion( |
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.
Let's make the suggestion a bit easier to read, given that it points at a span right in the middle of a larger span:
err.span_suggestion( | |
err.span_suggestion_verbose( |
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.
Although that would require rewording the other span label...
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 leave it to your decision what to do here.
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.
So, now that the associated type points to the type itself, not the whole defintion, they don't overlap anymore.
I do think the verbose suggestion would be nice, but I'll leave that as a followup.
@@ -0,0 +1,40 @@ | |||
#![feature(generic_associated_types)] |
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.
Can we mark the tests // run-rustfix
?
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.
So...no. The suggestion here doesn't actually result in code that compiles, because it causes the where clauses not to match the trait's where clauses. (In fact, in this case, we can't write this where clause in the trait, we would have to use Self
)
Unfortunately, that's a whole separate issue with GATs. But applying the current suggestion should help, in the future, to guide the user towards matching the trait's where clauses.
r=me after cleaning up the commented out code. |
@bors r=estebank |
📌 Commit 22fc7d6 has been approved by |
☀️ Test successful - checks-actions |
Fixes #84931
r? @estebank