Skip to content

Multiple errors on single typo in match pattern #52717

Closed
@estebank

Description

@estebank

With a single typo in a match arm, we generate three separate errors:

error[E0425]: cannot find value `func` in this scope
   --> 
    |
125 |       Target::Match { ref attr, ref fung} => func.apply(&value, &attr.value)?,
    |                                              ^^^^ did you mean `fung`?

error[E0026]: variant `internal::Target::Match` does not have a field named `fung`
   -->
    |
125 |       Target::Match { ref attr, ref fung} => func.apply(&value, &attr.value)?,
    |                                 ^^^^^^^^ variant `internal::Target::Match` does not have this field

error[E0027]: pattern does not mention field `func`
   -->
    |
125 |       Target::Match { ref attr, ref fung} => func.apply(&value, &attr.value)?,
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `func`

We should collect all these errors into a single diagnostic:

error[E0026]: variant `internal::Target::Match` does not have a field named `fung`
   -->
    |
125 |       Target::Match { ref attr, ref fung} => func.apply(&value, &attr.value)?,
    |                                 ^^^^^^^^
    |                                 |
    |                                 variant `internal::Target::Match` does not have this field
    |                                 help: did you mean: `func`

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions