summaryrefslogtreecommitdiffstats
path: root/src/test/ui/match/pattern-deref-miscompile.rs
blob: caa6d184a92ddc2aeff326180a93585798bce045 (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
45
46
// run-pass

fn main() {
    match b"." as &[u8] {
        b"." if true => {},
        b"." => panic!(),
        b".." => panic!(),
        b"" => panic!(),
        _ => panic!(),
    }
    match b"." as &[u8] {
        b"." if false => panic!(),
        b"." => {},
        b".." => panic!(),
        b"" => panic!(),
        _ => panic!(),
    }
    match b".." as &[u8] {
        b"." if true => panic!(), // the miscompile caused this arm to be reached
        b"." => panic!(),
        b".." => {},
        b"" => panic!(),
        _ => panic!(),
    }
    match b".." as &[u8] {
        b"." if false => panic!(),
        b"." => panic!(),
        b".." => {},
        b"" => panic!(),
        _ => panic!(),
    }
    match b"" as &[u8] {
        b"." if true => panic!(),
        b"." => panic!(),
        b".." => panic!(),
        b"" => {},
        _ => panic!(),
    }
    match b"" as &[u8] {
        b"." if false => panic!(),
        b"." => panic!(),
        b".." => panic!(),
        b"" => {},
        _ => panic!(),
    }
}