-
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 ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-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
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.
lcnr, msrd0 and LuckyTurtleDev
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 ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-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.