about summary refs log tree commit diff
path: root/src/test/ui/check_match/issue-43253.rs
blob: a4d6e9b777f0262b5f528a91ed696a2a9f82dcf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// build-pass (FIXME(62277): could be check-pass?)

#![feature(exclusive_range_pattern)]
#![warn(unreachable_patterns)]

fn main() {
    // These cases should generate no warning.
    match 10 {
        1..10 => {},
        10 => {},
        _ => {},
    }

    match 10 {
        1..10 => {},
        9..=10 => {},
        _ => {},
    }

    match 10 {
        1..10 => {},
        10..=10 => {},
        _ => {},
    }

    // These cases should generate an "unreachable pattern" warning.
    match 10 {
        1..10 => {},
        9 => {},
        _ => {},
    }

    match 10 {
        1..10 => {},
        8..=9 => {},
        _ => {},
    }

    match 10 {
        1..10 => {},
        9..=9 => {},
        _ => {},
    }
}