Skip to content

Commit e3d81ab

Browse files
committed
---
yaml --- r: 49817 b: refs/heads/auto c: 070137c h: refs/heads/master i: 49815: b786f0a v: v3
1 parent 8cdbf22 commit e3d81ab

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
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 9e85589ad3ba61169cd7722520981c1bebb5b542
17+
refs/heads/auto: 070137ce905d0177e8d112385f1d8dc7b2407006
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/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)