1 An array or slice pattern required more elements than were present in the
4 Example of erroneous code:
7 #![feature(slice_patterns)]
11 &[a, b, c, rest @ ..] => { // error: pattern requires at least 3
12 // elements but array has 2
13 println!("a={}, b={}, c={} rest={:?}", a, b, c, rest);
18 Ensure that the matched array has at least as many elements as the pattern
19 requires. You can match an arbitrary number of remaining elements with `..`:
22 #![feature(slice_patterns)]
24 let r = &[1, 2, 3, 4, 5];
26 &[a, b, c, rest @ ..] => { // ok!
27 // prints `a=1, b=2, c=3 rest=[4, 5]`
28 println!("a={}, b={}, c={} rest={:?}", a, b, c, rest);