-
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 lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTT-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
Code
pub fn foo() {
let v = v?
while let Ok(_) = v {};
}
Current output
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `;`
--> src/main.rs:4:25
|
4 | while let Ok(_) = v {};
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
Desired output
error: expected `;`, found `while`
--> src/main.rs:4:25
|
3 | let v = v?
| ^ help: add ';' here
Rationale and extra context
Confusing error
Other cases
Removing the semicolon as suggested causes
error: expected `;`, found `}`
--> src/main.rs:4:25
|
4 | while let Ok(_) = v {}
| ^ help: add `;` here
5 | }
| - unexpected token
error[E0425]: cannot find value `v` in this scope
--> src/main.rs:3:11
|
3 | let v = v?
| ^ not found in this scope
For more information about this error, try `rustc --explain E0425`.
Anything else?
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTT-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.