Skip to content

[E0532] Error when using functions in patterns should give an explanation of patterns #97200

Closed
@porglezomp

Description

@porglezomp

Given the following code: (Playground)

fn main() {
    let (x, drop(y)) = (1, 2);
}

The current output is:

error[E0532]: expected tuple struct or tuple variant, found function `drop`
 --> src/main.rs:2:13
  |
2 |     let (x, drop(y)) = (1, 2);
  |             ^^^^ not a tuple struct or tuple variant

The error message should give/link to an explanation of what kinds of things are expected in patterns in general, maybe in a note.

(Filed at request of @estebank)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-patternsRelating to patterns and pattern matchingD-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions