-
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 lintsT-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
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".
TaKO8Ki
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.