3 The tracking issue for this feature is: [#62254]
5 [#62254]: https://github.com/rust-lang/rust/issues/62254
7 ------------------------
9 The `slice_patterns` feature gate lets you use `..` to indicate any number of
10 elements inside a pattern matching a slice. This wildcard can only be used once
11 for a given array. If there's an pattern before the `..`, the subslice will be
12 matched against that pattern. For example:
15 #![feature(slice_patterns)]
17 fn is_symmetric(list: &[u32]) -> bool {
20 &[x, ref inside @ .., y] if x == y => is_symmetric(inside),
26 let sym = &[0, 1, 4, 2, 4, 1, 0];
27 assert!(is_symmetric(sym));
29 let not_sym = &[0, 1, 7, 2, 4, 1, 0];
30 assert!(!is_symmetric(not_sym));