]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfcs/rfc-2005-default-binding-mode/slice.rs
Rollup merge of #63055 - Mark-Simulacrum:save-analysis-clean-2, r=Xanewok
[rust.git] / src / test / ui / rfcs / rfc-2005-default-binding-mode / slice.rs
1 // run-pass
2 #![feature(slice_patterns)]
3
4 fn slice_pat() {
5     let sl: &[u8] = b"foo";
6
7     match sl {
8         [first, remainder @ ..] => {
9             let _: &u8 = first;
10             assert_eq!(first, &b'f');
11             assert_eq!(remainder, b"oo");
12         }
13         [] => panic!(),
14     }
15 }
16
17 fn slice_pat_omission() {
18      match &[0, 1, 2] {
19         [..] => {}
20      };
21 }
22
23 fn main() {
24     slice_pat();
25     slice_pat_omission();
26 }