Closed
Description
Can you spot the mistake?
fn main() {
let x = 1;
let y = 2;
let value = 3;
match value {
Some(x) if x == y {
self.next_token()?;
Ok(true)
},
_ => {
Ok(false)
}
}
}
Errors:
Compiling playground v0.0.1 (/playground)
error: expected identifier, found keyword `self`
--> src/main.rs:8:13
|
7 | Some(x) if x == y {
| - while parsing this struct
8 | self.next_token()?;
| ^^^^ expected identifier, found keyword
error: expected one of `.`, `=>`, `?`, or an operator, found `,`
--> src/main.rs:10:10
|
10 | },
| ^ expected one of `.`, `=>`, `?`, or an operator
error: aborting due to 2 previous errors
error: could not compile `playground`.
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint that should be reworked.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.