Skip to content

Be clearer on type mismatch within a range #57389

Closed
@estebank

Description

@estebank

When matching on a range between two values of different type we currently emit the following output:

error[E0308]: mismatched types
  --> $DIR/E0308-4.rs:4:9
   |
LL |         0u8..=3i8 => (), //~ ERROR E0308
   |         ^^^^^^^^^ expected u8, found i8

We should have a more targeted error:

error[E0308]: mismatched types
  --> $DIR/E0308-4.rs:4:9
   |
LL |         0u8..=3i8 => (), //~ ERROR E0308
   |         ---   ^^^ expected u8, found i8
   |         |
   |         expected because of this

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.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