-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Unclear error message for E0283 #45453
Comments
The function signature itself is perfectly valid, you can even call it, e.g. |
…nkfelix On E0283, point at method with the requirements On required type annotation diagnostic error, point at method with the requirements if the span is available. CC rust-lang#45453.
It should refer to |
I'm unsure that it's the same issue, but (as a relative newcomer to Rust) I was also confused by:
Perhaps it would be helpful for the error message to suggest at least the syntax required, something like:
Even if it can't determine the specific type to annotate; which, in this case, seems to be the unit type:
|
Current output:
For the last comment, the output is:
I believe we give enough context now. We do not take a guess at what could be a reasonable type for the turbofish |
Code:
Error:
The error is actually caused by the function declaration (it was not supposed to have generic parameters), but without looking at the function it's impossible to understand the message. The error message should show signature of
func1
and say that type annotation is required forT
argument offunc1
.By the way, is there a reason
func1
doesn't trigger a warning by itself? I imagine there may be cases where you want functions with unbound type parameters, but I'm not sure about that.The text was updated successfully, but these errors were encountered: