Skip to content
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

=> to = typo in match arm results in lots of parse errors #89396

Closed
estebank opened this issue Sep 30, 2021 · 1 comment · Fixed by #89487
Closed

=> to = typo in match arm results in lots of parse errors #89396

estebank opened this issue Sep 30, 2021 · 1 comment · Fixed by #89487
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

A typo of => to = in a match arm currently results in a lot of cascading errors.

error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `=>`, `if`, `{`, or `|`, found `=`
   --> compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs:244:39
    |
244 |             SelectionError::Ambiguous = {
    |                                       ^ expected one of 10 possible tokens

We should gracefully handle some cases like > and = instead of => if followed by a { in a match arm.

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. labels Sep 30, 2021
@SkiFire13
Copy link
Contributor

-> is also a common case that could be handled better

Manishearth added a commit to Manishearth/rust that referenced this issue Oct 5, 2021
…nkov

Try to recover from a `=>` -> `=` or `->` typo in a match arm

Fixes rust-lang#89396.
Manishearth added a commit to Manishearth/rust that referenced this issue Oct 5, 2021
…nkov

Try to recover from a `=>` -> `=` or `->` typo in a match arm

Fixes rust-lang#89396.
Manishearth added a commit to Manishearth/rust that referenced this issue Oct 5, 2021
…nkov

Try to recover from a `=>` -> `=` or `->` typo in a match arm

Fixes rust-lang#89396.
@bors bors closed this as completed in 90e96f9 Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants