Closed
Description
fn baz() -> impl std::fmt::Display {
if false {
return 0i32;
} else {
1u32
}
}
currently points at the entire if
/else
error[E0308]: mismatched types
--> src/lib.rs:2:5
|
1 | fn baz() -> impl std::fmt::Display {
| ---------------------- expected because this return type...
2 | / if false {
3 | |
4 | | return 0i32;
| | ---- ...is found to be `i32` here
5 | | } else {
6 | | 1u32
7 | | }
| |_____^ expected i32, found u32
|
= note: expected type `i32`
found type `u32`
It should probably point at the else
expression
error[E0308]: mismatched types
--> src/lib.rs:2:5
|
1 | fn baz() -> impl std::fmt::Display {
| ---------------------- expected because this return type...
2 | if false {
3 |
4 | return 0i32;
| ---- ...is found to be `i32` here
5 | } else {
6 | 1u32
| ^^^^ expected i32, found u32
7 | }
|
= note: expected type `i32`
found type `u32`