-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Suggest adding a type parameter for impls #85041
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
help: a struct with a similar name exists | ||
| | ||
LL | impl Foo for A<A> {} | ||
| ^ |
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.
We should likely filter cases like these, where we suggest the same type we are evaluating, but single letter structs should be uncommon enough that it isn't a problem in practice.
@bors r+ |
📌 Commit 4c72efc has been approved by |
☀️ Test successful - checks-actions |
Add a new suggestion upon encountering an unknown type in a
impl
that suggests adding a new type parameter. This diagnostic suggests to add a new type parameter even though it may be a const parameter, however after adding the parameter and running rustc again a follow up error steers the user to change the type parameter to a const parameter.suggests
After adding a type parameter the code now becomes
and the error now fully steers the user towards the correct code
r? @estebank
Somewhat related #84946