Skip to content

Confusing unreachable pattern error #31221

Closed
@pyfisch

Description

@pyfisch

This simple code fails to compile because Other is not defined. But the error message is unreachable pattern [E0001] Bar => "bar". But Bar is not the cause it just happens to occur after Other.

enum Foobar {
    Foo,
    Bar,
}

fn main() {
    use Foobar::*;
    let x = Foo;
    println!("{}", match x {
        Foo => "foo",
        Other => "other",
        Bar => "bar",
    });
}

http://is.gd/zL6HGt

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions