Skip to content

Wrong compiler warning with exclusive_range_pattern feature #43253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NTT123 opened this issue Jul 15, 2017 · 0 comments · Fixed by #43266
Closed

Wrong compiler warning with exclusive_range_pattern feature #43253

NTT123 opened this issue Jul 15, 2017 · 0 comments · Fixed by #43266
Labels
F-exclusive_range_pattern `#![feature(exclusive_range_pattern)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@NTT123
Copy link

NTT123 commented Jul 15, 2017

#![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

@shepmaster shepmaster changed the title Wrong compiler warning with exclusive_range_pattern featute Wrong compiler warning with exclusive_range_pattern feature Jul 15, 2017
bors added a commit that referenced this issue Jul 17, 2017
…=nikomatsakis

Fix `range_covered_by_constructor` for exclusive ranges.

This resolves #43253
@Centril Centril added F-exclusive_range_pattern `#![feature(exclusive_range_pattern)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-exclusive_range_pattern `#![feature(exclusive_range_pattern)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants