Closed
Description
The following code:
fn main() {
let v = vec![1,2,3];
for (x in v) { }
}
leads to this error:
error: expected one of `)`, `,`, or `@`, found `in`
--> src/main.rs:4:12
|
4 | for (x in v) { }
| ^^ expected one of `)`, `,`, or `@` here
A colleague of mine typed this code, coming with a C++/JavaScript/Kotlin background where parentheses are required in the for
loop head.
I wonder if it’s possible/worth it to make that error message nicer and easier to understand. (@estebank asked me to file this issue, so it doesn't get lost)
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTArea: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.