-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve error message on Err
early returns that forgot the return
keyword
#86094
Comments
For the slightly modified case without the
|
That suggestion is a special case of the When a type-mismatch occurs, this checks if the type matches the return type of the surrounding function: rust/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs Lines 514 to 529 in cc9610b
For the 'type annotations needed' lint, I don't think we can apply the same logic. We might also want a similar suggestion for |
@rustbot label +D-confusing +D-newcomer-roadblock |
Current output:
We still don't realize that you probably wanted to |
Rollup merge of rust-lang#115196 - chenyukang:yukang-fix-86094, r=estebank Suggest adding `return` if the for semi which can coerce to the fn return type Fixes rust-lang#86094 r? `@estebank`
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d5eabab7099a911f6bb9e93e9b7a0886
The current output is:
Ideally the output should look like:
The text was updated successfully, but these errors were encountered: