Skip to content

Matching on a function causes "found structure or enum pattern" #12863

Closed
@huonw

Description

@huonw
mod foo { pub fn bar() {} }
fn main() {
    match () {
        foo::bar => {}
    }
}
function-match.rs:4:9: 4:17 error: mismatched types: expected `()` but found an enum or structure pattern
function-match.rs:4         foo::bar => {}
                            ^~~~~~~~

This should be complaining about mismatched types.

(The module is necessary to force the compiler search/use the function; with just bar => {} it takes bar to be a variable binding.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions