Make moves explicit in cfail tests
This commit is contained in:
parent
f5f3a75b65
commit
2145348090
@ -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() {
|
||||
|
@ -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 {
|
||||
|
@ -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)}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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`
|
||||
}
|
||||
|
||||
|
@ -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`
|
||||
}
|
||||
|
@ -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`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user