Skip to content

Error message for non-exhaustive pattern only shows part of missing case #4321

Closed
@lkuper

Description

@lkuper

Attempting to compile this program:

fn main() {
    let tup = (true, true);
    io::println(
        match tup {
            (false, false) => "foo",
            (false, true) => "bar",
            (true, true) => "baz"
        }
    );
}

raises the following error:

foo.rs:30:8: 34:9 error: non-exhaustive patterns: false not covered
foo.rs:30         match tup {
foo.rs:31             (false, false) => "foo",
foo.rs:32             (false, true) => "bar",
foo.rs:33             (true, true) => "baz"
foo.rs:34         }

Instead of false not covered, the error should be (true, false) not covered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-type-systemArea: Type systemE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions