Skip to content

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

Closed
@estebank

Description

@estebank

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions