Skip to content

Commit ac37e3c

Browse files
varkorfanzier
authored andcommitted
Add additional tests for trailing ..
1 parent fb02d99 commit ac37e3c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/test/ui/destructuring-assignment/slice_destructure.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ fn main() {
66
let (mut a, mut b);
77
[a, b] = [0, 1];
88
assert_eq!((a, b), (0, 1));
9-
let c;
9+
let mut c;
1010
[a, .., b, c] = [1, 2, 3, 4, 5];
1111
assert_eq!((a, b, c), (1, 4, 5));
1212
[_, a, _] = [1, 2, 3];
1313
assert_eq!((a, b), (2, 4));
1414
[..] = [1, 2, 3];
15+
[c, ..] = [5, 6, 6];
16+
assert_eq!(c, 5);
1517
}

src/test/ui/destructuring-assignment/tuple_destructure.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ fn main() {
1414
assert_eq!((a, b), (2, 2));
1515
(..) = (3, 4);
1616
assert_eq!((a, b), (2, 2));
17+
(b, ..) = (5, 6, 7);
18+
assert_eq!(b, 5);
1719
}

0 commit comments

Comments
 (0)