rust/tests/ui/destructuring-assignment/slice_destructure_fail.rs
2023-07-17 22:00:43 +00:00

11 lines
345 B
Rust

fn main() {
let (mut a, mut b);
[a, .., b, ..] = [0, 1]; //~ ERROR `..` can only be used once per slice pattern
[a, a, b] = [1, 2];
//~^ ERROR pattern requires 3 elements but array has 2
//~| ERROR mismatched types
[_] = [1, 2];
//~^ ERROR pattern requires 1 element but array has 2
//~| ERROR mismatched types
}