summaryrefslogtreecommitdiffstats
path: root/tests/ui/binding/match-byte-array-patterns.rs
blob: f0c988c01c2b843291ac193cf42fc1a68337f7d8 (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
// run-pass

fn main() {
    let buf = &[0u8; 4];
    match buf {
        &[0, 1, 0, 0] => unimplemented!(),
        b"true" => unimplemented!(),
        _ => {}
    }

    match buf {
        b"true" => unimplemented!(),
        &[0, 1, 0, 0] => unimplemented!(),
        _ => {}
    }

    match buf {
        b"true" => unimplemented!(),
        &[0, x, 0, 0] => assert_eq!(x, 0),
        _ => unimplemented!(),
    }

    let buf: &[u8] = buf;

    match buf {
        &[0, 1, 0, 0] => unimplemented!(),
        &[_] => unimplemented!(),
        &[_, _, _, _, _, ..] => unimplemented!(),
        b"true" => unimplemented!(),
        _ => {}
    }

    match buf {
        b"true" => unimplemented!(),
        &[0, 1, 0, 0] => unimplemented!(),
        _ => {}
    }

    match buf {
        b"true" => unimplemented!(),
        &[0, x, 0, 0] => assert_eq!(x, 0),
        _ => unimplemented!(),
    }
}