-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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.
AbdillahExpHP and oli-obk
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.