1 // Test bindings-after-at with slice-patterns
5 #![feature(bindings_after_at)]
7 #[derive(Debug, PartialEq)]
13 fn test(foo: &[i32]) -> MatchArm {
15 [bar @ .., n] if n == &5 => {
22 bar @ [x0, .., xn] => {
26 assert_eq!(bar, &[1, 2, 3, 4]);
35 let foo = vec![1, 2, 3, 4, 5];
37 assert_eq!(test(&foo), MatchArm::Arm(0));
38 assert_eq!(test(&foo[..4]), MatchArm::Arm(1));
39 assert_eq!(test(&foo[0..1]), MatchArm::Wild);