]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/match-byte-array-patterns.rs
Rollup merge of #61969 - MikailBag:master, r=Centril
[rust.git] / src / test / ui / binding / match-byte-array-patterns.rs
1 // run-pass
2 #![feature(slice_patterns)]
3
4 fn main() {
5     let buf = &[0u8; 4];
6     match buf {
7         &[0, 1, 0, 0] => unimplemented!(),
8         b"true" => unimplemented!(),
9         _ => {}
10     }
11
12     match buf {
13         b"true" => unimplemented!(),
14         &[0, 1, 0, 0] => unimplemented!(),
15         _ => {}
16     }
17
18     match buf {
19         b"true" => unimplemented!(),
20         &[0, x, 0, 0] => assert_eq!(x, 0),
21         _ => unimplemented!(),
22     }
23
24     let buf: &[u8] = buf;
25
26     match buf {
27         &[0, 1, 0, 0] => unimplemented!(),
28         &[_] => unimplemented!(),
29         &[_, _, _, _, _, ..] => unimplemented!(),
30         b"true" => unimplemented!(),
31         _ => {}
32     }
33
34     match buf {
35         b"true" => unimplemented!(),
36         &[0, 1, 0, 0] => unimplemented!(),
37         _ => {}
38     }
39
40     match buf {
41         b"true" => unimplemented!(),
42         &[0, x, 0, 0] => assert_eq!(x, 0),
43         _ => unimplemented!(),
44     }
45 }