-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Closed
Copy link
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
Code
pub enum Foo {
X, Y
}
pub fn invert(foo: Foo) -> Foo {
use Foo::*;
match foo {
X => Y.
Y => X,
}
}Current output
error: expected one of `(`, `,`, `.`, `::`, `?`, `}`, or an operator, found `=>`
--> src/lib.rs:12:11
|
12 | Y => X,
| ^^ expected one of 7 possible tokens
warning: unused import: `Foo::*`Desired output
I wish it would have tried error recovery by substituting "," where it saw a ".", which is a reasonable enough typo, so that it could give some kind of hint that maybe the previous line had been intended to be Y, not Y..
Rationale and extra context
No response
Other cases
Rust Version
I don't have rust installed locally, this was 1.86 in the rust playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1eb7427edcf893496f899d59f78ec1ff
Anything else?
No response
ChrisDenton and Scripter17
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.