Closed
Description
I tried this code:
fn main() {
let x = 5
()
}
I expected to see this happen:
error: expected `;`, found `}`
--> src/main.rs:2:14
|
2 | let x = 5
| ^ help: add `;` here
3 | }
| - unexpected token
One error occurs from the missing semicolon.
Instead, this happened:
error: expected `;`, found `}`
--> src/main.rs:4:7
|
4 | ()
| ^ help: add `;` here
5 | }
| - unexpected token
error[E0618]: expected function, found `{integer}`
--> src/main.rs:2:13
|
2 | let x = 5
| _____________^
3 | |
4 | | ()
| |______- call expression requires function
An additional unexpected error occurs when when I obviously do not want to invoke a closure. Also note that the semicolon error is after the supposed closure invocation, when I would expect it to be after the let x = 5
.
Meta
Occurs on latest stable and nightly.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: This is a bug.Diagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.