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