Make moves explicit in cfail tests

This commit is contained in:
Tim Chevalier 2012-09-18 22:44:46 -07:00
parent f5f3a75b65
commit 2145348090
10 changed files with 15 additions and 15 deletions

View File

@ -4,7 +4,7 @@ fn take(-_v: ~int) {
fn box_imm() {
let v = ~3;
let _w = &v; //~ NOTE loan of immutable local variable granted here
take(v); //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
take(move v); //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
}
fn main() {

View File

@ -4,7 +4,7 @@ fn closure1(+x: ~str) -> (~str, fn@() -> ~str) {
//~^ WARNING implicitly copying a non-implicitly-copyable value
//~^^ NOTE to copy values into a @fn closure, use a capture clause
};
(x,f)
(move x,f)
}
fn closure2(+x: util::NonCopyable) -> (util::NonCopyable,
@ -15,7 +15,7 @@ fn closure2(+x: util::NonCopyable) -> (util::NonCopyable,
//~^^ NOTE non-copyable value cannot be copied into a @fn closure
//~^^^ ERROR copying a noncopyable value
};
(x,f)
(move x,f)
}
fn closure3(+x: util::NonCopyable) {
do task::spawn {

View File

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

View File

@ -21,7 +21,7 @@ fn main() {
let mut res = foo(x);
let mut v = ~[mut];
v <- ~[mut res] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `owned`, missing `copy`)
v <- ~[mut (move res)] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `owned`, missing `copy`)
assert (v.len() == 2);
}

View File

@ -1,19 +1,19 @@
fn take(-_x: int) { }
fn from_by_value_arg(++x: int) {
take(x); //~ ERROR illegal move from argument `x`, which is not copy or move mode
take(move x); //~ ERROR illegal move from argument `x`, which is not copy or move mode
}
fn from_by_ref_arg(&&x: int) {
take(x); //~ ERROR illegal move from argument `x`, which is not copy or move mode
take(move x); //~ ERROR illegal move from argument `x`, which is not copy or move mode
}
fn from_copy_arg(+x: int) {
take(x);
take(move x);
}
fn from_move_arg(-x: int) {
take(x);
take(move x);
}
fn main() {

View File

@ -4,7 +4,7 @@ fn main() {
let x: int = 25;
loop {
take(x); //~ ERROR use of moved variable: `x`
take(move x); //~ ERROR use of moved variable: `x`
//~^ NOTE move of variable occurred here
}
}

View File

@ -54,5 +54,5 @@ struct r {
}
fn main() {
let x = r { x: () };
fn@() { copy x; }; //~ ERROR copying a noncopyable value
fn@(move x) { copy x; }; //~ ERROR copying a noncopyable value
}

View File

@ -9,7 +9,7 @@ enum _chan<T> = int;
// Tests that "log(debug, message);" is flagged as using
// message after the send deinitializes it
fn test00_start(ch: _chan<int>, message: int, _count: int) {
send(ch, message); //~ NOTE move of variable occurred here
send(ch, move message); //~ NOTE move of variable occurred here
log(debug, message); //~ ERROR use of moved variable: `message`
}

View File

@ -3,5 +3,5 @@ fn f<T: Send>(_i: T) {
fn main() {
let i = ~@100;
f(i); //~ ERROR missing `send`
f(move i); //~ ERROR missing `send`
}

View File

@ -17,5 +17,5 @@ fn main() {
let cat = ~"kitty";
let po = comm::Port(); //~ ERROR missing `send`
let ch = comm::Chan(&po); //~ ERROR missing `send`
comm::send(ch, foo(42, @cat)); //~ ERROR missing `send`
comm::send(ch, foo(42, @(move cat))); //~ ERROR missing `send`
}