-
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
Confusing error "trait is not implemented for the type" on syntax error #24354
Comments
I'm not really sure what the compiler can do here, as there is both a type parameter and a type named |
I believe this should be closed, the new error messages give a good explanation of what is happening. |
Today we give the following; ideally I think we would have a span on
|
Related to #47319. Once that ticket is fixed, pointing at |
…asper Use structured suggestion for restricting bounds When a trait bound is not met and restricting a type parameter would make the restriction hold, use a structured suggestion pointing at an appropriate place (type param in param list or `where` clause). Account for opaque parameters where instead of suggesting extending the `where` clause, we suggest appending the new restriction: `fn foo(impl Trait + UnmetTrait)`. Fix rust-lang#64565, fix rust-lang#41817, fix rust-lang#24354, cc rust-lang#26026, cc rust-lang#37808, cc rust-lang#24159, fix rust-lang#37138, fix rust-lang#24354, cc rust-lang#20671.
This code:
...give me this error:
This is confusing. The trait
B
is implemented for the typeBImpl
.Instead, I have to change this:
...into this:
The error should make that clear.
The text was updated successfully, but these errors were encountered: