diff options
Diffstat (limited to 'tests/ui/destructuring-assignment')
-rw-r--r-- | tests/ui/destructuring-assignment/slice_destructure_fail.rs | 10 | ||||
-rw-r--r-- | tests/ui/destructuring-assignment/slice_destructure_fail.stderr | 22 |
2 files changed, 17 insertions, 15 deletions
diff --git a/tests/ui/destructuring-assignment/slice_destructure_fail.rs b/tests/ui/destructuring-assignment/slice_destructure_fail.rs index 33b09eb34..e5bb50030 100644 --- a/tests/ui/destructuring-assignment/slice_destructure_fail.rs +++ b/tests/ui/destructuring-assignment/slice_destructure_fail.rs @@ -1,6 +1,8 @@ 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 - [_] = [1, 2]; //~ ERROR pattern requires 1 element but array has 2 + 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 + [_] = [1, 2]; + //~^ ERROR pattern requires 1 element but array has 2 } diff --git a/tests/ui/destructuring-assignment/slice_destructure_fail.stderr b/tests/ui/destructuring-assignment/slice_destructure_fail.stderr index 92c86feba..acf44ceb1 100644 --- a/tests/ui/destructuring-assignment/slice_destructure_fail.stderr +++ b/tests/ui/destructuring-assignment/slice_destructure_fail.stderr @@ -1,22 +1,22 @@ error: `..` can only be used once per slice pattern - --> $DIR/slice_destructure_fail.rs:3:14 + --> $DIR/slice_destructure_fail.rs:3:16 | -LL | [a, .., b, ..] = [0, 1]; - | -- ^^ can only be used once per slice pattern - | | - | previously used here +LL | [a, .., b, ..] = [0, 1]; + | -- ^^ can only be used once per slice pattern + | | + | previously used here error[E0527]: pattern requires 3 elements but array has 2 - --> $DIR/slice_destructure_fail.rs:4:3 + --> $DIR/slice_destructure_fail.rs:4:5 | -LL | [a, a, b] = [1, 2]; - | ^^^^^^^^^ expected 2 elements +LL | [a, a, b] = [1, 2]; + | ^^^^^^^^^ expected 2 elements error[E0527]: pattern requires 1 element but array has 2 - --> $DIR/slice_destructure_fail.rs:5:3 + --> $DIR/slice_destructure_fail.rs:6:5 | -LL | [_] = [1, 2]; - | ^^^ expected 2 elements +LL | [_] = [1, 2]; + | ^^^ expected 2 elements error: aborting due to 3 previous errors |