Closed
Description
Given the following code:
fn bar() -> [u8; 2] {
foo() // missing semicolon
[1, 2]
}
The current output is:
error: expected one of `.`, `?`, `]`, or an operator, found `,
--> src/lib.rs:6:7
|
6 | [1, 2]
| ^ expected one of `.`, `?`, `]`, or an operator
This is very confusing unless you notice the missing semicolon. The error message should mention that foo()[1, 2]
is interpreted as an indexing expression, with something like "error when parsing index expression".