Skip to content

non-exhaustive patterns false positive #73919

Closed
@leonardo-m

Description

@leonardo-m
fn foo(x: usize) -> u32 {
    match x {
        0 ..= usize::MAX => 0
    }
}
fn main() {}

Gives:

error[E0004]: non-exhaustive patterns: `_` not covered
 --> ...\test.rs:2:11
  |
2 |     match x {
  |           ^ pattern `_` not covered
  |
  = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
  = note: the matched value is of type `usize`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsC-enhancementCategory: An issue proposing an enhancement or a PR with one.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