Skip to content

Commit 75da43d

Browse files
committed
Use new 'p @ ..' syntax in tests.
1 parent 891a736 commit 75da43d

36 files changed

+69
-85
lines changed

src/test/mir-opt/uniform_array_move_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn move_out_from_end() {
88

99
fn move_out_by_subslice() {
1010
let a = [box 1, box 2];
11-
let [_y..] = a;
11+
let [_y @ ..] = a;
1212
}
1313

1414
fn main() {

src/test/ui/array-slice-vec/vec-matching-fold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn foldl<T, U, F>(values: &[T],
1111
U: Clone+Debug, T:Debug,
1212
F: FnMut(U, &T) -> U,
1313
{ match values {
14-
&[ref head, ref tail..] =>
14+
&[ref head, ref tail @ ..] =>
1515
foldl(tail, function(initial, head), function),
1616
&[] => {
1717
// FIXME: call guards
@@ -28,7 +28,7 @@ fn foldr<T, U, F>(values: &[T],
2828
F: FnMut(&T, U) -> U,
2929
{
3030
match values {
31-
&[ref head.., ref tail] =>
31+
&[ref head @ .., ref tail] =>
3232
foldr(head, function(tail, initial), function),
3333
&[] => {
3434
// FIXME: call guards

src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn main() {
88
let x: &[isize] = &[1, 2, 3, 4, 5];
99
if !x.is_empty() {
1010
let el = match x {
11-
&[1, ref tail..] => &tail[0],
11+
&[1, ref tail @ ..] => &tail[0],
1212
_ => unreachable!()
1313
};
1414
println!("{}", *el);

src/test/ui/array-slice-vec/vec-matching.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ fn a() {
1414
fn b() {
1515
let x = [1, 2, 3];
1616
match x {
17-
[a, b, c..] => {
17+
[a, b, c @ ..] => {
1818
assert_eq!(a, 1);
1919
assert_eq!(b, 2);
2020
let expected: &[_] = &[3];
2121
assert_eq!(c, expected);
2222
}
2323
}
2424
match x {
25-
[a.., b, c] => {
25+
[a @ .., b, c] => {
2626
let expected: &[_] = &[1];
2727
assert_eq!(a, expected);
2828
assert_eq!(b, 2);
2929
assert_eq!(c, 3);
3030
}
3131
}
3232
match x {
33-
[a, b.., c] => {
33+
[a, b @ .., c] => {
3434
assert_eq!(a, 1);
3535
let expected: &[_] = &[2];
3636
assert_eq!(b, expected);
@@ -50,7 +50,7 @@ fn b() {
5050
fn b_slice() {
5151
let x : &[_] = &[1, 2, 3];
5252
match x {
53-
&[a, b, ref c..] => {
53+
&[a, b, ref c @ ..] => {
5454
assert_eq!(a, 1);
5555
assert_eq!(b, 2);
5656
let expected: &[_] = &[3];
@@ -59,7 +59,7 @@ fn b_slice() {
5959
_ => unreachable!()
6060
}
6161
match x {
62-
&[ref a.., b, c] => {
62+
&[ref a @ .., b, c] => {
6363
let expected: &[_] = &[1];
6464
assert_eq!(a, expected);
6565
assert_eq!(b, 2);
@@ -68,7 +68,7 @@ fn b_slice() {
6868
_ => unreachable!()
6969
}
7070
match x {
71-
&[a, ref b.., c] => {
71+
&[a, ref b @ .., c] => {
7272
assert_eq!(a, 1);
7373
let expected: &[_] = &[2];
7474
assert_eq!(b, expected);
@@ -134,26 +134,11 @@ fn e() {
134134
assert_eq!(c, 1);
135135
}
136136

137-
fn f() {
138-
let x = &[1, 2, 3, 4, 5];
139-
let [a, [b, [c, ..].., d].., e] = *x;
140-
assert_eq!((a, b, c, d, e), (1, 2, 3, 4, 5));
141-
142-
let x: &[isize] = x;
143-
let (a, b, c, d, e) = match *x {
144-
[a, [b, [c, ..].., d].., e] => (a, b, c, d, e),
145-
_ => unimplemented!()
146-
};
147-
148-
assert_eq!((a, b, c, d, e), (1, 2, 3, 4, 5));
149-
}
150-
151137
pub fn main() {
152138
a();
153139
b();
154140
b_slice();
155141
c();
156142
d();
157143
e();
158-
f();
159144
}

src/test/ui/array-slice-vec/vec-tail-matching.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ pub fn main() {
1313
Foo { string: "baz" }
1414
];
1515
match x {
16-
[ref first, ref tail..] => {
16+
[ref first, ref tail @ ..] => {
1717
assert_eq!(first.string, "foo");
1818
assert_eq!(tail.len(), 2);
1919
assert_eq!(tail[0].string, "bar");
2020
assert_eq!(tail[1].string, "baz");
2121

2222
match *(tail as &[_]) {
23-
[Foo { .. }, _, Foo { .. }, ref _tail..] => {
23+
[Foo { .. }, _, Foo { .. }, ref _tail @ ..] => {
2424
unreachable!();
2525
}
2626
[Foo { string: ref a }, Foo { string: ref b }] => {

src/test/ui/binding/irrefutable-slice-patterns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![feature(slice_patterns)]
55

66
fn foo(s: &[i32]) -> &[i32] {
7-
let &[ref xs..] = s;
7+
let &[ref xs @ ..] = s;
88
xs
99
}
1010

src/test/ui/binding/zero_sized_subslice_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ fn main() {
77
// The subslice used to go out of bounds for zero-sized array items, check that this doesn't
88
// happen anymore
99
match x {
10-
[_, ref y..] => assert_eq!(&x[1] as *const (), &y[0] as *const ())
10+
[_, ref y @ ..] => assert_eq!(&x[1] as *const (), &y[0] as *const ())
1111
}
1212
}

src/test/ui/borrowck/borrowck-describe-lvalue.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,22 @@ fn main() {
140140
let mut v = &[1, 2, 3, 4, 5];
141141
let x = &mut v;
142142
match v {
143-
&[x..] => println!("{:?}", x),
143+
&[x @ ..] => println!("{:?}", x),
144144
//~^ ERROR cannot use `v[..]` because it was mutably borrowed
145145
_ => panic!("other case"),
146146
}
147147
match v {
148-
&[_, x..] => println!("{:?}", x),
148+
&[_, x @ ..] => println!("{:?}", x),
149149
//~^ ERROR cannot use `v[..]` because it was mutably borrowed
150150
_ => panic!("other case"),
151151
}
152152
match v {
153-
&[x.., _] => println!("{:?}", x),
153+
&[x @ .., _] => println!("{:?}", x),
154154
//~^ ERROR cannot use `v[..]` because it was mutably borrowed
155155
_ => panic!("other case"),
156156
}
157157
match v {
158-
&[_, x.., _] => println!("{:?}", x),
158+
&[_, x @ .., _] => println!("{:?}", x),
159159
//~^ ERROR cannot use `v[..]` because it was mutably borrowed
160160
_ => panic!("other case"),
161161
}

src/test/ui/borrowck/borrowck-move-out-from-array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn move_out_from_begin_and_end() {
1010
fn move_out_by_const_index_and_subslice() {
1111
let a = [box 1, box 2];
1212
let [_x, _] = a;
13-
let [_y..] = a; //~ ERROR [E0382]
13+
let [_y @ ..] = a; //~ ERROR [E0382]
1414
}
1515

1616
fn main() {}

src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn main() {
1515
];
1616
let x: &[Foo] = &x;
1717
match *x {
18-
[_, ref tail..] => {
18+
[_, ref tail @ ..] => {
1919
match tail {
2020
//~^ ERROR cannot move out of type `[Foo]`
2121
&[Foo { string: a },

0 commit comments

Comments
 (0)