Skip to content

Exhaustive match of number treated as non-exhaustive #12483

Closed
@ebiggers

Description

@ebiggers

The following function does not compile because rustc determines that the patterns in the match statement are non-exhaustive. However, the pattern matches every possible value of the integer type, and the compiler should be able to detect this.

fn wont_compile(x : u8) { 
    match (x) {
        0x00 .. 0xff => { }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions