Skip to content

Error for unknown variant talks about associated items #28972

Closed
@Manishearth

Description

@Manishearth
enum Foo {
 Bar(u8), Baz(u8)
}

fn main() {
    match Foo::Bar(1) {
        Foo::Quux(..) =>(),
        _ => ()
    }
}

(playpen)

Currently gives the error message:

<anon>:7:9: 7:22 error: no associated item named `Quux` found for type `Foo` in the current scope
<anon>:7         Foo::Quux(..) =>(),

This should be "no associated item or variant", or perhaps just "no variant" (if we can detect that its in a match statement)

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.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions