Closed
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`.