Skip to content

Commit 344a203

Browse files
committed
---
yaml --- r: 48609 b: refs/heads/snap-stage3 c: 070137c h: refs/heads/master i: 48607: b89427f v: v3
1 parent 97d04c1 commit 344a203

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9e85589ad3ba61169cd7722520981c1bebb5b542
4+
refs/heads/snap-stage3: 070137ce905d0177e8d112385f1d8dc7b2407006
55
refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/test/run-pass/vec-matching.rs

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub fn main() {
1+
fn a() {
22
let x = [1];
33
match x {
44
[_, _, _, _, _, .._] => ::core::util::unreachable(),
@@ -11,3 +11,44 @@ pub fn main() {
1111
[] => ::core::util::unreachable()
1212
}
1313
}
14+
15+
fn b() {
16+
let x = [1, 2, 3];
17+
match x {
18+
[a, b, ..c] => {
19+
fail_unless!(a == 1);
20+
fail_unless!(b == 2);
21+
fail_unless!(c == &[3]);
22+
}
23+
_ => fail!()
24+
}
25+
match x {
26+
[..a, b, c] => {
27+
fail_unless!(a == &[1]);
28+
fail_unless!(b == 2);
29+
fail_unless!(c == 3);
30+
}
31+
_ => fail!()
32+
}
33+
match x {
34+
[a, ..b, c] => {
35+
fail_unless!(a == 1);
36+
fail_unless!(b == &[2]);
37+
fail_unless!(c == 3);
38+
}
39+
_ => fail!()
40+
}
41+
match x {
42+
[a, b, c] => {
43+
fail_unless!(a == 1);
44+
fail_unless!(b == 2);
45+
fail_unless!(c == 3);
46+
}
47+
_ => fail!()
48+
}
49+
}
50+
51+
pub fn main() {
52+
a();
53+
b();
54+
}

0 commit comments

Comments
 (0)