Account for tail expressions when pointing at return type
When there's a type mismatch we make an effort to check if it was caused by a function's return type. This logic now makes sure to only point at the return type if the error happens in a tail expression.
This commit is contained in:
parent
faee8e1756
commit
46a38dc183
4 changed files with 31 additions and 7 deletions
|
|
@ -49,9 +49,6 @@ LL | if x == E::V { field } {}
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/struct-literal-variant-in-if.rs:10:20
|
||||
|
|
||||
LL | fn test_E(x: E) {
|
||||
| - help: try adding a return type: `-> bool`
|
||||
LL | let field = true;
|
||||
LL | if x == E::V { field } {}
|
||||
| ^^^^^ expected (), found bool
|
||||
|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue