Skip to content

Display all witnesses for non-exhaustive patterns #16884

Closed
@ghost

Description

Right now it's only one.

enum Direction {
    North,
    East,
    South,
    West
}

fn reverse(dir: Direction) -> Direction {
    match dir {
        North => South,
        East => West
    }
}

fn main() { }
<anon>:9:5: 12:6 error: non-exhaustive patterns: `South` not covered [E0004]
<anon>:9     match dir {
<anon>:10         North => South,
<anon>:11         East => West
<anon>:12     }
error: aborting due to previous error

Ideally, it'd be with some reasonable limit (10?).

Metadata

Metadata

Assignees

No one assigned

    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