An array without a fixed length was pattern-matched.
Example of erroneous code:
#![feature(const_generics)] fn is_123<const N: usize>(x: [u32; N]) -> bool { match x { [1, 2, 3] => true, // error: cannot pattern-match on an // array without a fixed length _ => false } }
Ensure that the pattern is consistent with the size of the matched array. Additional elements can be matched with ..:
#![feature(slice_patterns)]
let r = &[1, 2, 3, 4];
match r {
&[a, b, ..] => { // ok!
println!("a={}, b={}", a, b);
}
}