Skip to content

Incorrect "non-exhaustive patterns" using @-binding in match #8391

Closed
@bluss

Description

@bluss

Binding a match arm using "as-patterns" ref x @ or ref mut x @ will emit an incorrect error message.

rusti:  match Some(1) { ref x@Some(*) => 1, None => 0 }
<anon>:5:10: 5:57 error: non-exhaustive patterns
<anon>:5           match Some(1) { ref x@Some(*) => 1, None => 0 }
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

rustc will be silent and happy if a third case _ => fail!() is provided.

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