false fn for
if impl
let log loop
-match mod move mut
+match mod mut
priv pub pure
ref return
self static struct super
let y = &v.g;
...
}
- x.f = move v; // Replace x.f
+ x.f = v; // Replace x.f
...
# return 0;
}
let (port, chan): (Port<int>, Chan<int>) = stream();
-do spawn |move chan| {
+do spawn || {
let result = some_expensive_computation();
chan.send(result);
}
# use pipes::{stream, Port, Chan};
# fn some_expensive_computation() -> int { 42 }
# let (port, chan) = stream();
-do spawn |move chan| {
+do spawn || {
let result = some_expensive_computation();
chan.send(result);
}
# fn some_expensive_computation() -> int { 42 }
let (port, chan) = stream();
-do spawn |move chan| {
+do spawn {
chan.send(some_expensive_computation());
}
use pipes::{stream, SharedChan};
let (port, chan) = stream();
-let chan = SharedChan(move chan);
+let chan = SharedChan(chan);
for uint::range(0, 3) |init_val| {
// Create a new channel handle to distribute to the child task
let child_chan = chan.clone();
- do spawn |move child_chan| {
+ do spawn {
child_chan.send(some_expensive_computation(init_val));
}
}
// Create a vector of ports, one for each child task
let ports = do vec::from_fn(3) |init_val| {
let (port, chan) = stream();
- do spawn |move chan| {
+ do spawn {
chan.send(some_expensive_computation(init_val));
}
- move port
+ port
};
// Wait on each port, accumulating the results
# fn sleep_forever() { loop { task::yield() } }
# do task::try {
let (receiver, sender): (Port<int>, Chan<int>) = stream();
-do spawn |move receiver| { // Bidirectionally linked
+do spawn { // Bidirectionally linked
// Wait for the supervised child task to exist.
let message = receiver.recv();
// Kill both it and the parent task.
assert message != 42;
}
-do try |move sender| { // Unidirectionally linked
+do try { // Unidirectionally linked
sender.send(42);
sleep_forever(); // Will get woken up by force
}
let (from_child, to_child) = DuplexStream();
-do spawn |move to_child| {
+do spawn {
stringifier(&to_child);
};
let crayons: ~[Crayon] = ~[BananaMania, Beaver, Bittersweet];
// Put the vector into a mutable slot
-let mut mutable_crayons = move crayons;
+let mut mutable_crayons = crayons;
// Now it's mutable to the bone
mutable_crayons[0] = Apricot;
let ecx: @encode_ctxt = @encode_ctxt({
diag: parms.diag,
tcx: parms.tcx,
- stats: @mut move stats,
+ stats: @mut stats,
reachable: parms.reachable,
reexports2: parms.reexports2,
item_symbols: parms.item_symbols,
cat {
meows: in_x,
how_hungry: in_y,
- info: move in_info
+ info: in_info
}
}
}
for uint::range(0u, num) |i| {
result.push(i);
}
- return dvec::unwrap(move result);
+ return dvec::unwrap(result);
}
fn main() {
};
}
- move marks
+ marks
}
/**
i += 1;
let old_len = colors.len();
- let color = arc::ARC(move colors);
+ let color = arc::ARC(colors);
let color_vec = arc::get(&color); // FIXME #3387 requires this temp
colors = do par::mapi(*color_vec) {
use pipes::{Port, Chan, SharedChan};
macro_rules! move_out (
- { $x:expr } => { unsafe { let y = move *ptr::addr_of(&($x)); move y } }
+ { $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }
)
enum request {
let (from_child, to_parent) = pipes::stream();
let (from_parent, to_child) = pipes::stream();
- let to_child = SharedChan(move to_child);
+ let to_child = SharedChan(to_child);
let size = uint::from_str(args[1]).get();
let workers = uint::from_str(args[2]).get();
for uint::range(0, workers) |_i| {
let to_child = to_child.clone();
do task::task().future_result(|+r| {
- worker_results.push(move r);
- }).spawn |move to_child| {
+ worker_results.push(r);
+ }).spawn || {
for uint::range(0, size / workers) |_i| {
//error!("worker %?: sending %? bytes", i, num_bytes);
to_child.send(bytes(num_bytes));
//error!("worker %? exiting", i);
};
}
- do task::spawn |move from_parent, move to_parent| {
+ do task::spawn || {
server(from_parent, to_parent);
}
use pipes::{Port, PortSet, Chan};
macro_rules! move_out (
- { $x:expr } => { unsafe { let y = move *ptr::addr_of(&($x)); move y } }
+ { $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }
)
enum request {
let (from_child, to_parent) = pipes::stream();
let (from_parent_, to_child) = pipes::stream();
let from_parent = PortSet();
- from_parent.add(move from_parent_);
+ from_parent.add(from_parent_);
let size = uint::from_str(args[1]).get();
let workers = uint::from_str(args[2]).get();
let mut worker_results = ~[];
for uint::range(0, workers) |_i| {
let (from_parent_, to_child) = pipes::stream();
- from_parent.add(move from_parent_);
+ from_parent.add(from_parent_);
do task::task().future_result(|+r| {
- worker_results.push(move r);
- }).spawn |move to_child| {
+ worker_results.push(r);
+ }).spawn || {
for uint::range(0, size / workers) |_i| {
//error!("worker %?: sending %? bytes", i, num_bytes);
to_child.send(bytes(num_bytes));
//error!("worker %? exiting", i);
};
}
- do task::spawn |move from_parent, move to_parent| {
+ do task::spawn || {
server(from_parent, to_parent);
}
fn init() -> (pipe,pipe) {
let m = arc::MutexARC(~[]);
- ((&m).clone(), move m)
+ ((&m).clone(), m)
}
count: uint,
+num_chan: pipe,
+num_port: pipe) {
- let mut num_chan = move Some(move num_chan);
- let mut num_port = move Some(move num_port);
+ let mut num_chan = Some(num_chan);
+ let mut num_port = Some(num_port);
// Send/Receive lots of messages.
for uint::range(0u, count) |j| {
//error!("task %?, iter %?", i, j);
let mut num_chan2 = option::swap_unwrap(&mut num_chan);
let mut num_port2 = option::swap_unwrap(&mut num_port);
send(&num_chan2, i * j);
- num_chan = Some(move num_chan2);
+ num_chan = Some(num_chan2);
let _n = recv(&num_port2);
//log(error, _n);
- num_port = Some(move num_port2);
+ num_port = Some(num_port2);
};
}
let msg_per_task = uint::from_str(args[2]).get();
let (num_chan, num_port) = init();
- let mut num_chan = Some(move num_chan);
+ let mut num_chan = Some(num_chan);
let start = time::precise_time_s();
let (new_chan, num_port) = init();
let num_chan2 = ~mut None;
*num_chan2 <-> num_chan;
- let num_port = ~mut Some(move num_port);
- let new_future = future::spawn(|move num_chan2, move num_port| {
+ let num_port = ~mut Some(num_port);
+ let new_future = do future::spawn() || {
let mut num_chan = None;
num_chan <-> *num_chan2;
let mut num_port1 = None;
num_port1 <-> *num_port;
thread_ring(i, msg_per_task,
- option::unwrap(move num_chan),
- option::unwrap(move num_port1))
- });
- futures.push(move new_future);
- num_chan = Some(move new_chan);
+ option::unwrap(num_chan),
+ option::unwrap(num_port1))
+ };
+ futures.push(new_future);
+ num_chan = Some(new_chan);
};
// do our iteration
- thread_ring(0, msg_per_task, option::unwrap(move num_chan), move num_port);
+ thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
// synchronize
for futures.each |f| { f.get() };
)
macro_rules! move_out (
- ($x:expr) => { unsafe { let y = move *ptr::addr_of(&$x); move y } }
+ ($x:expr) => { unsafe { let y = *ptr::addr_of(&$x); y } }
)
fn thread_ring(i: uint,
count: uint,
+num_chan: ring::client::num,
+num_port: ring::server::num) {
- let mut num_chan = move Some(move num_chan);
- let mut num_port = move Some(move num_port);
+ let mut num_chan = Some(num_chan);
+ let mut num_port = Some(num_port);
// Send/Receive lots of messages.
for uint::range(0, count) |j| {
//error!("task %?, iter %?", i, j);
let mut num_port2 = None;
num_chan2 <-> num_chan;
num_port2 <-> num_port;
- num_chan = Some(ring::client::num(option::unwrap(move num_chan2), i * j));
- let port = option::unwrap(move num_port2);
- match recv(move port) {
+ num_chan = Some(ring::client::num(option::unwrap(num_chan2), i * j));
+ let port = option::unwrap(num_port2);
+ match recv(port) {
ring::num(_n, p) => {
//log(error, _n);
num_port = Some(move_out!(p));
let msg_per_task = uint::from_str(args[2]).get();
let (num_chan, num_port) = ring::init();
- let mut num_chan = Some(move num_chan);
+ let mut num_chan = Some(num_chan);
let start = time::precise_time_s();
let (new_chan, num_port) = ring::init();
let num_chan2 = ~mut None;
*num_chan2 <-> num_chan;
- let num_port = ~mut Some(move num_port);
- let new_future = do future::spawn
- |move num_chan2, move num_port| {
+ let num_port = ~mut Some(num_port);
+ let new_future = do future::spawn || {
let mut num_chan = None;
num_chan <-> *num_chan2;
let mut num_port1 = None;
num_port1 <-> *num_port;
thread_ring(i, msg_per_task,
- option::unwrap(move num_chan),
- option::unwrap(move num_port1))
+ option::unwrap(num_chan),
+ option::unwrap(num_port1))
};
- futures.push(move new_future);
- num_chan = Some(move new_chan);
+ futures.push(new_future);
+ num_chan = Some(new_chan);
};
// do our iteration
- thread_ring(0, msg_per_task, option::unwrap(move num_chan), move num_port);
+ thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
// synchronize
for futures.each |f| { f.get() };
fn init() -> (pipe,pipe) {
let x = arc::RWARC(~[]);
- ((&x).clone(), move x)
+ ((&x).clone(), x)
}
count: uint,
+num_chan: pipe,
+num_port: pipe) {
- let mut num_chan = move Some(move num_chan);
- let mut num_port = move Some(move num_port);
+ let mut num_chan = Some(num_chan);
+ let mut num_port = Some(num_port);
// Send/Receive lots of messages.
for uint::range(0u, count) |j| {
//error!("task %?, iter %?", i, j);
let mut num_chan2 = option::swap_unwrap(&mut num_chan);
let mut num_port2 = option::swap_unwrap(&mut num_port);
send(&num_chan2, i * j);
- num_chan = Some(move num_chan2);
+ num_chan = Some(num_chan2);
let _n = recv(&num_port2);
//log(error, _n);
- num_port = Some(move num_port2);
+ num_port = Some(num_port2);
};
}
let msg_per_task = uint::from_str(args[2]).get();
let (num_chan, num_port) = init();
- let mut num_chan = Some(move num_chan);
+ let mut num_chan = Some(num_chan);
let start = time::precise_time_s();
let (new_chan, num_port) = init();
let num_chan2 = ~mut None;
*num_chan2 <-> num_chan;
- let num_port = ~mut Some(move num_port);
- let new_future = do future::spawn
- |move num_chan2, move num_port| {
+ let num_port = ~mut Some(num_port);
+ let new_future = do future::spawn || {
let mut num_chan = None;
num_chan <-> *num_chan2;
let mut num_port1 = None;
num_port1 <-> *num_port;
thread_ring(i, msg_per_task,
- option::unwrap(move num_chan),
- option::unwrap(move num_port1))
+ option::unwrap(num_chan),
+ option::unwrap(num_port1))
};
- futures.push(move new_future);
- num_chan = Some(move new_chan);
+ futures.push(new_future);
+ num_chan = Some(new_chan);
};
// do our iteration
- thread_ring(0, msg_per_task, option::unwrap(move num_chan), move num_port);
+ thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
// synchronize
for futures.each |f| { f.get() };
r.shuffle_mut(permutations);
~Noise2DContext{
- rgradients: move rgradients,
- permutations: move permutations,
+ rgradients: rgradients,
+ permutations: permutations,
}
}
// This stuff should go in libcore::pipes
macro_rules! move_it (
- { $x:expr } => { let t = move *ptr::addr_of(&($x)); move t }
+ { $x:expr } => { let t = *ptr::addr_of(&($x)); t }
)
macro_rules! follow (
{
$($message:path($($x: ident),+) -> $next:ident $e:expr)+
} => (
- |m| match move m {
- $(Some($message($($x,)* move next)) => {
- let $next = move next;
- move $e })+
+ |m| match m {
+ $(Some($message($($x,)* next)) => {
+ let $next = next;
+ $e })+
_ => { fail!() }
}
);
{
$($message:path -> $next:ident $e:expr)+
} => (
- |m| match move m {
- $(Some($message(move next)) => {
- let $next = move next;
- move $e })+
+ |m| match m {
+ $(Some($message(next)) => {
+ let $next = next;
+ $e })+
_ => { fail!() }
}
)
fn switch<T: Owned, Tb: Owned, U>(+endp: pipes::RecvPacketBuffered<T, Tb>,
f: fn(+v: Option<T>) -> U) -> U {
- f(pipes::try_recv(move endp))
+ f(pipes::try_recv(endp))
}
// Here's the benchmark
let mut ch = do spawn_service(init) |ch| {
let mut count = count;
- let mut ch = move ch;
+ let mut ch = ch;
while count > 0 {
- ch = switch(move ch, follow! (
- ping -> next { server::pong(move next) }
+ ch = switch(ch, follow! (
+ ping -> next { server::pong(next) }
));
count -= 1;
let mut count = count;
while count > 0 {
- let ch_ = client::ping(move ch);
+ let ch_ = client::ping(ch);
- ch = switch(move ch_, follow! (
- pong -> next { move next }
+ ch = switch(ch_, follow! (
+ pong -> next { next }
));
count -= 1;
let mut ch = do spawn_service(init) |ch| {
let mut count = count;
- let mut ch = move ch;
+ let mut ch = ch;
while count > 0 {
- ch = switch(move ch, follow! (
- ping -> next { server::pong(move next) }
+ ch = switch(ch, follow! (
+ ping -> next { server::pong(next) }
));
count -= 1;
let mut count = count;
while count > 0 {
- let ch_ = client::ping(move ch);
+ let ch_ = client::ping(ch);
- ch = switch(move ch_, follow! (
- pong -> next { move next }
+ ch = switch(ch_, follow! (
+ pong -> next { next }
));
count -= 1;
let to_rendezvous_log = to_rendezvous_log.clone();
let (from_rendezvous, to_creature) = stream();
let from_rendezvous = Cell(from_rendezvous);
- do task::spawn |move ii, move col| {
+ do task::spawn || {
creature(ii, col, from_rendezvous.take(), to_rendezvous.clone(),
to_rendezvous_log.clone());
}
_ => { ~"" }
};
- to_parent.send(move buffer);
+ to_parent.send(buffer);
}
// given a FASTA file on stdin, process sequence THREE
// initialize each sequence sorter
let sizes = ~[1,2,3,4,6,12,18];
let streams = vec::map(sizes, |_sz| Some(stream()));
- let mut streams = move streams;
+ let mut streams = streams;
let mut from_child = ~[];
let to_child = vec::mapi(sizes, |ii, sz| {
let sz = *sz;
let mut stream = None;
stream <-> streams[ii];
- let (from_child_, to_parent_) = option::unwrap(move stream);
+ let (from_child_, to_parent_) = option::unwrap(stream);
- from_child.push(move from_child_);
+ from_child.push(from_child_);
let (from_parent, to_child) = pipes::stream();
- do task::spawn_with(move from_parent) |move to_parent_, from_parent| {
+ do task::spawn_with(from_parent) |from_parent| {
make_sequence_processor(sz, from_parent, to_parent_);
};
- move to_child
+ to_child
});
let pchan = pipes::SharedChan(pchan);
for uint::range(0_u, size) |j| {
let cchan = pchan.clone();
- do task::spawn |move cchan| { cchan.send(chanmb(j, size)) };
+ do task::spawn || { cchan.send(chanmb(j, size)) };
};
writer(path, pport, size);
}
} else {
let p = pipes::PortSet();
let ch = p.chan();
- task::spawn(|move ch| pfib(ch, n - 1) );
+ task::spawn(|| pfib(ch, n - 1) );
let ch = p.chan();
- task::spawn(|move ch| pfib(ch, n - 2) );
+ task::spawn(|| pfib(ch, n - 2) );
c.send(p.recv() + p.recv());
}
}
let (p, ch) = pipes::stream();
- let _t = task::spawn(|move ch| pfib(ch, n) );
+ let _t = task::spawn(|| pfib(ch, n) );
p.recv()
}
let mut results = ~[];
for range(0, num_tasks) |i| {
do task::task().future_result(|+r| {
- results.push(move r);
+ results.push(r);
}).spawn {
stress_task(i);
}
}
};
- recurse_or_fail(depth, Some(move st));
+ recurse_or_fail(depth, Some(st));
}
}
// This used to be O(n^2) in the number of generations that ever existed.
// With this code, only as many generations are alive at a time as tasks
// alive at a time,
- let c = ~mut Some(move c);
- do task::spawn_supervised |move c| {
+ let c = ~mut Some(c);
+ do task::spawn_supervised || {
let c = option::swap_unwrap(c);
if gens_left & 1 == 1 {
task::yield(); // shake things up a bit
}
if gens_left > 0 {
- child_generation(gens_left - 1, move c); // recurse
+ child_generation(gens_left - 1, c); // recurse
} else {
c.send(())
}
};
let (p,c) = pipes::stream();
- child_generation(uint::from_str(args[1]).get(), move c);
+ child_generation(uint::from_str(args[1]).get(), c);
if p.try_recv().is_none() {
fail!(~"it happened when we slumbered");
}
fn spawn_supervised_blocking(myname: &str, +f: fn~()) {
let mut res = None;
- task::task().future_result(|+r| res = Some(move r)).supervised().spawn(move f);
+ task::task().future_result(|+r| res = Some(r)).supervised().spawn(f);
error!("%s group waiting", myname);
- let x = option::unwrap(move res).recv();
+ let x = option::unwrap(res).recv();
assert x == task::Success;
}
fn main() {
let x = Some(X { x: () });
- match move x {
- Some(ref _y @ move _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
+ match x {
+ Some(ref _y @ _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
None => fail!()
}
}
fn main() {
let x = Some((X { x: () }, X { x: () }));
- match move x {
- Some((ref _y, move _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
+ match x {
+ Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
None => fail!()
}
}
fn main() {
let x = some2(X { x: () }, X { x: () });
- match move x {
- some2(ref _y, move _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
+ match x {
+ some2(ref _y, _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
none2 => fail!()
}
}
fn main() {
let x = Some((X { x: () }, X { x: () }));
- match move x {
- Some((move _y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
+ match x {
+ Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
None => fail!()
}
}
let (p,c) = pipes::stream();
let x = Some(p);
c.send(false);
- match move x {
- Some(move z) if z.recv() => { fail!() }, //~ ERROR cannot bind by-move into a pattern guard
- Some(move z) => { assert !z.recv(); },
+ match x {
+ Some(z) if z.recv() => { fail!() }, //~ ERROR cannot bind by-move into a pattern guard
+ Some(z) => { assert !z.recv(); },
None => fail!()
}
}
fn main() {
let x = Some(X { x: () });
match x {
- Some(move _z) => { }, //~ ERROR cannot bind by-move when matching an lvalue
+ Some(_z) => { }, //~ ERROR cannot bind by-move when matching an lvalue
None => fail!()
}
}
fn main() {
let x = Y { y: Some(X { x: () }) };
match x.y {
- Some(move _z) => { }, //~ ERROR cannot bind by-move when matching an lvalue
+ Some(_z) => { }, //~ ERROR cannot bind by-move when matching an lvalue
None => fail!()
}
}
fn main() {
let x = Some(X { x: () });
- match move x {
- Some(move _y @ ref _z) => { }, //~ ERROR cannot bind by-move with sub-bindings
+ match x {
+ Some(_y @ ref _z) => { }, //~ ERROR cannot bind by-move with sub-bindings
None => fail!()
}
}
fn main() {
let x = foo(~3);
- let _y = x + move x;
+ let _y = x + x;
//~^ ERROR moving out of immutable local variable prohibited due to outstanding loan
}
// except according to those terms.
fn foo(x: *~int) -> ~int {
- let y = move *x; //~ ERROR dereference of unsafe pointer requires unsafe function or block
+ let y = *x; //~ ERROR dereference of unsafe pointer requires unsafe function or block
return y;
}
[_a, ..tail] => tail,
_ => fail!(~"foo")
};
- move tail
+ tail
}
fn main() {
[_a, ..tail] => &tail[0],
_ => fail!(~"foo")
};
- move tail
+ tail
}
fn main() {
}
fn main() {
- let x = move foo(10);
+ let x = foo(10);
let _y = copy x;
//~^ ERROR copying a value of non-copyable type `foo`
log(error, x);
let mut res = foo(x);
let mut v = ~[];
- v = move ~[(move res)] + v; //~ instantiating a type parameter with an incompatible type `foo`, which does not fulfill `Copy`
+ v = ~[(res)] + v; //~ instantiating a type parameter with an incompatible type `foo`, which does not fulfill `Copy`
assert (v.len() == 2);
}
fn main() {
let a1 = ~S{ s: true, cant_nest: () };
- let _a2 = ~S{ s: move a1, cant_nest: () };
+ let _a2 = ~S{ s: a1, cant_nest: () };
}
let x = @3u;
let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
let _ = fn~(copy x) { foo(x); }; //~ ERROR value has non-owned type `@uint`
- let _ = fn~(move x) { foo(x); }; //~ ERROR value has non-owned type `@uint`
+ let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
}
fn main() {
let x = r { x: () };
- fn@(move x) { copy x; }; //~ ERROR copying a value of non-copyable type
+ fn@() { copy x; }; //~ ERROR copying a value of non-copyable type
}
}
fn main() {
- let x = move foo(10);
+ let x = foo(10);
let _y = copy x; //~ ERROR copying a value of non-copyable type
log(error, x);
}
}
fn main() {
- let i = move ~r { b: true };
+ let i = ~r { b: true };
let _j = copy i; //~ ERROR copying a value of non-copyable type
log(debug, i);
}
fn main() {
let i = ~@100;
- f(move i); //~ ERROR does not fulfill `Owned`
+ f(i); //~ ERROR does not fulfill `Owned`
}
fn main() {
let i1 = @mut 0;
let i2 = @mut 1;
- let r1 = move ~[~r { i: i1 }];
- let r2 = move ~[~r { i: i2 }];
+ let r1 = ~[~r { i: i1 }];
+ let r2 = ~[~r { i: i2 }];
f(copy r1, copy r2);
//~^ ERROR copying a value of non-copyable type
//~^^ ERROR copying a value of non-copyable type
fn main() {
let cat = ~"kitty";
let (_, ch) = pipes::stream(); //~ ERROR does not fulfill `Owned`
- ch.send(foo(42, @(move cat))); //~ ERROR does not fulfill `Owned`
+ ch.send(foo(42, @(cat))); //~ ERROR does not fulfill `Owned`
}
fn main() {
// This can't make sense as it would copy the classes
- let i = move ~[r(0)];
- let j = move ~[r(1)];
+ let i = ~[r(0)];
+ let j = ~[r(1)];
let k = i + j;
log(debug, j);
}
// error-pattern:ran out of stack
fn main() {
- eat(move @0);
+ eat(@0);
}
fn eat(
+a: @int
) {
- eat(move a)
+ eat(a)
}
// xfail-test
// error-pattern:ran out of stack
fn main() {
- eat(move ~0);
+ eat(~0);
}
fn eat(
+a: ~int
) {
- eat(move a)
+ eat(a)
}
unsafe {
let i1 = ~0;
let i1p = cast::reinterpret_cast(&i1);
- cast::forget(move i1);
+ cast::forget(i1);
let x = @r(i1p);
failfn();
log(error, x);
fn main() {
let b = @0;
- let g : fn@() = |move b|f(b);
+ let g : fn@() = || f(b);
g();
}
fn main() {
let a = @0;
- f(move a);
+ f(a);
}
fn main() {
@0;
- let r = move r(0);
+ let r = r(0);
}
fn main() {
@0;
- let r = move r(0);
+ let r = r(0);
fail!();
}
pub fn main() {
let x = Some(private::exclusive(true));
- match move x {
+ match x {
Some(ref z) if z.with(|b| *b) => {
do z.with |b| { assert *b; }
},
pub fn main() {
let mut a = X {mut x: 1}, b = 2, c = 3;
- assert (f1(a, &mut b, move c) == 6);
+ assert (f1(a, &mut b, c) == 6);
assert (a.x == 0);
assert (b == 10);
assert (f2(a.x, |x| a.x = 50 ) == 0);
let ebml_w = &EBWriter::Encoder(wr);
a1.encode(ebml_w)
};
- let d = EBReader::Doc(@move bytes);
+ let d = EBReader::Doc(@bytes);
let a2: A = Decodable::decode(&EBReader::Decoder(d));
assert *a1 == a2;
}
impl<T> Pushable<T> for ~[T] {
fn push_val(&mut self, +t: T) {
- self.push(move t);
+ self.push(t);
}
}
pub fn main() {
let p = arc::arc(true);
let x = Some(p);
- match move x {
- Some(move z) => { dispose(z); },
+ match x {
+ Some(z) => { dispose(z); },
None => fail!()
}
}
fn bar(x: *~int) -> ~int {
unsafe {
- let y = move *x;
+ let y = *x;
return y;
}
}
pub fn main() {
let x = ~1;
let y = ptr::addr_of(&(*x)) as uint;
- let lam_move = fn@(move x) -> uint { ptr::addr_of(&(*x)) as uint };
+ let lam_move = fn@() -> uint { ptr::addr_of(&(*x)) as uint };
assert lam_move() == y;
let x = ~2;
let y = ptr::addr_of(&(*x)) as uint;
- let lam_move: fn@() -> uint = |move x| ptr::addr_of(&(*x)) as uint;
+ let lam_move: fn@() -> uint = || ptr::addr_of(&(*x)) as uint;
assert lam_move() == y;
let x = ~3;
let y = ptr::addr_of(&(*x)) as uint;
- let snd_move = fn~(move x) -> uint { ptr::addr_of(&(*x)) as uint };
+ let snd_move = fn~() -> uint { ptr::addr_of(&(*x)) as uint };
assert snd_move() == y;
let x = ~4;
let y = ptr::addr_of(&(*x)) as uint;
- let lam_move: fn~() -> uint = |move x| ptr::addr_of(&(*x)) as uint;
+ let lam_move: fn~() -> uint = || ptr::addr_of(&(*x)) as uint;
assert lam_move() == y;
}
cat {
meows: in_x,
how_hungry: in_y,
- info: move in_info
+ info: in_info
}
}
assert *e == exp[i];
}
- let v = dvec::unwrap(move d);
+ let v = dvec::unwrap(d);
assert v == exp;
}
// This is what the signature to spawn should look like with bare functions
fn spawn<T: Owned>(val: T, f: extern fn(T)) {
- f(move val);
+ f(val);
}
fn f(+i: int) {
for inputs.each |i| {
let ctrl = ctrl.clone();
let i = copy *i;
- task::spawn(|move i| map_task(ctrl.clone(), copy i) );
+ task::spawn(|| map_task(ctrl.clone(), copy i) );
}
}
fn test_box() {
let i = @mut 0;
{
- let a = move @r(i);
+ let a = @r(i);
}
assert *i == 1;
}
fn test_rec() {
let i = @mut 0;
{
- let a = move Box {x: r(i)};
+ let a = Box {x: r(i)};
}
assert *i == 1;
}
let i = @mut 0;
{
- let a = move t0(r(i));
+ let a = t0(r(i));
}
assert *i == 1;
}
fn test_tup() {
let i = @mut 0;
{
- let a = move (r(i), 0);
+ let a = (r(i), 0);
}
assert *i == 1;
}
fn test_unique() {
let i = @mut 0;
{
- let a = move ~r(i);
+ let a = ~r(i);
}
assert *i == 1;
}
fn test_box_rec() {
let i = @mut 0;
{
- let a = move @Box {
+ let a = @Box {
x: r(i)
};
}
unsafe {
let mut x = @1;
let mut y = @2;
- rusti::move_val(&mut y, move x);
+ rusti::move_val(&mut y, x);
assert *y == 1;
}
}
pub fn main() {
let x = 1;
- let y = fn@(move x) -> int {
+ let y = fn@() -> int {
x
}();
}
}
fn foldl<A,B,IA:iterable<A>>(self: IA, +b0: B, blk: fn(B, A) -> B) -> B {
- let mut b = move b0;
+ let mut b = b0;
do self.iter |a| {
- b = move blk(b, a);
+ b = blk(b, a);
}
- move b
+ b
}
fn range(lo: uint, hi: uint, it: fn(uint)) {
// We should consider moving this to ::core::unsafe, although I
// suspect graydon would want us to use void pointers instead.
pub unsafe fn uniquify<T>(+x: *T) -> ~T {
- unsafe { cast::transmute(move x) }
+ unsafe { cast::transmute(x) }
}
pub fn swap_state_acq(+dst: &mut state, src: state) -> state {
unsafe {
- transmute(rusti::atomic_xchg_acq(transmute(move dst), src as int))
+ transmute(rusti::atomic_xchg_acq(transmute(dst), src as int))
}
}
pub fn swap_state_rel(+dst: &mut state, src: state) -> state {
unsafe {
- transmute(rusti::atomic_xchg_rel(transmute(move dst), src as int))
+ transmute(rusti::atomic_xchg_rel(transmute(dst), src as int))
}
}
let p = p.unwrap();
let p = unsafe { uniquify(p) };
assert (*p).payload.is_none();
- (*p).payload = move Some(move payload);
+ (*p).payload = Some(payload);
let old_state = swap_state_rel(&mut (*p).state, full);
match old_state {
empty => {
// Yay, fastpath.
// The receiver will eventually clean this up.
- unsafe { forget(move p); }
+ unsafe { forget(p); }
}
full => { fail!(~"duplicate send") }
blocked => {
// The receiver will eventually clean this up.
- unsafe { forget(move p); }
+ unsafe { forget(p); }
}
terminated => {
// The receiver will never receive this. Rely on drop_glue
full => {
let mut payload = None;
payload <-> (*p).payload;
- return Some(option::unwrap(move payload))
+ return Some(option::unwrap(payload))
}
terminated => {
assert old_state == terminated;
match swap_state_rel(&mut (*p).state, terminated) {
empty | blocked => {
// The receiver will eventually clean up.
- unsafe { forget(move p) }
+ unsafe { forget(p) }
}
full => {
// This is impossible
match swap_state_rel(&mut (*p).state, terminated) {
empty => {
// the sender will clean up
- unsafe { forget(move p) }
+ unsafe { forget(p) }
}
blocked => {
// this shouldn't happen.
if self.p != None {
let mut p = None;
p <-> self.p;
- sender_terminate(option::unwrap(move p))
+ sender_terminate(option::unwrap(p))
}
}
}
fn unwrap() -> *packet<T> {
let mut p = None;
p <-> self.p;
- option::unwrap(move p)
+ option::unwrap(p)
}
}
if self.p != None {
let mut p = None;
p <-> self.p;
- receiver_terminate(option::unwrap(move p))
+ receiver_terminate(option::unwrap(p))
}
}
}
fn unwrap() -> *packet<T> {
let mut p = None;
p <-> self.p;
- option::unwrap(move p)
+ option::unwrap(p)
}
}
let addr : *::pipes::send_packet<pong> = match &p {
&ping(ref x) => { cast::transmute(ptr::addr_of(x)) }
};
- let liberated_value = move *addr;
- cast::forget(move p);
- move liberated_value
+ let liberated_value = *addr;
+ cast::forget(p);
+ liberated_value
}
}
let addr : *::pipes::send_packet<ping> = match &p {
&pong(ref x) => { cast::transmute(ptr::addr_of(x)) }
};
- let liberated_value = move *addr;
- cast::forget(move p);
- move liberated_value
+ let liberated_value = *addr;
+ cast::forget(p);
+ liberated_value
}
}
pub fn do_ping(-c: ping) -> pong {
let (sp, rp) = ::pipes::entangle();
- ::pipes::send(move c, pingpong::ping(move sp));
- move rp
+ ::pipes::send(c, pingpong::ping(sp));
+ rp
}
pub fn do_pong(-c: pong) -> (ping, ()) {
- let packet = ::pipes::recv(move c);
+ let packet = ::pipes::recv(c);
if packet.is_none() {
fail!(~"sender closed the connection")
}
- (pingpong::liberate_pong(option::unwrap(move packet)), ())
+ (pingpong::liberate_pong(option::unwrap(packet)), ())
}
}
pub type pong = ::pipes::send_packet<pingpong::pong>;
pub fn do_ping(-c: ping) -> (pong, ()) {
- let packet = ::pipes::recv(move c);
+ let packet = ::pipes::recv(c);
if packet.is_none() {
fail!(~"sender closed the connection")
}
- (pingpong::liberate_ping(option::unwrap(move packet)), ())
+ (pingpong::liberate_ping(option::unwrap(packet)), ())
}
pub fn do_pong(-c: pong) -> ping {
let (sp, rp) = ::pipes::entangle();
- ::pipes::send(move c, pingpong::pong(move sp));
- move rp
+ ::pipes::send(c, pingpong::pong(sp));
+ rp
}
}
}
fn client(-chan: pingpong::client::ping) {
- let chan = pingpong::client::do_ping(move chan);
+ let chan = pingpong::client::do_ping(chan);
log(error, ~"Sent ping");
- let (_chan, _data) = pingpong::client::do_pong(move chan);
+ let (_chan, _data) = pingpong::client::do_pong(chan);
log(error, ~"Received pong");
}
fn server(-chan: pingpong::server::ping) {
- let (chan, _data) = pingpong::server::do_ping(move chan);
+ let (chan, _data) = pingpong::server::do_ping(chan);
log(error, ~"Received ping");
- let _chan = pingpong::server::do_pong(move chan);
+ let _chan = pingpong::server::do_pong(chan);
log(error, ~"Sent pong");
}
let client_ = ~mut Some(client_);
let server_ = ~mut Some(server_);
- task::spawn {|move client_|
+ task::spawn {|client_|
let mut client__ = none;
*client_ <-> client__;
client(option::unwrap(client__));
};
- task::spawn {|move server_|
+ task::spawn {|server_|
let mut server_ËŠ = none;
*server_ <-> server_ËŠ;
server(option::unwrap(server_ËŠ));
fn rendezvous() {
let (c, s) = streamp::init();
- let streams: ~[streamp::client::open<int>] = ~[move c];
+ let streams: ~[streamp::client::open<int>] = ~[c];
error!("%?", streams[0]);
}
}
fn read_board_grid<rdr: &static io::Reader>(+in: rdr) -> ~[~[square]] {
- let in = (move in) as io::Reader;
+ let in = (in) as io::Reader;
let mut grid = ~[];
for in.each_line |line| {
let mut row = ~[];
pub fn main() {
let (bc, _bp) = stream::init();
- stream::client::send(move bc, ~"abc");
+ stream::client::send(bc, ~"abc");
}
pub fn main() {
let (p,c) = pipes::stream();
- do task::try |move c| {
+ do task::try || {
let (p2,c2) = pipes::stream();
- do task::spawn |move p2| {
+ do task::spawn || {
p2.recv();
error!("sibling fails");
fail!();
}
let (p3,c3) = pipes::stream();
- c.send(move c3);
+ c.send(c3);
c2.send(());
error!("child blocks");
p3.recv();
pub fn main() {
let (p,c) = pipes::stream();
- do task::try |move c| {
+ do task::try || {
let (p2,c2) = pipes::stream();
- do task::spawn |move p2| {
+ do task::spawn || {
p2.recv();
error!("sibling fails");
fail!();
}
let (p3,c3) = pipes::stream();
- c.send(move c3);
+ c.send(c3);
c2.send(());
error!("child blocks");
let (p, c) = pipes::stream();
- (move p, move p3).select();
+ (p, p3).select();
c.send(());
};
error!("parent tries");
pub fn main() {
let z = thing();
- (move z).f();
+ (z).f();
}
next: option::None
};
- self.next = Some(@(move newList));
+ self.next = Some(@(newList));
}
}
pub fn main()
{
let y = ~1;
- move y;
+ y;
}
fn exec<T: JD>() {
let doc = result::unwrap(json::from_str(""));
- let _v: T = deserialize(&json::Deserializer(move doc));
+ let _v: T = deserialize(&json::Deserializer(doc));
fail!()
}
fn lp<T>(s: ~str, f: fn(~str) -> T) -> T {
while false {
let r = f(s);
- return (move r);
+ return (r);
}
fail!();
}
fn apply<T>(s: ~str, f: fn(~str) -> T) -> T {
fn g<T>(s: ~str, f: fn(~str) -> T) -> T {f(s)}
- g(s, |v| { let r = f(v); move r })
+ g(s, |v| { let r = f(v); r })
}
pub fn main() {}
fn foo() -> fn@() -> int {
let k = ~22;
let _u = A {a: copy k};
- return fn@(move k) -> int { 22 };
+ return fn@() -> int { 22 };
}
pub fn main() {
loop {
let x = 5;
if x > 3 {
- list += ~[take(move x)];
+ list += ~[take(x)];
} else {
break;
}
fn mk<T>() -> @Smallintmap<T> {
let mut v: ~[option<T>] = ~[];
- return @Smallintmap {mut v: move v};
+ return @Smallintmap {mut v: v};
}
fn f<T,U>() {
impl<A: Copy Serializable> Serializable for F<A> {
fn serialize<S: Serializer>(s: S) {
- self.a.serialize(move s);
+ self.a.serialize(s);
}
}
fn test(x: bool, foo: ~Triple) -> int {
let bar = foo;
let mut y: ~Triple;
- if x { y = move bar; } else { y = ~Triple{x: 4, y: 5, z: 6}; }
+ if x { y = bar; } else { y = ~Triple{x: 4, y: 5, z: 6}; }
return y.y;
}
fn test(x: bool, foo: @Triple) -> int {
let bar = foo;
let mut y: @Triple;
- if x { y = move bar; } else { y = @Triple{x: 4, y: 5, z: 6}; }
+ if x { y = bar; } else { y = @Triple{x: 4, y: 5, z: 6}; }
return y.y;
}
struct X { x: int, y: int, z: int }
-pub fn main() { let x = ~X{x: 1, y: 2, z: 3}; let y = move x; assert (y.y == 2); }
+pub fn main() { let x = ~X{x: 1, y: 2, z: 3}; let y = x; assert (y.y == 2); }
struct X { x: int, y: int, z: int }
-pub fn main() { let x = @X {x: 1, y: 2, z: 3}; let y = move x; assert (y.y == 2); }
+pub fn main() { let x = @X {x: 1, y: 2, z: 3}; let y = x; assert (y.y == 2); }
fn test(x: bool, foo: ~Triple) -> int {
let bar = foo;
let mut y: ~Triple;
- if x { y = move bar; } else { y = ~Triple {x: 4, y: 5, z: 6}; }
+ if x { y = bar; } else { y = ~Triple {x: 4, y: 5, z: 6}; }
return y.y;
}
fn test(x: bool, foo: @Triple) -> int {
let bar = foo;
let mut y: @Triple;
- if x { y = move bar; } else { y = @Triple{x: 4, y: 5, z: 6}; }
+ if x { y = bar; } else { y = @Triple{x: 4, y: 5, z: 6}; }
return y.y;
}
fn test(foo: ~Triple) -> ~Triple {
let foo = foo;
- let bar = move foo;
- let baz = move bar;
- let quux = move baz;
+ let bar = foo;
+ let baz = bar;
+ let quux = baz;
return quux;
}
fn test(foo: @Triple) -> @Triple {
let foo = foo;
- let bar = move foo;
- let baz = move bar;
- let quux = move baz;
+ let bar = foo;
+ let baz = bar;
+ let quux = baz;
return quux;
}
pub fn main() {
let x = ~~[10];
// Test forgetting a local by move-in
- test(move x);
+ test(x);
// Test forgetting a temporary by move-in.
test(~~[10]);
pub fn main() {
let x = @~[10];
// Test forgetting a local by move-in
- test(move x);
+ test(x);
// Test forgetting a temporary by move-in.
test(@~[10]);
fn test(-foo: int) { assert (foo == 10); }
-pub fn main() { let x = 10; test(move x); }
+pub fn main() { let x = 10; test(x); }
fn f2(-thing: fn@()) { }
fn f(-thing: fn@()) {
- f2(move thing);
+ f2(thing);
}
pub fn main() {
let y: int = 42;
let mut x: int;
- x = move y;
+ x = y;
assert (x == 42);
}
impl S {
fn foo(self) {
- (move self).bar();
+ self.bar();
}
fn bar(self) {
}
fn apply<T>(x: T, f: fn(T)) {
- f(move x);
+ f(x);
}
fn check_int(x: int) {
}
fn unwrap<T>(+o: Option<T>) -> T {
- match move o {
- Some(move v) => move v,
+ match o {
+ Some(v) => v,
None => fail!()
}
}
{
let b = Some(dtor { x:x });
- let c = unwrap(move b);
+ let c = unwrap(b);
}
assert *x == 0;
)
macro_rules! move_it (
- { $x:expr } => { unsafe { let y = move *ptr::addr_of(&($x)); move y } }
+ { $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }
)
fn switch<T: Owned, U>(+endp: pipes::RecvPacket<T>,
f: fn(+v: Option<T>) -> U) -> U {
- f(pipes::try_recv(move endp))
+ f(pipes::try_recv(endp))
}
-fn move_it<T>(-x: T) -> T { move x }
+fn move_it<T>(-x: T) -> T { x }
macro_rules! follow (
{
$($message:path$(($($x: ident),+))||* -> $next:ident $e:expr)+
} => (
- |m| match move m {
+ |m| match m {
$(Some($message($($($x,)+)* next)) => {
let $next = move_it!(next);
$e })+
fn client_follow(+bank: bank::client::login) {
use bank::*;
- let bank = client::login(move bank, ~"theincredibleholk", ~"1234");
- let bank = switch(move bank, follow! (
- ok -> connected { move connected }
+ let bank = client::login(bank, ~"theincredibleholk", ~"1234");
+ let bank = switch(bank, follow! (
+ ok -> connected { connected }
invalid -> _next { fail!(~"bank closed the connected") }
));
- let bank = client::deposit(move bank, 100.00);
- let bank = client::withdrawal(move bank, 50.00);
- switch(move bank, follow! (
+ let bank = client::deposit(bank, 100.00);
+ let bank = client::withdrawal(bank, 50.00);
+ switch(bank, follow! (
money(m) -> _next {
io::println(~"Yay! I got money!");
}
fn bank_client(+bank: bank::client::login) {
use bank::*;
- let bank = client::login(move bank, ~"theincredibleholk", ~"1234");
- let bank = match try_recv(move bank) {
+ let bank = client::login(bank, ~"theincredibleholk", ~"1234");
+ let bank = match try_recv(bank) {
Some(ok(connected)) => {
move_it!(connected)
}
None => { fail!(~"bank closed the connection") }
};
- let bank = client::deposit(move bank, 100.00);
- let bank = client::withdrawal(move bank, 50.00);
- match try_recv(move bank) {
+ let bank = client::deposit(bank, 100.00);
+ let bank = client::withdrawal(bank, 50.00);
+ match try_recv(bank) {
Some(money(*)) => {
io::println(~"Yay! I got money!");
}
let iotask = &uv::global_loop::get();
pipes::spawn_service(oneshot::init, |p| {
- match try_recv(move p) {
+ match try_recv(p) {
Some(*) => { fail!() }
None => { }
}
fn failtest() {
let (c, p) = oneshot::init();
- do task::spawn_with(move c) |_c| {
+ do task::spawn_with(c) |_c| {
fail!();
}
- error!("%?", recv(move p));
+ error!("%?", recv(p));
// make sure we get killed if we missed it in the receive.
loop { task::yield() }
}
assert !pipes::peek(&p);
- oneshot::client::signal(move c);
+ oneshot::client::signal(c);
assert pipes::peek(&p);
}
pong: mk_packet::<pong>()
}
};
- do pipes::entangle_buffer(move buffer) |buffer, data| {
+ do pipes::entangle_buffer(buffer) |buffer, data| {
data.ping.set_buffer(buffer);
data.pong.set_buffer(buffer);
ptr::addr_of(&(data.ping))
let b = pipe.reuse_buffer();
let s = SendPacketBuffered(ptr::addr_of(&(b.buffer.data.pong)));
let c = RecvPacketBuffered(ptr::addr_of(&(b.buffer.data.pong)));
- let message = ::pingpong::ping(move s);
- ::pipes::send(move pipe, move message);
- move c
+ let message = ::pingpong::ping(s);
+ ::pipes::send(pipe, message);
+ c
}
}
pub type ping = pipes::SendPacketBuffered<::pingpong::ping,
let b = pipe.reuse_buffer();
let s = SendPacketBuffered(ptr::addr_of(&(b.buffer.data.ping)));
let c = RecvPacketBuffered(ptr::addr_of(&(b.buffer.data.ping)));
- let message = ::pingpong::pong(move s);
- ::pipes::send(move pipe, move message);
- move c
+ let message = ::pingpong::pong(s);
+ ::pipes::send(pipe, message);
+ c
}
}
pub type pong = pipes::SendPacketBuffered<::pingpong::pong,
pub fn client(-chan: ::pingpong::client::ping) {
use pingpong::client;
- let chan = client::ping(move chan); return;
+ let chan = client::ping(chan); return;
log(error, "Sent ping");
- let pong(_chan) = recv(move chan);
+ let pong(_chan) = recv(chan);
log(error, "Received pong");
}
pub fn server(-chan: ::pingpong::server::ping) {
use pingpong::server;
- let ping(chan) = recv(move chan); return;
+ let ping(chan) = recv(chan); return;
log(error, "Received ping");
- let _chan = server::pong(move chan);
+ let _chan = server::pong(chan);
log(error, "Sent pong");
}
}
pub fn main() {
let (client_, server_) = ::pingpong::init();
- let client_ = ~mut Some(move client_);
- let server_ = ~mut Some(move server_);
- do task::spawn |move client_| {
+ let client_ = ~mut Some(client_);
+ let server_ = ~mut Some(server_);
+ do task::spawn || {
let mut client__ = None;
*client_ <-> client__;
- test::client(option::unwrap(move client__));
+ test::client(option::unwrap(client__));
};
- do task::spawn |move server_| {
+ do task::spawn || {
let mut server_ËŠ = None;
*server_ <-> server_ËŠ;
- test::server(option::unwrap(move server_ËŠ));
+ test::server(option::unwrap(server_ËŠ));
};
}
pub fn client(-chan: ::pingpong::client::ping) {
use pingpong::client;
- let chan = client::ping(move chan);
+ let chan = client::ping(chan);
log(error, ~"Sent ping");
- let pong(_chan) = recv(move chan);
+ let pong(_chan) = recv(chan);
log(error, ~"Received pong");
}
pub fn server(-chan: ::pingpong::server::ping) {
use pingpong::server;
- let ping(chan) = recv(move chan);
+ let ping(chan) = recv(chan);
log(error, ~"Received ping");
- let _chan = server::pong(move chan);
+ let _chan = server::pong(chan);
log(error, ~"Sent pong");
}
}
pub fn main() {
let (client_, server_) = pingpong::init();
- let client_ = ~mut Some(move client_);
- let server_ = ~mut Some(move server_);
+ let client_ = ~mut Some(client_);
+ let server_ = ~mut Some(server_);
- do task::spawn |move client_| {
+ do task::spawn || {
let mut client__ = None;
*client_ <-> client__;
- test::client(option::unwrap(move client__));
+ test::client(option::unwrap(client__));
};
- do task::spawn |move server_| {
+ do task::spawn || {
let mut server_ËŠ = None;
*server_ <-> server_ËŠ;
- test::server(option::unwrap(move server_ËŠ));
+ test::server(option::unwrap(server_ËŠ));
};
}
], )*
} => {
if $index == $count {
- match move pipes::try_recv(move $port) {
- $(Some($message($($(move $x,)+)* move next)) => {
- let $next = move next;
- move $e
+ match pipes::try_recv($port) {
+ $(Some($message($($($x,)+)* next)) => {
+ let $next = next;
+ $e
})+
_ => fail!()
}
}
fn draw_frame(+channel: double_buffer::client::acquire) {
- let channel = request(move channel);
+ let channel = request(channel);
select! (
channel => {
give_buffer(buffer) -> channel {
render(&buffer);
- release(move channel, move buffer)
+ release(channel, buffer)
}
}
);
}
fn draw_two_frames(+channel: double_buffer::client::acquire) {
- let channel = request(move channel);
+ let channel = request(channel);
let channel = select! (
channel => {
give_buffer(buffer) -> channel {
render(&buffer);
- release(move channel, move buffer)
+ release(channel, buffer)
}
}
);
- let channel = request(move channel);
+ let channel = request(channel);
select! (
channel => {
give_buffer(buffer) -> channel {
render(&buffer);
- release(move channel, move buffer)
+ release(channel, buffer)
}
}
);
channel => {
give_buffer(buffer) -> channel {
render(&buffer);
- release(channel, move buffer)
+ release(channel, buffer)
}
}
);
channel => {
give_buffer(buffer) -> channel {
render(&buffer);
- release(channel, move buffer);
+ release(channel, buffer);
render(&buffer);
- release(channel, move buffer);
+ release(channel, buffer);
}
}
);
let c = pipes::spawn_service(stream::init, |p| {
error!("waiting for pipes");
- let stream::send(x, p) = recv(move p);
+ let stream::send(x, p) = recv(p);
error!("got pipes");
let (left, right) : (oneshot::server::waiting,
oneshot::server::waiting)
- = move x;
+ = x;
error!("selecting");
- let (i, _, _) = select(~[move left, move right]);
+ let (i, _, _) = select(~[left, right]);
error!("selected");
assert i == 0;
error!("waiting for pipes");
- let stream::send(x, _) = recv(move p);
+ let stream::send(x, _) = recv(p);
error!("got pipes");
let (left, right) : (oneshot::server::waiting,
oneshot::server::waiting)
- = move x;
+ = x;
error!("selecting");
- let (i, m, _) = select(~[move left, move right]);
+ let (i, m, _) = select(~[left, right]);
error!("selected %?", i);
if m.is_some() {
assert i == 1;
let (c1, p1) = oneshot::init();
let (_c2, p2) = oneshot::init();
- let c = send(move c, (move p1, move p2));
+ let c = send(c, (p1, p2));
sleep(iotask, 100);
- signal(move c1);
+ signal(c1);
let (_c1, p1) = oneshot::init();
let (c2, p2) = oneshot::init();
- send(move c, (move p1, move p2));
+ send(c, (p1, p2));
sleep(iotask, 100);
- signal(move c2);
+ signal(c2);
test_select2();
}
let (ac, ap) = stream::init();
let (bc, bp) = stream::init();
- stream::client::send(move ac, 42);
+ stream::client::send(ac, 42);
- match pipes::select2(move ap, move bp) {
+ match pipes::select2(ap, bp) {
either::Left(*) => { }
either::Right(*) => { fail!() }
}
- stream::client::send(move bc, ~"abc");
+ stream::client::send(bc, ~"abc");
error!("done with first select2");
let (ac, ap) = stream::init();
let (bc, bp) = stream::init();
- stream::client::send(move bc, ~"abc");
+ stream::client::send(bc, ~"abc");
- match pipes::select2(move ap, move bp) {
+ match pipes::select2(ap, bp) {
either::Left(*) => { fail!() }
either::Right(*) => { }
}
- stream::client::send(move ac, 42);
+ stream::client::send(ac, 42);
}
pub fn main() {
use oneshot::client::*;
- let c = pipes::spawn_service(oneshot::init, |p| { recv(move p); });
+ let c = pipes::spawn_service(oneshot::init, |p| { recv(p); });
let iotask = &uv::global_loop::get();
sleep(iotask, 500);
- signal(move c);
+ signal(c);
}
}
fn box_it(+x: &r/fn()) -> closure_box/&r {
- closure_box {cl: move x}
+ closure_box {cl: x}
}
pub fn main() {
}
fn box_it(+x: &r/fn()) -> closure_box/&r {
- closure_box {cl: move x}
+ closure_box {cl: x}
}
fn call_static_closure(cl: closure_box/&static) {
pub fn main() {
let cl_box = box_it(|| debug!("Hello, world!"));
- call_static_closure(move cl_box);
+ call_static_closure(cl_box);
}
// Even though these look like copies, they are guaranteed not to be
{
let a = r(i);
- let b = (move a, 10);
- let (c, _d) = move b;
+ let b = (a, 10);
+ let (c, _d) = b;
log(debug, c);
}
assert *i == 1;
unsafe {
let i1 = ~0;
let i1p = cast::reinterpret_cast(&i1);
- cast::forget(move i1);
+ cast::forget(i1);
let i2 = ~0;
let i2p = cast::reinterpret_cast(&i2);
- cast::forget(move i2);
+ cast::forget(i2);
let x1 = @t(Node{
mut next: None,
let rs = r(i1p);
debug!("r = %x",
cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&rs)));
- move rs }
+ rs }
});
debug!("x1 = %x, x1.r = %x",
let rs = r(i2p);
debug!("r2 = %x",
cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&rs)));
- move rs
+ rs
}
});
unsafe {
let i1 = ~0xA;
let i1p = cast::reinterpret_cast(&i1);
- cast::forget(move i1);
+ cast::forget(i1);
let i2 = ~0xA;
let i2p = cast::reinterpret_cast(&i2);
- cast::forget(move i2);
+ cast::forget(i2);
let u1 = U {a: 0xB, b: 0xC, c: i1p};
let u2 = U {a: 0xB, b: 0xC, c: i2p};
unsafe {
let i1 = ~0xA;
let i1p = cast::reinterpret_cast(&i1);
- cast::forget(move i1);
+ cast::forget(i1);
let i2 = ~0xA;
let i2p = cast::reinterpret_cast(&i2);
- cast::forget(move i2);
+ cast::forget(i2);
let u1 = U {a: 0xB, b: 0xC, c: i1p};
let u2 = U {a: 0xB, b: 0xC, c: i2p};
pub fn main() {
let my_total = @@mut 10;
- { let pt = move shrinky_pointer(my_total); assert (pt.look_at() == 10); }
+ { let pt = shrinky_pointer(my_total); assert (pt.look_at() == 10); }
log(error, fmt!("my_total = %d", **my_total));
assert (**my_total == 9);
}
let box = @mut 10;
fn dec_box(&&i: @mut int) { *i -= 1; }
- { let _i = move finish(Arg{val: box, fin: dec_box}); }
+ { let _i = finish(Arg{val: box, fin: dec_box}); }
assert (*box == 9);
}
};
let fptr = cast::reinterpret_cast(&ptr::addr_of(&f));
rustrt::start_task(new_task_id, fptr);
- cast::forget(move f);
+ cast::forget(f);
po.recv();
}
}
$count:expr,
$port:path => [
$(type_this $message:path$(($(x $x: ident),+))dont_type_this*
- -> $next:ident => { move $e:expr }),+
+ -> $next:ident => { $e:expr }),+
]
$(, $ports:path => [
$(type_this $messages:path$(($(x $xs: ident),+))dont_type_this*
- -> $nexts:ident => { move $es:expr }),+
+ -> $nexts:ident => { $es:expr }),+
] )*
} => {
if $index == $count {
- match move pipes::try_recv($port) {
- $(Some($message($($(move $x,)+)* move next)) => {
- let $next = move next;
- move $e
+ match pipes::try_recv($port) {
+ $(Some($message($($($x,)+)* next)) => {
+ let $next = next;
+ $e
})+
_ => fail!()
}
$count + 1
$(, $ports => [
$(type_this $messages$(($(x $xs),+))dont_type_this*
- -> $nexts => { move $es }),+
+ -> $nexts => { $es }),+
])*
)
}
} => {
let index = pipes::selecti([$(($port).header()),+]);
select_if!(index, 0 $(, $port => [
- $(type_this $message$(($(x $x),+))dont_type_this* -> $next => { move $e }),+
+ $(type_this $message$(($(x $x),+))dont_type_this* -> $next => { $e }),+
])+)
}
)
log(error, *three + n); // will copy x into the closure
assert(*three == 3);
};
- task::spawn(fn~(move fn_to_send) {
+ task::spawn(fn~() {
test05_start(fn_to_send);
});
}
impl bool_like for bool {
static fn select<A>(&&b: bool, +x1: A, +x2: A) -> A {
- if b { move x1 } else { move x2 }
+ if b { x1 } else { x2 }
}
}
impl bool_like for int {
static fn select<A>(&&b: int, +x1: A, +x2: A) -> A {
- if b != 0 { move x1 } else { move x2 }
+ if b != 0 { x1 } else { x2 }
}
}
fn test05() {
let (po, ch) = pipes::stream();
- task::spawn(|move ch| test05_start(ch) );
+ task::spawn(|| test05_start(ch) );
let mut value = po.recv();
log(error, value);
value = po.recv();
fn start(c: pipes::Chan<pipes::Chan<~str>>) {
let (p, ch) = pipes::stream();
- c.send(move ch);
+ c.send(ch);
let mut a;
let mut b;
log(error, a);
b = p.recv();
assert b == ~"B";
- log(error, move b);
+ log(error, b);
}
pub fn main() {
let (p, ch) = pipes::stream();
- let child = task::spawn(|move ch| start(ch) );
+ let child = task::spawn(|| start(ch) );
let c = p.recv();
c.send(~"A");
fn start(c: pipes::Chan<pipes::Chan<int>>) {
let (p, ch) = pipes::stream();
- c.send(move ch);
+ c.send(ch);
}
pub fn main() {
let (p, ch) = pipes::stream();
- let child = task::spawn(|move ch| start(ch) );
+ let child = task::spawn(|| start(ch) );
let c = p.recv();
}
fn test00() {
let i: int = 0;
let mut result = None;
- do task::task().future_result(|+r| { result = Some(move r); }).spawn {
+ do task::task().future_result(|+r| { result = Some(r); }).spawn {
start(i)
}
}
// Try joining tasks that have already finished.
- option::unwrap(move result).recv();
+ option::unwrap(result).recv();
debug!("Joined task.");
}
pub fn main() {
debug!("Check that we don't deadlock.");
let (p, ch) = pipes::stream();
- task::try(|move ch| start(ch, 0, 10) );
+ task::try(|| start(ch, 0, 10) );
debug!("Joined task");
}
while (i > 0) {
log(debug, i);
let (p, ch) = pipes::stream();
- po.add(move p);
- task::spawn({let i = i; |move ch| child(i, ch)});
+ po.add(p);
+ task::spawn({let i = i; || child(i, ch)});
i = i - 1;
}
// the child's point of view the receiver may die. We should
// drop messages on the floor in this case, and not crash!
let (p, ch) = pipes::stream();
- task::spawn(|move ch| start(ch, 10));
+ task::spawn(|| start(ch, 10));
p.recv();
}
fn test_chan() {
let (po, ch) = pipes::stream();
let (po0, ch0) = pipes::stream();
- ch.send(move ch0);
+ ch.send(ch0);
let ch1 = po.recv();
// Does the transmitted channel still work?
while i < number_of_tasks {
let ch = po.chan();
task::task().future_result(|+r| {
- results.push(move r);
+ results.push(r);
}).spawn({
let i = i;
- |move ch| test00_start(ch, i, number_of_messages)
+ || test00_start(ch, i, number_of_messages)
});
i = i + 1;
}
let number_of_messages: int = 10;
let c = p.chan();
- do task::spawn |move c| {
+ do task::spawn || {
test00_start(c, number_of_messages * 0, number_of_messages);
}
let c = p.chan();
- do task::spawn |move c| {
+ do task::spawn || {
test00_start(c, number_of_messages * 1, number_of_messages);
}
let c = p.chan();
- do task::spawn |move c| {
+ do task::spawn || {
test00_start(c, number_of_messages * 2, number_of_messages);
}
let c = p.chan();
- do task::spawn |move c| {
+ do task::spawn || {
test00_start(c, number_of_messages * 3, number_of_messages);
}
let ch = p.chan();
let mut result = None;
- do task::task().future_result(|+r| { result = Some(move r); }).spawn
- |move ch| {
+ do task::task().future_result(|+r| { result = Some(r); }).spawn
+ || {
test00_start(ch, number_of_messages);
}
i += 1;
}
- option::unwrap(move result).recv();
+ option::unwrap(result).recv();
assert (sum == number_of_messages * (number_of_messages - 1) / 2);
}
// xfail-test
trait A<T> {
- fn g<U>(x: T, y: U) -> (T, U) { (move x, move y) }
+ fn g<U>(x: T, y: U) -> (T, U) { (x, y) }
}
impl A<int> for int { }
fn f<T, U, V: A<T>>(i: V, j: T, k: U) -> (T, U) {
- i.g(move j, move k)
+ i.g(j, k)
}
fn main () {
// xfail-test
trait A<T> {
- fn g(x: T) -> T { move x }
+ fn g(x: T) -> T { x }
}
impl A<int> for int { }
fn f<T, V: A<T>>(i: V, j: T) -> T {
- i.g(move j)
+ i.g(j)
}
fn main () {
#[allow(default_methods)];
trait A {
- fn g<T>(x: T, y: T) -> (T, T) { (move x, move y) }
+ fn g<T>(x: T, y: T) -> (T, T) { (x, y) }
}
impl A for int { }
fn f<T, V: A>(i: V, j: T, k: T) -> (T, T) {
- i.g(move j, move k)
+ i.g(j, k)
}
fn main () {
#[allow(default_methods)];
trait A<T> {
- fn g(x: uint) -> uint { move x }
+ fn g(x: uint) -> uint { x }
}
impl<T> A<T> for int { }
fn f<T, V: A<T>>(i: V, j: uint) -> uint {
- i.g(move j)
+ i.g(j)
}
fn main () {
assert indirect(~[10, 20]) == ~"[10, 20]!";
fn indirect2<T: to_str>(x: T) -> ~str {
- indirect(move x)
+ indirect(x)
}
assert indirect2(~[1]) == ~"[1]!";
}
// except according to those terms.
pub fn main() {
- let i = move ~100;
+ let i = ~100;
assert *i == 100;
}
pub fn main() {
let i = ~100;
- let j = move i;
+ let j = i;
assert *j == 100;
}
pub fn main() {
let i = ~100;
- f(move i);
+ f(i);
}
pub fn main() {
let i = ~100;
let j = ~200;
- let j = move i;
+ let j = i;
assert *j == 100;
}
pub fn main() {
let mut i;
- i = move ~100;
+ i = ~100;
assert *i == 100;
}
pub fn main() {
let i = ~100;
let mut j;
- j = move i;
+ j = i;
assert *j == 100;
}
fn id(x: bool) -> bool { x }
fn call_id() {
- let c = move fail!();
+ let c = fail!();
id(c); //~ WARNING unreachable statement
}
fn id(x: bool) -> bool { x }
fn call_id() {
- let c = move fail!();
+ let c = fail!();
id(c);
}
pub fn main() {
let x = ~1;
- let lam_move = fn@(move x) { };
+ let lam_move = fn@() { };
lam_move();
}
pub fn main()
{
let y = ~1;
- move y;
+ y;
}
}
fn f(c: SharedChan<bool>) {
- let _c = move complainer(c);
+ let _c = complainer(c);
fail!();
}
}
fn f() {
- let c = move complainer(@0);
+ let c = complainer(@0);
fail!();
}
fn notsure() {
let mut _x;
let mut _y = (_x = 0) == (_x = 0);
- let mut _z = (_x = move 0) < (_x = 0);
+ let mut _z = (_x = 0) < (_x = 0);
let _a = (_x += 0) == (_x = 0);
let _b = (_y <-> _z) == (_y <-> _z);
}
break; }
}
-fn evil_lincoln() { let evil = move debug!("lincoln"); }
+fn evil_lincoln() { let evil = debug!("lincoln"); }
pub fn main() {
strange();
let mut x: int;
while z < 50 {
z += 1;
- while false { x = move y; y = z; }
+ while false { x = y; y = z; }
log(debug, y);
}
assert (y == 42 && z == 50);
pub fn main() {
let mut result = None;
- task::task().future_result(|+r| { result = Some(move r); }).spawn(child);
+ task::task().future_result(|+r| { result = Some(r); }).spawn(child);
error!("1");
task::yield();
error!("2");
task::yield();
error!("3");
- option::unwrap(move result).recv();
+ option::unwrap(result).recv();
}
fn child() {
pub fn main() {
let mut result = None;
- task::task().future_result(|+r| { result = Some(move r); }).spawn(child);
+ task::task().future_result(|+r| { result = Some(r); }).spawn(child);
error!("1");
task::yield();
- option::unwrap(move result).recv();
+ option::unwrap(result).recv();
}
fn child() { error!("2"); }