-
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
Error explanation for E0308 is incorrect and confusing #76462
Comments
Also the explanation says:
Isn't the most common case passing the wrong type to a function? Usually people do not provide a type annotation to a |
@jyn514 You beat me to it :) |
Also, the diagnostics shown in the code example seem out of date. |
Mentoring instructions: Change |
On it. |
Proposed text:
|
Overall text looks good. Can you open a PR and |
I believe the error message for E0308 is incorrect. Here it is, with my emphasis on the part that seems incorrect:
Isn't this error because the compiler was able to infer the type, but it was not what was expected? For example, in the example provided in the error explanation, the value assigned to
x
is most definitely&str
, andi32
is expected, so the types don't match.@rustbot modify labels: A-diagnostics D-incorrect D-confusing C-bug
The text was updated successfully, but these errors were encountered: