Skip to content

Commit 2145348

Browse files
committed
Make moves explicit in cfail tests
1 parent f5f3a75 commit 2145348

10 files changed

+15
-15
lines changed

src/test/compile-fail/borrowck-loan-blocks-move.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn take(-_v: ~int) {
44
fn box_imm() {
55
let v = ~3;
66
let _w = &v; //~ NOTE loan of immutable local variable granted here
7-
take(v); //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
7+
take(move v); //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
88
}
99

1010
fn main() {

src/test/compile-fail/copy-into-closure.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn closure1(+x: ~str) -> (~str, fn@() -> ~str) {
44
//~^ WARNING implicitly copying a non-implicitly-copyable value
55
//~^^ NOTE to copy values into a @fn closure, use a capture clause
66
};
7-
(x,f)
7+
(move x,f)
88
}
99

1010
fn closure2(+x: util::NonCopyable) -> (util::NonCopyable,
@@ -15,7 +15,7 @@ fn closure2(+x: util::NonCopyable) -> (util::NonCopyable,
1515
//~^^ NOTE non-copyable value cannot be copied into a @fn closure
1616
//~^^^ ERROR copying a noncopyable value
1717
};
18-
(x,f)
18+
(move x,f)
1919
}
2020
fn closure3(+x: util::NonCopyable) {
2121
do task::spawn {

src/test/compile-fail/issue-1965.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
fn test(-x: uint) {}
33

44
fn main() {
5-
let i = 3u;
6-
for uint::range(0u, 10u) |_x| {test(i)}
5+
let i = 3;
6+
for uint::range(0, 10) |_x| {test(move i)}
77
}

src/test/compile-fail/issue-2548.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() {
2121
let mut res = foo(x);
2222

2323
let mut v = ~[mut];
24-
v <- ~[mut res] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `owned`, missing `copy`)
24+
v <- ~[mut (move res)] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `owned`, missing `copy`)
2525
assert (v.len() == 2);
2626
}
2727

src/test/compile-fail/liveness-move-from-args.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
fn take(-_x: int) { }
22

33
fn from_by_value_arg(++x: int) {
4-
take(x); //~ ERROR illegal move from argument `x`, which is not copy or move mode
4+
take(move x); //~ ERROR illegal move from argument `x`, which is not copy or move mode
55
}
66

77
fn from_by_ref_arg(&&x: int) {
8-
take(x); //~ ERROR illegal move from argument `x`, which is not copy or move mode
8+
take(move x); //~ ERROR illegal move from argument `x`, which is not copy or move mode
99
}
1010

1111
fn from_copy_arg(+x: int) {
12-
take(x);
12+
take(move x);
1313
}
1414

1515
fn from_move_arg(-x: int) {
16-
take(x);
16+
take(move x);
1717
}
1818

1919
fn main() {

src/test/compile-fail/liveness-move-from-mode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn main() {
44

55
let x: int = 25;
66
loop {
7-
take(x); //~ ERROR use of moved variable: `x`
7+
take(move x); //~ ERROR use of moved variable: `x`
88
//~^ NOTE move of variable occurred here
99
}
1010
}

src/test/compile-fail/liveness-unused.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ struct r {
5454
}
5555
fn main() {
5656
let x = r { x: () };
57-
fn@() { copy x; }; //~ ERROR copying a noncopyable value
57+
fn@(move x) { copy x; }; //~ ERROR copying a noncopyable value
5858
}

src/test/compile-fail/liveness-use-after-send.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ enum _chan<T> = int;
99
// Tests that "log(debug, message);" is flagged as using
1010
// message after the send deinitializes it
1111
fn test00_start(ch: _chan<int>, message: int, _count: int) {
12-
send(ch, message); //~ NOTE move of variable occurred here
12+
send(ch, move message); //~ NOTE move of variable occurred here
1313
log(debug, message); //~ ERROR use of moved variable: `message`
1414
}
1515

src/test/compile-fail/unique-unique-kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ fn f<T: Send>(_i: T) {
33

44
fn main() {
55
let i = ~@100;
6-
f(i); //~ ERROR missing `send`
6+
f(move i); //~ ERROR missing `send`
77
}

src/test/compile-fail/unsendable-class.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ fn main() {
1717
let cat = ~"kitty";
1818
let po = comm::Port(); //~ ERROR missing `send`
1919
let ch = comm::Chan(&po); //~ ERROR missing `send`
20-
comm::send(ch, foo(42, @cat)); //~ ERROR missing `send`
20+
comm::send(ch, foo(42, @(move cat))); //~ ERROR missing `send`
2121
}

0 commit comments

Comments
 (0)