Point at cause for expectation in return type type error#57723
Point at cause for expectation in return type type error#57723bors merged 7 commits intorust-lang:masterfrom
Conversation
|
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
| | ^^^^ expected i32, found u32 | ||
| | | ||
| = note: expected type `i32` | ||
| found type `u32` |
There was a problem hiding this comment.
Should these errors also point at the impl Trait return type?
There was a problem hiding this comment.
I think they could and that would be a tad better but the errors aren't much worse off for the lack of it.
| | | ||
| LL | fn f(a: isize) -> isize { if god_exists(a) { return 5; }; } | ||
| | - ^^^^^ expected isize, found () - expected because of this statement | ||
| | - ^^^^^ expected isize, found () |
There was a problem hiding this comment.
Yay, drive by fixes :)
davidtwco
left a comment
There was a problem hiding this comment.
LGTM. r=me if you aren't going to make any further changes or improvements relating to the other review comments.
|
@bors r=davidtwco @davidtwco I'll mull on it and maybe have a follow up PR adding that. It should be a fairly small change, but the wording will be tricky to get right. Let's land this as it fixes a regression as well. |
|
📌 Commit 2e06d9c has been approved by |
Point at cause for expectation in return type type error Various improvements and fixes for type errors in return expressions. Fix rust-lang#57664.
Various improvements and fixes for type errors in return expressions.
Fix #57664.