1 An array without a fixed length was pattern-matched.
3 Erroneous code example:
6 fn is_123<const N: usize>(x: [u32; N]) -> bool {
8 [1, 2, ..] => true, // error: cannot pattern-match on an
9 // array without a fixed length
15 To fix this error, you have two solutions:
16 1. Use an array with a fixed length.
19 Example with an array with a fixed length:
22 fn is_123(x: [u32; 3]) -> bool { // We use an array with a fixed size
24 [1, 2, ..] => true, // ok!
33 fn is_123(x: &[u32]) -> bool { // We use a slice
35 [1, 2, ..] => true, // ok!