-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Typoing "." instead of "," in a match produces confusing error messages #140991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hm, it's interesting because it have recovery from ";" 11 | X => Y;
| -- ^ this statement is not surrounded by a body
| |
| while parsing the `match` arm starting here
|
help: replace `;` with `,` to end a `match` arm expression
|
11 - X => Y;
11 + X => Y, I will look into it |
emm, so sorry that I didn't notice you had a comment to take it. |
No worries at all — glad you took a shot at it! Just for context: the tricky part here is that Oh, you already fixed it and it seems more easy than I thought, heh |
I think we might don't need to recover here, parser sometimes don't have enough context for a perfect recovery. giving proper suggestion will be good for users. |
…, r=wesleywiser Fix the issue of typo of comma in arm parsing Fixes rust-lang#140991 I also checked is it a '/', since it's near from ',' from keyboard.
Uh oh!
There was an error while loading. Please reload this page.
Code
Current output
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,
notY.
.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
The text was updated successfully, but these errors were encountered: