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
(playground)
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)
The following code:
leads to this error:
(playground)
A colleague of mine typed this code, coming with a C++/JavaScript/Kotlin background where parentheses are required in the
forloop 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)