Skip to content

Wrong compiler warning with exclusive_range_pattern feature #43253

Closed
@NTT123

Description

@NTT123
#![feature(exclusive_range_pattern)]

fn main() {
    let a: u8 = 11;
    match a {
        1..11 => println!("1 to 10"),
        11 => println!("11"),          // warning: unreachable pattern
        _ => println!("else"),        
    };
}

With rust nightly compiler, the result on the screen is 11 even though the compiler warning that 11 case is unreachable.

Link to rust playground: https://play.rust-lang.org/?gist=a3c8f0a3cfa3209a52992aedf9220720&version=nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-exclusive_range_pattern`#![feature(exclusive_range_pattern)]`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