Closed
Description
fn main() {
let _ = || {
if true {
true
} else {
false
} // Whoops, forgot a semicolon!
false
};
}
Gives the error:
error[E0308]: mismatched types
--> src/main.rs:4:13
|
1 | fn main() {
| - expected `()` because of default return type
...
4 | true
| ^^^^ expected (), found bool
|
= note: expected type `()`
found type `bool`
The return type of main
is referenced, which is wrong — but really the problem is that there are two consecutive expressions that are not separated by a semicolon. It would be good to have an improvement in either respect, though.