-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Potentially misleading compiler error for unfinished line with Option<T> #25133
Comments
|
I agree, error messages for wrong function return types should be better. I would expect something like
or something like that. |
Oh.. i actually did not notice it at the beginning. Originally i had this problem in a bit more bigger code block. |
Triage: |
I think the semicolon suggestion we give today is a good start, but indicating that the cause of the expected type is the function's return type would be even better.
|
Before this, the diagnostic errors would only point at the return type when changing it would be a possible solution to a type error. Add a label to the return type without a suggestion to change in order to make the source of the expected type obvious. Follow up to rust-lang#42850, fixes rust-lang#25133, fixes rust-lang#41897.
Point at return type always when type mismatch against it Before this, the diagnostic errors would only point at the return type when changing it would be a possible solution to a type error. Add a label to the return type without a suggestion to change in order to make the source of the expected type obvious. Follow up to #42850, fixes #25133, fixes #41897.
Next code:
Gives this compile error:
Which is a bit misleading as there is actually we're missing either ; or unwrap() i think?
Rust version:
The text was updated successfully, but these errors were encountered: