From 4cf51c2531bf754d5eaddaf7c5798b983d399751 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 02:30:30 -0500 Subject: [PATCH 01/10] libstd: Get rid of `move`. --- src/libstd/arc.rs | 84 ++++++++--------- src/libstd/bitv.rs | 10 +- src/libstd/cell.rs | 12 +-- src/libstd/comm.rs | 12 +-- src/libstd/deque.rs | 10 +- src/libstd/ebml.rs | 4 +- src/libstd/flatpipes.rs | 175 +++++++++++++++++------------------ src/libstd/fun_treemap.rs | 2 +- src/libstd/future.rs | 34 +++---- src/libstd/getopts.rs | 8 +- src/libstd/io_util.rs | 4 +- src/libstd/json.rs | 58 ++++++------ src/libstd/net_ip.rs | 10 +- src/libstd/net_tcp.rs | 50 +++++----- src/libstd/net_url.rs | 6 +- src/libstd/oldmap.rs | 4 +- src/libstd/oldsmallintmap.rs | 2 +- src/libstd/par.rs | 4 +- src/libstd/priority_queue.rs | 12 +-- src/libstd/rl.rs | 2 +- src/libstd/rope.rs | 4 +- src/libstd/sha1.rs | 2 +- src/libstd/sort.rs | 18 ++-- src/libstd/sync.rs | 86 ++++++++--------- src/libstd/task_pool.rs | 18 ++-- src/libstd/test.rs | 30 +++--- src/libstd/time.rs | 14 +-- src/libstd/uv_global_loop.rs | 4 +- src/libstd/uv_iotask.rs | 4 +- src/libstd/uv_ll.rs | 1 - src/libstd/workcache.rs | 36 +++---- 31 files changed, 357 insertions(+), 363 deletions(-) diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 59e278f17960f..66b02ae553c4e 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -81,7 +81,7 @@ struct ARC { x: SharedMutableState } /// Create an atomically reference counted wrapper. pub fn ARC(data: T) -> ARC { - ARC { x: unsafe { shared_mutable_state(move data) } } + ARC { x: unsafe { shared_mutable_state(data) } } } /** @@ -113,8 +113,8 @@ pub fn clone(rc: &ARC) -> ARC { * guaranteed to deadlock. */ pub fn unwrap(rc: ARC) -> T { - let ARC { x: x } = move rc; - unsafe { unwrap_shared_mutable_state(move x) } + let ARC { x: x } = rc; + unsafe { unwrap_shared_mutable_state(x) } } impl Clone for ARC { @@ -134,7 +134,7 @@ struct MutexARC { x: SharedMutableState> } /// Create a mutex-protected ARC with the supplied data. pub fn MutexARC(user_data: T) -> MutexARC { - mutex_arc_with_condvars(move user_data, 1) + mutex_arc_with_condvars(user_data, 1) } /** * Create a mutex-protected ARC with the supplied data and a specified number @@ -144,8 +144,8 @@ pub fn mutex_arc_with_condvars(user_data: T, num_condvars: uint) -> MutexARC { let data = MutexARCInner { lock: mutex_with_condvars(num_condvars), - failed: false, data: move user_data }; - MutexARC { x: unsafe { shared_mutable_state(move data) } } + failed: false, data: user_data }; + MutexARC { x: unsafe { shared_mutable_state(data) } } } impl Clone for MutexARC { @@ -220,13 +220,13 @@ impl &MutexARC { */ // FIXME(#3724) make this a by-move method on the arc pub fn unwrap_mutex_arc(arc: MutexARC) -> T { - let MutexARC { x: x } = move arc; - let inner = unsafe { unwrap_shared_mutable_state(move x) }; - let MutexARCInner { failed: failed, data: data, _ } = move inner; + let MutexARC { x: x } = arc; + let inner = unsafe { unwrap_shared_mutable_state(x) }; + let MutexARCInner { failed: failed, data: data, _ } = inner; if failed { fail!(~"Can't unwrap poisoned MutexARC - another task failed inside!") } - move data + data } // Common code for {mutex.access,rwlock.write}{,_cond}. @@ -284,7 +284,7 @@ struct RWARC { /// Create a reader/writer ARC with the supplied data. pub fn RWARC(user_data: T) -> RWARC { - rw_arc_with_condvars(move user_data, 1) + rw_arc_with_condvars(user_data, 1) } /** * Create a reader/writer ARC with the supplied data and a specified number @@ -296,8 +296,8 @@ pub fn rw_arc_with_condvars( { let data = RWARCInner { lock: rwlock_with_condvars(num_condvars), - failed: false, data: move user_data }; - RWARC { x: unsafe { shared_mutable_state(move data) }, cant_nest: () } + failed: false, data: user_data }; + RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () } } impl RWARC { @@ -386,7 +386,7 @@ impl &RWARC { do (*borrow_rwlock(state)).write_downgrade |write_mode| { check_poison(false, (*state).failed); blk(RWWriteMode((&mut (*state).data, - move write_mode, + write_mode, PoisonOnFail(&mut (*state).failed)))) } } @@ -396,9 +396,9 @@ impl &RWARC { fn downgrade(token: RWWriteMode/&a) -> RWReadMode/&a { // The rwlock should assert that the token belongs to us for us. let state = unsafe { get_shared_immutable_state(&self.x) }; - let RWWriteMode((data, t, _poison)) = move token; + let RWWriteMode((data, t, _poison)) = token; // Let readers in - let new_token = (&state.lock).downgrade(move t); + let new_token = (&state.lock).downgrade(t); // Whatever region the input reference had, it will be safe to use // the same region for the output reference. (The only 'unsafe' part // of this cast is removing the mutability.) @@ -406,7 +406,7 @@ impl &RWARC { // Downgrade ensured the token belonged to us. Just a sanity check. assert ptr::ref_eq(&state.data, new_data); // Produce new token - RWReadMode((new_data, move new_token)) + RWReadMode((new_data, new_token)) } } @@ -419,13 +419,13 @@ impl &RWARC { */ // FIXME(#3724) make this a by-move method on the arc pub fn unwrap_rw_arc(arc: RWARC) -> T { - let RWARC { x: x, _ } = move arc; - let inner = unsafe { unwrap_shared_mutable_state(move x) }; - let RWARCInner { failed: failed, data: data, _ } = move inner; + let RWARC { x: x, _ } = arc; + let inner = unsafe { unwrap_shared_mutable_state(x) }; + let RWARCInner { failed: failed, data: data, _ } = inner; if failed { fail!(~"Can't unwrap poisoned RWARC - another task failed inside!") } - move data + data } // Borrowck rightly complains about immutably aliasing the rwlock in order to @@ -509,7 +509,7 @@ mod tests { let (p, c) = pipes::stream(); - do task::spawn() |move c| { + do task::spawn() || { let p = pipes::PortSet(); c.send(p.chan()); @@ -532,8 +532,8 @@ mod tests { let arc = ~MutexARC(false); let arc2 = ~arc.clone(); let (p,c) = pipes::oneshot(); - let (c,p) = (~mut Some(move c), ~mut Some(move p)); - do task::spawn |move arc2, move p| { + let (c,p) = (~mut Some(c), ~mut Some(p)); + do task::spawn || { // wait until parent gets in pipes::recv_one(option::swap_unwrap(p)); do arc2.access_cond |state, cond| { @@ -555,7 +555,7 @@ mod tests { let arc2 = ~arc.clone(); let (p, c) = pipes::stream(); - do task::spawn_unlinked |move arc2, move p| { + do task::spawn_unlinked || { let _ = p.recv(); do arc2.access_cond |one, cond| { cond.signal(); @@ -574,7 +574,7 @@ mod tests { pub fn test_mutex_arc_poison() { let arc = ~MutexARC(1); let arc2 = ~arc.clone(); - do task::try |move arc2| { + do task::try || { do arc2.access |one| { assert *one == 2; } @@ -588,21 +588,21 @@ mod tests { let arc = MutexARC(1); let arc2 = ~(&arc).clone(); let (p, c) = pipes::stream(); - do task::spawn |move c, move arc2| { + do task::spawn || { do arc2.access |one| { c.send(()); assert *one == 2; } } let _ = p.recv(); - let one = unwrap_mutex_arc(move arc); + let one = unwrap_mutex_arc(arc); assert one == 1; } #[test] #[should_fail] #[ignore(cfg(windows))] pub fn test_rw_arc_poison_wr() { let arc = ~RWARC(1); let arc2 = ~arc.clone(); - do task::try |move arc2| { + do task::try || { do arc2.write |one| { assert *one == 2; } @@ -615,7 +615,7 @@ mod tests { pub fn test_rw_arc_poison_ww() { let arc = ~RWARC(1); let arc2 = ~arc.clone(); - do task::try |move arc2| { + do task::try || { do arc2.write |one| { assert *one == 2; } @@ -628,7 +628,7 @@ mod tests { pub fn test_rw_arc_poison_dw() { let arc = ~RWARC(1); let arc2 = ~arc.clone(); - do task::try |move arc2| { + do task::try || { do arc2.write_downgrade |write_mode| { do (&write_mode).write |one| { assert *one == 2; @@ -643,7 +643,7 @@ mod tests { pub fn test_rw_arc_no_poison_rr() { let arc = ~RWARC(1); let arc2 = ~arc.clone(); - do task::try |move arc2| { + do task::try || { do arc2.read |one| { assert *one == 2; } @@ -656,7 +656,7 @@ mod tests { pub fn test_rw_arc_no_poison_rw() { let arc = ~RWARC(1); let arc2 = ~arc.clone(); - do task::try |move arc2| { + do task::try || { do arc2.read |one| { assert *one == 2; } @@ -669,9 +669,9 @@ mod tests { pub fn test_rw_arc_no_poison_dr() { let arc = ~RWARC(1); let arc2 = ~arc.clone(); - do task::try |move arc2| { + do task::try || { do arc2.write_downgrade |write_mode| { - let read_mode = arc2.downgrade(move write_mode); + let read_mode = arc2.downgrade(write_mode); do (&read_mode).read |one| { assert *one == 2; } @@ -687,7 +687,7 @@ mod tests { let arc2 = ~arc.clone(); let (p,c) = pipes::stream(); - do task::spawn |move arc2, move c| { + do task::spawn || { do arc2.write |num| { for 10.times { let tmp = *num; @@ -703,8 +703,8 @@ mod tests { let mut children = ~[]; for 5.times { let arc3 = ~arc.clone(); - do task::task().future_result(|+r| children.push(move r)).spawn - |move arc3| { + do task::task().future_result(|+r| children.push(r)).spawn + || { do arc3.read |num| { assert *num >= 0; } @@ -732,9 +732,9 @@ mod tests { let mut reader_convos = ~[]; for 10.times { let ((rp1,rc1),(rp2,rc2)) = (pipes::stream(),pipes::stream()); - reader_convos.push((move rc1, move rp2)); + reader_convos.push((rc1, rp2)); let arcn = ~arc.clone(); - do task::spawn |move rp1, move rc2, move arcn| { + do task::spawn || { rp1.recv(); // wait for downgrader to give go-ahead do arcn.read |state| { assert *state == 31337; @@ -746,7 +746,7 @@ mod tests { // Writer task let arc2 = ~arc.clone(); let ((wp1,wc1),(wp2,wc2)) = (pipes::stream(),pipes::stream()); - do task::spawn |move arc2, move wc2, move wp1| { + do task::spawn || { wp1.recv(); do arc2.write_cond |state, cond| { assert *state == 0; @@ -779,7 +779,7 @@ mod tests { } } } - let read_mode = arc.downgrade(move write_mode); + let read_mode = arc.downgrade(write_mode); do (&read_mode).read |state| { // complete handshake with other readers for vec::each(reader_convos) |x| { diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index e6557d163f9db..75b97f494bd6f 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -108,7 +108,7 @@ struct BigBitv { } fn BigBitv(storage: ~[uint]) -> BigBitv { - BigBitv {storage: move storage} + BigBitv {storage: storage} } /** @@ -232,9 +232,9 @@ pub fn Bitv (nbits: uint, init: bool) -> Bitv { if nbits % uint_bits == 0 {0} else {1}; let elem = if init {!0} else {0}; let s = from_elem(nelems, elem); - Big(~BigBitv(move s)) + Big(~BigBitv(s)) }; - Bitv {rep: move rep, nbits: nbits} + Bitv {rep: rep, nbits: nbits} } priv impl Bitv { @@ -519,7 +519,7 @@ impl Clone for Bitv { let mut st = from_elem(self.nbits / uint_bits + 1, 0); let len = st.len(); for uint::range(0, len) |i| { st[i] = b.storage[i]; }; - Bitv{nbits: self.nbits, rep: Big(~BigBitv{storage: move st})} + Bitv{nbits: self.nbits, rep: Big(~BigBitv{storage: st})} } } } @@ -555,7 +555,7 @@ pub fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv { for uint::range(0, len) |i| { bitv.set(i, f(i)); } - move bitv + bitv } const uint_bits: uint = 32u + (1u << 32u >> 27u); diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index f0ec3c1b9d767..c8121daddabd0 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -21,7 +21,7 @@ pub struct Cell { /// Creates a new full cell with the given value. pub fn Cell(value: T) -> Cell { - Cell { value: Some(move value) } + Cell { value: Some(value) } } pub pure fn empty_cell() -> Cell { @@ -37,7 +37,7 @@ impl Cell { let mut value = None; value <-> self.value; - return option::unwrap(move value); + return option::unwrap(value); } /// Returns the value, failing if the cell is full. @@ -45,7 +45,7 @@ impl Cell { if !self.is_empty() { fail!(~"attempt to put a value back into a full cell"); } - self.value = Some(move value); + self.value = Some(value); } /// Returns true if the cell is empty and false if the cell is full. @@ -57,8 +57,8 @@ impl Cell { fn with_ref(op: fn(v: &T) -> R) -> R { let v = self.take(); let r = op(&v); - self.put_back(move v); - move r + self.put_back(v); + r } } @@ -69,7 +69,7 @@ fn test_basic() { let value = value_cell.take(); assert value == ~10; assert value_cell.is_empty(); - value_cell.put_back(move value); + value_cell.put_back(value); assert !value_cell.is_empty(); } diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index 47f3c70352c3b..c2c21002b195d 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -27,13 +27,13 @@ pub struct DuplexStream { impl GenericChan for DuplexStream { fn send(x: T) { - self.chan.send(move x) + self.chan.send(x) } } impl GenericSmartChan for DuplexStream { fn try_send(x: T) -> bool { - self.chan.try_send(move x) + self.chan.try_send(x) } } @@ -66,12 +66,12 @@ pub fn DuplexStream() let (p1, c2) = pipes::stream(); let (p2, c1) = pipes::stream(); (DuplexStream { - chan: move c1, - port: move p1 + chan: c1, + port: p1 }, DuplexStream { - chan: move c2, - port: move p2 + chan: c2, + port: p2 }) } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 772cacf47a11b..6d01a44184358 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -41,7 +41,7 @@ pub fn create() -> Deque { */ fn grow(nelts: uint, lo: uint, elts: ~[Cell]) -> ~[Cell] { - let mut elts = move elts; + let mut elts = elts; assert (nelts == vec::len(elts)); let mut rv = ~[]; @@ -54,10 +54,10 @@ pub fn create() -> Deque { i += 1u; } - move rv + rv } fn get(elts: &DVec>, i: uint) -> T { - match (*elts).get_elt(i) { Some(move t) => t, _ => fail!() } + match (*elts).get_elt(i) { Some(t) => t, _ => fail!() } } struct Repr { @@ -75,7 +75,7 @@ pub fn create() -> Deque { self.lo = self.elts.len() - 1u; } else { self.lo -= 1u; } if self.lo == self.hi { - self.elts.swap(|v| grow(self.nelts, oldlo, move v)); + self.elts.swap(|v| grow(self.nelts, oldlo, v)); self.lo = self.elts.len() - 1u; self.hi = self.nelts; } @@ -84,7 +84,7 @@ pub fn create() -> Deque { } fn add_back(t: T) { if self.lo == self.hi && self.nelts != 0u { - self.elts.swap(|v| grow(self.nelts, self.lo, move v)); + self.elts.swap(|v| grow(self.nelts, self.lo, v)); self.lo = 0u; self.hi = self.nelts; } diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index f691dfe6a6273..600ff33383174 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -259,7 +259,7 @@ pub mod reader { r_doc } - fn push_doc(d: Doc, f: fn() -> T) -> T{ + fn push_doc(d: Doc, f: fn() -> T) -> T { let old_parent = self.parent; let old_pos = self.pos; self.parent = d; @@ -267,7 +267,7 @@ pub mod reader { let r = f(); self.parent = old_parent; self.pos = old_pos; - move r + r } fn _next_uint(exp_tag: EbmlEncoderTag) -> uint { diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index dad761ac20d7c..d33ed4fd7cba9 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -28,7 +28,7 @@ This example sends boxed integers across tasks using serialization. ~~~ let (port, chan) = serial::pipe_stream(); -do task::spawn |move chan| { +do task::spawn || { for int::range(0, 10) |i| { chan.send(@i) } @@ -114,8 +114,8 @@ pub mod serial { let unflat: DeserializingUnflattener = DeserializingUnflattener::new( deserialize_buffer::); - let byte_port = ReaderBytePort::new(move reader); - FlatPort::new(move unflat, move byte_port) + let byte_port = ReaderBytePort::new(reader); + FlatPort::new(unflat, byte_port) } /// Create a `FlatChan` from a `Writer` @@ -124,8 +124,8 @@ pub mod serial { let flat: SerializingFlattener = SerializingFlattener::new( serialize_value::); - let byte_chan = WriterByteChan::new(move writer); - FlatChan::new(move flat, move byte_chan) + let byte_chan = WriterByteChan::new(writer); + FlatChan::new(flat, byte_chan) } /// Create a `FlatPort` from a `Port<~[u8]>` @@ -135,8 +135,8 @@ pub mod serial { let unflat: DeserializingUnflattener = DeserializingUnflattener::new( deserialize_buffer::); - let byte_port = PipeBytePort::new(move port); - FlatPort::new(move unflat, move byte_port) + let byte_port = PipeBytePort::new(port); + FlatPort::new(unflat, byte_port) } /// Create a `FlatChan` from a `Chan<~[u8]>` @@ -146,8 +146,8 @@ pub mod serial { let flat: SerializingFlattener = SerializingFlattener::new( serialize_value::); - let byte_chan = PipeByteChan::new(move chan); - FlatChan::new(move flat, move byte_chan) + let byte_chan = PipeByteChan::new(chan); + FlatChan::new(flat, byte_chan) } /// Create a pair of `FlatChan` and `FlatPort`, backed by pipes @@ -155,7 +155,7 @@ pub mod serial { Decodable>( ) -> (PipePort, PipeChan) { let (port, chan) = pipes::stream(); - return (pipe_port(move port), pipe_chan(move chan)); + return (pipe_port(port), pipe_chan(chan)); } } @@ -193,8 +193,8 @@ pub mod pod { reader: R ) -> ReaderPort { let unflat: PodUnflattener = PodUnflattener::new(); - let byte_port = ReaderBytePort::new(move reader); - FlatPort::new(move unflat, move byte_port) + let byte_port = ReaderBytePort::new(reader); + FlatPort::new(unflat, byte_port) } /// Create a `FlatChan` from a `Writer` @@ -202,28 +202,28 @@ pub mod pod { writer: W ) -> WriterChan { let flat: PodFlattener = PodFlattener::new(); - let byte_chan = WriterByteChan::new(move writer); - FlatChan::new(move flat, move byte_chan) + let byte_chan = WriterByteChan::new(writer); + FlatChan::new(flat, byte_chan) } /// Create a `FlatPort` from a `Port<~[u8]>` pub fn pipe_port(port: Port<~[u8]>) -> PipePort { let unflat: PodUnflattener = PodUnflattener::new(); - let byte_port = PipeBytePort::new(move port); - FlatPort::new(move unflat, move byte_port) + let byte_port = PipeBytePort::new(port); + FlatPort::new(unflat, byte_port) } /// Create a `FlatChan` from a `Chan<~[u8]>` pub fn pipe_chan(chan: Chan<~[u8]>) -> PipeChan { let flat: PodFlattener = PodFlattener::new(); - let byte_chan = PipeByteChan::new(move chan); - FlatChan::new(move flat, move byte_chan) + let byte_chan = PipeByteChan::new(chan); + FlatChan::new(flat, byte_chan) } /// Create a pair of `FlatChan` and `FlatPort`, backed by pipes pub fn pipe_stream() -> (PipePort, PipeChan) { let (port, chan) = pipes::stream(); - return (pipe_port(move port), pipe_chan(move chan)); + return (pipe_port(port), pipe_chan(chan)); } } @@ -261,13 +261,13 @@ const CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD]; pub impl,P:BytePort> FlatPort: GenericPort { fn recv() -> T { match self.try_recv() { - Some(move val) => move val, + Some(val) => val, None => fail!(~"port is closed") } } fn try_recv() -> Option { let command = match self.byte_port.try_recv(CONTINUE.len()) { - Some(move c) => move c, + Some(c) => c, None => { warn!("flatpipe: broken pipe"); return None; @@ -288,8 +288,8 @@ pub impl,P:BytePort> FlatPort: GenericPort { let msg_len = msg_len as uint; match self.byte_port.try_recv(msg_len) { - Some(move bytes) => { - Some(self.unflattener.unflatten(move bytes)) + Some(bytes) => { + Some(self.unflattener.unflatten(bytes)) } None => { warn!("flatpipe: broken pipe"); @@ -306,20 +306,20 @@ pub impl,P:BytePort> FlatPort: GenericPort { impl,C:ByteChan> GenericChan for FlatChan { fn send(val: T) { self.byte_chan.send(CONTINUE.to_vec()); - let bytes = self.flattener.flatten(move val); + let bytes = self.flattener.flatten(val); let len = bytes.len() as u64; do io::u64_to_be_bytes(len, size_of::()) |len_bytes| { self.byte_chan.send(len_bytes.to_vec()); } - self.byte_chan.send(move bytes); + self.byte_chan.send(bytes); } } pub impl,P:BytePort> FlatPort { static fn new(u: U, p: P) -> FlatPort { FlatPort { - unflattener: move u, - byte_port: move p + unflattener: u, + byte_port: p } } } @@ -327,8 +327,8 @@ pub impl,P:BytePort> FlatPort { pub impl,C:ByteChan> FlatChan { static fn new(f: F, c: C) -> FlatChan { FlatChan { - flattener: move f, - byte_chan: move c + flattener: f, + byte_chan: c } } } @@ -426,7 +426,7 @@ pub mod flatteners { static fn new(deserialize_buffer: DeserializeBuffer ) -> DeserializingUnflattener { DeserializingUnflattener { - deserialize_buffer: move deserialize_buffer + deserialize_buffer: deserialize_buffer } } } @@ -437,7 +437,7 @@ pub mod flatteners { static fn new(serialize_value: SerializeValue ) -> SerializingFlattener { SerializingFlattener { - serialize_value: move serialize_value + serialize_value: serialize_value } } } @@ -450,7 +450,7 @@ pub mod flatteners { pub fn deserialize_buffer>(buf: &[u8]) -> T { let buf = vec::from_slice(buf); - let buf_reader = @BufReader::new(move buf); + let buf_reader = @BufReader::new(buf); let reader = buf_reader as @Reader; let deser: D = FromReader::from_reader(reader); Decodable::decode(&deser) @@ -462,8 +462,8 @@ pub mod flatteners { let writer = bytes_writer as @Writer; let ser = FromWriter::from_writer(writer); val.encode(&ser); - let bytes = bytes_writer.bytes.check_out(|bytes| move bytes); - return move bytes; + let bytes = bytes_writer.bytes.check_out(|bytes| bytes); + return bytes; } pub trait FromReader { @@ -477,8 +477,8 @@ pub mod flatteners { impl FromReader for json::Decoder { static fn from_reader(r: Reader) -> json::Decoder { match json::from_reader(r) { - Ok(move json) => { - json::Decoder(move json) + Ok(json) => { + json::Decoder(json) } Err(e) => fail!(fmt!("flatpipe: can't parse json: %?", e)) } @@ -487,7 +487,7 @@ pub mod flatteners { impl FromWriter for json::Encoder { static fn from_writer(w: Writer) -> json::Encoder { - json::Encoder(move w) + json::Encoder(w) } } @@ -495,13 +495,13 @@ pub mod flatteners { static fn from_reader(r: Reader) -> ebml::reader::Decoder { let buf = @r.read_whole_stream(); let doc = ebml::reader::Doc(buf); - ebml::reader::Decoder(move doc) + ebml::reader::Decoder(doc) } } impl FromWriter for ebml::writer::Encoder { static fn from_writer(w: Writer) -> ebml::writer::Encoder { - ebml::writer::Encoder(move w) + ebml::writer::Encoder(w) } } @@ -537,7 +537,7 @@ pub mod bytepipes { } if left == 0 { - return Some(move bytes); + return Some(bytes); } else { warn!("flatpipe: dropped %? broken bytes", left); return None; @@ -554,7 +554,7 @@ pub mod bytepipes { pub impl ReaderBytePort { static fn new(r: R) -> ReaderBytePort { ReaderBytePort { - reader: move r + reader: r } } } @@ -562,7 +562,7 @@ pub mod bytepipes { pub impl WriterByteChan { static fn new(w: W) -> WriterByteChan { WriterByteChan { - writer: move w + writer: w } } } @@ -587,17 +587,17 @@ pub mod bytepipes { let mut bytes = ::core::util::replace(&mut self.buf, ~[]); assert count > bytes.len(); match self.try_recv(count - bytes.len()) { - Some(move rest) => { + Some(rest) => { bytes.push_all(rest); - return Some(move bytes); + return Some(bytes); } None => return None } } else if self.buf.is_empty() { match self.port.try_recv() { - Some(move buf) => { + Some(buf) => { assert !buf.is_empty(); - self.buf = move buf; + self.buf = buf; return self.try_recv(count); } None => return None @@ -610,14 +610,14 @@ pub mod bytepipes { pub impl PipeByteChan: ByteChan { fn send(&self, val: ~[u8]) { - self.chan.send(move val) + self.chan.send(val) } } pub impl PipeBytePort { static fn new(p: Port<~[u8]>) -> PipeBytePort { PipeBytePort { - port: move p, + port: p, buf: ~[] } } @@ -626,7 +626,7 @@ pub mod bytepipes { pub impl PipeByteChan { static fn new(c: Chan<~[u8]>) -> PipeByteChan { PipeByteChan { - chan: move c + chan: c } } } @@ -661,14 +661,14 @@ mod test { #[test] fn test_serializing_memory_stream() { let writer = BytesWriter(); - let chan = serial::writer_chan(move writer); + let chan = serial::writer_chan(writer); chan.send(10); let bytes = chan.byte_chan.writer.bytes.get(); - let reader = BufReader::new(move bytes); - let port = serial::reader_port(move reader); + let reader = BufReader::new(bytes); + let port = serial::reader_port(reader); let res: int = port.recv(); assert res == 10i; @@ -678,7 +678,7 @@ mod test { fn test_serializing_pipes() { let (port, chan) = serial::pipe_stream(); - do task::spawn |move chan| { + do task::spawn || { for int::range(0, 10) |i| { chan.send(i) } @@ -693,7 +693,7 @@ mod test { fn test_serializing_boxes() { let (port, chan) = serial::pipe_stream(); - do task::spawn |move chan| { + do task::spawn || { for int::range(0, 10) |i| { chan.send(@i) } @@ -707,14 +707,14 @@ mod test { #[test] fn test_pod_memory_stream() { let writer = BytesWriter(); - let chan = pod::writer_chan(move writer); + let chan = pod::writer_chan(writer); chan.send(10); let bytes = chan.byte_chan.writer.bytes.get(); - let reader = BufReader::new(move bytes); - let port = pod::reader_port(move reader); + let reader = BufReader::new(bytes); + let port = pod::reader_port(reader); let res: int = port.recv(); assert res == 10; @@ -724,7 +724,7 @@ mod test { fn test_pod_pipes() { let (port, chan) = pod::pipe_stream(); - do task::spawn |move chan| { + do task::spawn || { for int::range(0, 10) |i| { chan.send(i) } @@ -741,11 +741,11 @@ mod test { fn test_pod_tcp_stream() { fn reader_port(buf: TcpSocketBuf ) -> pod::ReaderPort { - pod::reader_port(move buf) + pod::reader_port(buf) } fn writer_chan(buf: TcpSocketBuf ) -> pod::WriterChan { - pod::writer_chan(move buf) + pod::writer_chan(buf) } test_some_tcp_stream(reader_port, writer_chan, 9666); } @@ -755,11 +755,11 @@ mod test { fn test_serializing_tcp_stream() { fn reader_port(buf: TcpSocketBuf ) -> serial::ReaderPort { - serial::reader_port(move buf) + serial::reader_port(buf) } fn writer_chan(buf: TcpSocketBuf ) -> serial::WriterChan { - serial::writer_chan(move buf) + serial::writer_chan(buf) } test_some_tcp_stream(reader_port, writer_chan, 9667); } @@ -790,27 +790,25 @@ mod test { let addr0 = ip::v4::parse_addr("127.0.0.1"); - let begin_connect_chan = Cell(move begin_connect_chan); - let accept_chan = Cell(move accept_chan); + let begin_connect_chan = Cell(begin_connect_chan); + let accept_chan = Cell(accept_chan); // The server task let addr = copy addr0; - do task::spawn |move begin_connect_chan, - move accept_chan| { + do task::spawn || { let iotask = &uv::global_loop::get(); let begin_connect_chan = begin_connect_chan.take(); let accept_chan = accept_chan.take(); let listen_res = do tcp::listen( - copy addr, port, 128, iotask, - |move begin_connect_chan, _kill_ch| { + copy addr, port, 128, iotask, |_kill_ch| { // Tell the sender to initiate the connection debug!("listening"); begin_connect_chan.send(()) - }) |move accept_chan, new_conn, kill_ch| { + }) |new_conn, kill_ch| { // Incoming connection. Send it to the receiver task to accept let (res_port, res_chan) = pipes::stream(); - accept_chan.send((move new_conn, move res_chan)); + accept_chan.send((new_conn, res_chan)); // Wait until the connection is accepted res_port.recv(); @@ -823,8 +821,7 @@ mod test { // Client task let addr = copy addr0; - do task::spawn |move begin_connect_port, - move writer_chan| { + do task::spawn || { // Wait for the server to start listening begin_connect_port.recv(); @@ -833,11 +830,11 @@ mod test { let iotask = &uv::global_loop::get(); let connect_result = tcp::connect(copy addr, port, iotask); assert connect_result.is_ok(); - let sock = result::unwrap(move connect_result); - let socket_buf: tcp::TcpSocketBuf = tcp::socket_buf(move sock); + let sock = result::unwrap(connect_result); + let socket_buf: tcp::TcpSocketBuf = tcp::socket_buf(sock); // TcpSocketBuf is a Writer! - let chan = writer_chan(move socket_buf); + let chan = writer_chan(socket_buf); for int::range(0, 10) |i| { debug!("sending %?", i); @@ -846,9 +843,7 @@ mod test { } // Reciever task - do task::spawn |move accept_port, move finish_chan, - move reader_port| { - + do task::spawn || { // Wait for a connection let (conn, res_chan) = accept_port.recv(); @@ -856,13 +851,13 @@ mod test { let accept_result = tcp::accept(conn); debug!("accepted"); assert accept_result.is_ok(); - let sock = result::unwrap(move accept_result); + let sock = result::unwrap(accept_result); res_chan.send(()); - let socket_buf: tcp::TcpSocketBuf = tcp::socket_buf(move sock); + let socket_buf: tcp::TcpSocketBuf = tcp::socket_buf(sock); // TcpSocketBuf is a Reader! - let port = reader_port(move socket_buf); + let port = reader_port(socket_buf); for int::range(0, 10) |i| { let j = port.recv(); @@ -897,22 +892,22 @@ mod test { fn reader_port_loader(bytes: ~[u8] ) -> pod::ReaderPort { - let reader = BufReader::new(move bytes); - pod::reader_port(move reader) + let reader = BufReader::new(bytes); + pod::reader_port(reader) } fn pipe_port_loader(bytes: ~[u8] ) -> pod::PipePort { let (port, chan) = pipes::stream(); if !bytes.is_empty() { - chan.send(move bytes); + chan.send(bytes); } - pod::pipe_port(move port) + pod::pipe_port(port) } fn test_try_recv_none1(loader: PortLoader

) { let bytes = ~[]; - let port = loader(move bytes); + let port = loader(bytes); let res: Option = port.try_recv(); assert res.is_none(); } @@ -929,7 +924,7 @@ mod test { fn test_try_recv_none2(loader: PortLoader

) { // The control word in the protocol is interrupted let bytes = ~[0]; - let port = loader(move bytes); + let port = loader(bytes); let res: Option = port.try_recv(); assert res.is_none(); } @@ -947,7 +942,7 @@ mod test { const CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD]; // The control word is followed by garbage let bytes = CONTINUE.to_vec() + ~[0]; - let port = loader(move bytes); + let port = loader(bytes); let res: Option = port.try_recv(); assert res.is_none(); } @@ -962,7 +957,7 @@ mod test { } fn test_try_recv_none4(+loader: PortLoader

) { - assert do task::try |move loader| { + assert do task::try || { const CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD]; // The control word is followed by a valid length, // then undeserializable garbage @@ -972,7 +967,7 @@ mod test { }; let bytes = CONTINUE.to_vec() + len_bytes + ~[0, 0, 0, 0]; - let port = loader(move bytes); + let port = loader(bytes); let _res: Option = port.try_recv(); }.is_err(); diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index d6c2cf5a265ee..8af2f350e51f7 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -55,7 +55,7 @@ pub fn find(m: Treemap, k: K) -> Option { Node(@ref kk, @copy v, left, right) => { if k == *kk { Some(v) - } else if k < *kk { find(left, move k) } else { find(right, move k) } + } else if k < *kk { find(left, k) } else { find(right, k) } } } } diff --git a/src/libstd/future.rs b/src/libstd/future.rs index 8659e3cbb102c..6de6363695c77 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -71,10 +71,10 @@ impl Future { let mut state = Evaluating; self.state <-> state; - match move state { + match state { Forced(_) | Evaluating => fail!(~"Logic error."), - Pending(move f) => { - self.state = Forced(move f()); + Pending(f) => { + self.state = Forced(f()); self.get_ref() } } @@ -90,7 +90,7 @@ pub fn from_value(val: A) -> Future { * not block. */ - Future {state: Forced(move val)} + Future {state: Forced(val)} } pub fn from_port(port: PortOne) -> @@ -102,13 +102,13 @@ pub fn from_port(port: PortOne) -> * waiting for the result to be received on the port. */ - let port = ~mut Some(move port); - do from_fn |move port| { + let port = ~mut Some(port); + do from_fn || { let mut port_ = None; port_ <-> *port; - let port = option::unwrap(move port_); - match recv(move port) { - oneshot::send(move data) => move data + let port = option::unwrap(port_); + match recv(port) { + oneshot::send(data) => data } } } @@ -122,7 +122,7 @@ pub fn from_fn(f: ~fn() -> A) -> Future { * function. It is not spawned into another task. */ - Future {state: Pending(move f)} + Future {state: Pending(f)} } pub fn spawn(blk: fn~() -> A) -> Future { @@ -135,13 +135,13 @@ pub fn spawn(blk: fn~() -> A) -> Future { let (chan, port) = oneshot::init(); - let chan = ~mut Some(move chan); - do task::spawn |move blk, move chan| { + let chan = ~mut Some(chan); + do task::spawn || { let chan = option::swap_unwrap(&mut *chan); - send_one(move chan, blk()); + send_one(chan, blk()); } - return from_port(move port); + return from_port(port); } #[allow(non_implicitly_copyable_typarams)] @@ -162,8 +162,8 @@ pub mod test { #[test] pub fn test_from_port() { let (ch, po) = oneshot::init(); - send_one(move ch, ~"whale"); - let f = from_port(move po); + send_one(ch, ~"whale"); + let f = from_port(po); assert f.get() == ~"whale"; } @@ -203,7 +203,7 @@ pub mod test { pub fn test_sendable_future() { let expected = ~"schlorf"; let f = do spawn |copy expected| { copy expected }; - do task::spawn |move f, move expected| { + do task::spawn |f, expected| { let actual = f.get(); assert actual == expected; } diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index 3d6d0b1bb7d6b..3726943321c35 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -35,7 +35,7 @@ * fn do_work(in: &str, out: Option<~str>) { * io::println(in); * io::println(match out { - * Some(move x) => x, + * Some(x) => x, * None => ~"No Output" * }); * } @@ -339,7 +339,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result { i += 1; } return Ok(Matches {opts: vec::from_slice(opts), - vals: move vals, + vals: vals, free: free}); } } @@ -1178,7 +1178,7 @@ mod tests { let args = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"]; let opts = ~[optopt(~"e"), optopt(~"encrypt")]; let matches = &match getopts(args, opts) { - result::Ok(move m) => m, + result::Ok(m) => m, result::Err(_) => fail!() }; assert opts_present(matches, ~[~"e"]); @@ -1199,7 +1199,7 @@ mod tests { let args = ~[~"-Lfoo", ~"-M."]; let opts = ~[optmulti(~"L"), optmulti(~"M")]; let matches = &match getopts(args, opts) { - result::Ok(move m) => m, + result::Ok(m) => m, result::Err(_) => fail!() }; assert opts_present(matches, ~[~"L"]); diff --git a/src/libstd/io_util.rs b/src/libstd/io_util.rs index 3cc28563e12eb..b1c6e2d44e572 100644 --- a/src/libstd/io_util.rs +++ b/src/libstd/io_util.rs @@ -20,7 +20,7 @@ pub struct BufReader { pub impl BufReader { static pub fn new(v: ~[u8]) -> BufReader { BufReader { - buf: move v, + buf: v, pos: 0 } } @@ -38,7 +38,7 @@ pub impl BufReader { // FIXME #4429: This isn't correct if f fails self.pos = bytes_reader.pos; - return move res; + return res; } } diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 8434e2c4782d8..5aa05e9cf7566 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -388,18 +388,18 @@ pub fn Parser(rdr: io::Reader) -> Parser { pub impl Parser { fn parse() -> Result { - match move self.parse_value() { - Ok(move value) => { + match self.parse_value() { + Ok(value) => { // Skip trailing whitespaces. self.parse_whitespace(); // Make sure there is no trailing characters. if self.eof() { - Ok(move value) + Ok(value) } else { self.error(~"trailing characters") } } - Err(move e) => Err(e) + Err(e) => Err(e) } } } @@ -438,9 +438,9 @@ priv impl Parser { 'f' => self.parse_ident(~"alse", Boolean(false)), '0' .. '9' | '-' => self.parse_number(), '"' => - match move self.parse_str() { - Ok(move s) => Ok(String(s)), - Err(move e) => Err(e), + match self.parse_str() { + Ok(s) => Ok(String(s)), + Err(e) => Err(e), }, '[' => self.parse_list(), '{' => self.parse_object(), @@ -455,7 +455,7 @@ priv impl Parser { fn parse_ident(ident: &str, value: Json) -> Result { if str::all(ident, |c| c == self.next_char()) { self.bump(); - Ok(move value) + Ok(value) } else { self.error(~"invalid syntax") } @@ -662,13 +662,13 @@ priv impl Parser { if self.ch == ']' { self.bump(); - return Ok(List(move values)); + return Ok(List(values)); } loop { - match move self.parse_value() { - Ok(move v) => values.push(move v), - Err(move e) => return Err(e) + match self.parse_value() { + Ok(v) => values.push(v), + Err(e) => return Err(e) } self.parse_whitespace(); @@ -678,7 +678,7 @@ priv impl Parser { match self.ch { ',' => self.bump(), - ']' => { self.bump(); return Ok(List(move values)); } + ']' => { self.bump(); return Ok(List(values)); } _ => return self.error(~"expected `,` or `]`") } }; @@ -692,7 +692,7 @@ priv impl Parser { if self.ch == '}' { self.bump(); - return Ok(Object(move values)); + return Ok(Object(values)); } while !self.eof() { @@ -702,9 +702,9 @@ priv impl Parser { return self.error(~"key must be a string"); } - let key = match move self.parse_str() { - Ok(move key) => key, - Err(move e) => return Err(e) + let key = match self.parse_str() { + Ok(key) => key, + Err(e) => return Err(e) }; self.parse_whitespace(); @@ -715,15 +715,15 @@ priv impl Parser { } self.bump(); - match move self.parse_value() { - Ok(move value) => { values.insert(key, move value); } - Err(move e) => return Err(e) + match self.parse_value() { + Ok(value) => { values.insert(key, value); } + Err(e) => return Err(e) } self.parse_whitespace(); match self.ch { ',' => self.bump(), - '}' => { self.bump(); return Ok(Object(move values)); } + '}' => { self.bump(); return Ok(Object(values)); } _ => { if self.eof() { break; } return self.error(~"expected `,` or `}`"); @@ -753,7 +753,7 @@ pub struct Decoder { } pub fn Decoder(json: Json) -> Decoder { - Decoder { json: move json, stack: ~[] } + Decoder { json: json, stack: ~[] } } priv impl Decoder { @@ -868,7 +868,7 @@ pub impl Decoder: serialize::Decoder { }; let res = f(len); self.pop(); - move res + res } fn read_managed_vec(&self, f: fn(uint) -> T) -> T { @@ -879,7 +879,7 @@ pub impl Decoder: serialize::Decoder { }; let res = f(len); self.pop(); - move res + res } fn read_vec_elt(&self, idx: uint, f: fn() -> T) -> T { @@ -897,14 +897,14 @@ pub impl Decoder: serialize::Decoder { debug!("read_rec()"); let value = f(); self.pop(); - move value + value } fn read_struct(&self, _name: &str, _len: uint, f: fn() -> T) -> T { debug!("read_struct()"); let value = f(); self.pop(); - move value + value } fn read_field(&self, name: &str, idx: uint, f: fn() -> T) -> T { @@ -934,7 +934,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_tup(len=%u)", len); let value = f(); self.pop(); - move value + value } fn read_tup_elt(&self, idx: uint, f: fn() -> T) -> T { @@ -1219,11 +1219,11 @@ mod tests { for items.each |item| { match *item { - (copy key, copy value) => { d.insert(key, move value); }, + (copy key, copy value) => { d.insert(key, value); }, } }; - Object(move d) + Object(d) } #[test] diff --git a/src/libstd/net_ip.rs b/src/libstd/net_ip.rs index 88bacf53e636b..4a185f68e17f9 100644 --- a/src/libstd/net_ip.rs +++ b/src/libstd/net_ip.rs @@ -181,7 +181,7 @@ pub mod v4 { */ pub fn parse_addr(ip: &str) -> IpAddr { match try_parse_addr(ip) { - result::Ok(move addr) => move addr, + result::Ok(addr) => addr, result::Err(ref err_data) => fail!(err_data.err_msg) } } @@ -276,7 +276,7 @@ pub mod v6 { */ pub fn parse_addr(ip: &str) -> IpAddr { match try_parse_addr(ip) { - result::Ok(move addr) => move addr, + result::Ok(addr) => addr, result::Err(copy err_data) => fail!(err_data.err_msg) } } @@ -331,7 +331,7 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int, result::Err(GetAddrUnknownError)); break; }; - out_vec.push(move new_ip_addr); + out_vec.push(new_ip_addr); let next_addr = ll::get_next_addrinfo(curr_addr); if next_addr == ptr::null::() as *addrinfo { @@ -345,7 +345,7 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int, } log(debug, fmt!("successful process addrinfo result, len: %?", vec::len(out_vec))); - output_ch.send(result::Ok(move out_vec)); + output_ch.send(result::Ok(out_vec)); } else { log(debug, ~"addrinfo pointer is NULL"); @@ -427,7 +427,7 @@ mod test { } // note really sure how to realiably test/assert // this.. mostly just wanting to see it work, atm. - let results = result::unwrap(move ga_result); + let results = result::unwrap(ga_result); log(debug, fmt!("test_get_addr: Number of results for %s: %?", localhost_name, vec::len(results))); for vec::each(results) |r| { diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 4e0b5494883b0..9f750a2bf711a 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -177,7 +177,7 @@ pub fn connect(input_ip: ip::IpAddr, port: uint, // we can send into the interact cb to be handled in libuv.. debug!("stream_handle_ptr outside interact %?", stream_handle_ptr); - do iotask::interact(iotask) |move input_ip, loop_ptr| { + do iotask::interact(iotask) |loop_ptr| { unsafe { debug!("in interact cb for tcp client connect.."); debug!("stream_handle_ptr in interact %?", @@ -629,10 +629,10 @@ pub fn listen(host_ip: ip::IpAddr, port: uint, backlog: uint, new_connect_cb: fn~(TcpNewConnection, SharedChan>)) -> result::Result<(), TcpListenErrData> { - do listen_common(move host_ip, port, backlog, iotask, - move on_establish_cb) + do listen_common(host_ip, port, backlog, iotask, + on_establish_cb) // on_connect_cb - |move new_connect_cb, handle| { + |handle| { unsafe { let server_data_ptr = uv::ll::get_data_for_uv_handle(handle) as *TcpListenFcData; @@ -659,7 +659,7 @@ fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint, server_stream_ptr: server_stream_ptr, stream_closed_ch: stream_closed_ch, kill_ch: kill_ch.clone(), - on_connect_cb: move on_connect_cb, + on_connect_cb: on_connect_cb, iotask: iotask.clone(), ipv6: match &host_ip { &ip::Ipv4(_) => { false } @@ -678,7 +678,7 @@ fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint, // tcp::connect (because the iotask::interact cb isn't // nested within a core::comm::listen block) let loc_ip = copy(host_ip); - do iotask::interact(iotask) |move loc_ip, loop_ptr| { + do iotask::interact(iotask) |loop_ptr| { unsafe { match uv::ll::tcp_init(loop_ptr, server_stream_ptr) { 0i32 => { @@ -815,7 +815,7 @@ fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint, */ pub fn socket_buf(sock: TcpSocket) -> TcpSocketBuf { TcpSocketBuf(@TcpBufferedSocketData { - sock: move sock, mut buf: ~[], buf_off: 0 + sock: sock, mut buf: ~[], buf_off: 0 }) } @@ -851,12 +851,12 @@ impl TcpSocket { let addr = uv::ll::ip6_addr("", 0); uv::ll::tcp_getpeername6(self.socket_data.stream_handle_ptr, ptr::addr_of(&addr)); - ip::Ipv6(move addr) + ip::Ipv6(addr) } else { let addr = uv::ll::ip4_addr("", 0); uv::ll::tcp_getpeername(self.socket_data.stream_handle_ptr, ptr::addr_of(&addr)); - ip::Ipv4(move addr) + ip::Ipv4(addr) } } } @@ -1047,7 +1047,7 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint) Some(result::get(&rs_result).recv()) }; log(debug, ~"tcp::read after recv_timeout"); - match move read_result { + match read_result { None => { log(debug, ~"tcp::read: timed out.."); let err_data = TcpErrData { @@ -1057,7 +1057,7 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint) read_stop_common_impl(socket_data); result::Err(err_data) } - Some(move data_result) => { + Some(data_result) => { log(debug, ~"tcp::read got data"); read_stop_common_impl(socket_data); data_result @@ -1091,7 +1091,7 @@ fn read_stop_common_impl(socket_data: *TcpSocketData) -> } } match stop_po.recv() { - Some(move err_data) => Err(err_data), + Some(err_data) => Err(err_data), None => Ok(()) } } @@ -1183,7 +1183,7 @@ fn write_common_impl(socket_data_ptr: *TcpSocketData, // aftermath, so we don't have to sit here blocking. match result_po.recv() { TcpWriteSuccess => Ok(()), - TcpWriteError(move err_data) => Err(err_data) + TcpWriteError(err_data) => Err(err_data) } } } @@ -1613,10 +1613,10 @@ pub mod test { debug!("server started, firing up client.."); let server_ip_addr = ip::v4::parse_addr(server_ip); let iotask = uv::global_loop::get(); - let connect_result = connect(move server_ip_addr, server_port, + let connect_result = connect(server_ip_addr, server_port, &iotask); - let sock = result::unwrap(move connect_result); + let sock = result::unwrap(connect_result); debug!("testing peer address"); // This is what we are actually testing! @@ -1784,11 +1784,11 @@ pub mod test { // client debug!("server started, firing up client.."); let server_addr = ip::v4::parse_addr(server_ip); - let conn_result = connect(move server_addr, server_port, hl_loop); + let conn_result = connect(server_addr, server_port, hl_loop); if result::is_err(&conn_result) { assert false; } - let sock_buf = @socket_buf(result::unwrap(move conn_result)); + let sock_buf = @socket_buf(result::unwrap(conn_result)); buf_write(sock_buf, expected_req); let buf_reader = sock_buf as Reader; @@ -1819,7 +1819,7 @@ pub mod test { let (server_po, server_ch) = stream::<~str>(); let server_ch = SharedChan(server_ch); let server_ip_addr = ip::v4::parse_addr(server_ip); - let listen_result = listen(move server_ip_addr, server_port, 128, + let listen_result = listen(server_ip_addr, server_port, 128, iotask, // on_establish_cb -- called when listener is set up |kill_ch| { @@ -1849,15 +1849,15 @@ pub mod test { else { debug!("SERVER/WORKER: send on cont ch"); cont_ch.send(()); - let sock = result::unwrap(move accept_result); + let sock = result::unwrap(accept_result); let peer_addr = sock.get_peer_addr(); debug!("SERVER: successfully accepted \ connection from %s:%u", ip::format_addr(&peer_addr), ip::get_port(&peer_addr)); let received_req_bytes = read(&sock, 0u); - match move received_req_bytes { - result::Ok(move data) => { + match received_req_bytes { + result::Ok(data) => { debug!("SERVER: got REQ str::from_bytes.."); debug!("SERVER: REQ data len: %?", vec::len(data)); @@ -1868,7 +1868,7 @@ pub mod test { debug!("SERVER: after write.. die"); kill_ch.send(None); } - result::Err(move err_data) => { + result::Err(err_data) => { debug!("SERVER: error recvd: %s %s", err_data.err_name, err_data.err_msg); kill_ch.send(Some(err_data)); @@ -1904,7 +1904,7 @@ pub mod test { fn run_tcp_test_server_fail(server_ip: &str, server_port: uint, iotask: &IoTask) -> TcpListenErrData { let server_ip_addr = ip::v4::parse_addr(server_ip); - let listen_result = listen(move server_ip_addr, server_port, 128, + let listen_result = listen(server_ip_addr, server_port, 128, iotask, // on_establish_cb -- called when listener is set up |kill_ch| { @@ -1929,7 +1929,7 @@ pub mod test { let server_ip_addr = ip::v4::parse_addr(server_ip); debug!("CLIENT: starting.."); - let connect_result = connect(move server_ip_addr, server_port, + let connect_result = connect(server_ip_addr, server_port, iotask); if result::is_err(&connect_result) { debug!("CLIENT: failed to connect"); @@ -1937,7 +1937,7 @@ pub mod test { Err(err_data) } else { - let sock = result::unwrap(move connect_result); + let sock = result::unwrap(connect_result); let resp_bytes = str::to_bytes(resp); tcp_write_single(&sock, resp_bytes); let read_result = sock.read(0u); diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index 7874899cb27ac..29cb57c01be45 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -253,7 +253,7 @@ pub fn decode_form_urlencoded(s: &[u8]) -> LinearMap<~str, ~[~str]> { '&' | ';' => { if key != ~"" && value != ~"" { let mut values = match m.pop(&key) { - Some(move values) => values, + Some(values) => values, None => ~[], }; @@ -287,7 +287,7 @@ pub fn decode_form_urlencoded(s: &[u8]) -> LinearMap<~str, ~[~str]> { if key != ~"" && value != ~"" { let mut values = match m.pop(&key) { - Some(move values) => values, + Some(values) => values, None => ~[], }; @@ -671,7 +671,7 @@ pub pure fn from_str(rawurl: &str) -> Result { impl FromStr for Url { static pure fn from_str(s: &str) -> Option { match from_str(s) { - Ok(move url) => Some(url), + Ok(url) => Some(url), Err(_) => None } } diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs index 3ad45cf2d5b30..701268e044ae3 100644 --- a/src/libstd/oldmap.rs +++ b/src/libstd/oldmap.rs @@ -132,7 +132,7 @@ pub mod chained { entry.next = new_chains[idx]; new_chains[idx] = Some(entry); } - self.chains = move new_chains; + self.chains = new_chains; } pure fn each_entry(blk: fn(@Entry) -> bool) { @@ -321,7 +321,7 @@ pub mod chained { if opt_v.is_none() { fail!(fmt!("Key not found in table: %?", k)); } - option::unwrap(move opt_v) + option::unwrap(opt_v) } } diff --git a/src/libstd/oldsmallintmap.rs b/src/libstd/oldsmallintmap.rs index 5c3477660706e..c4ba465acea94 100644 --- a/src/libstd/oldsmallintmap.rs +++ b/src/libstd/oldsmallintmap.rs @@ -69,7 +69,7 @@ pub pure fn get(self: SmallIntMap, key: uint) -> T { error!("smallintmap::get(): key not present"); fail!(); } - Some(move v) => return v + Some(v) => return v } } diff --git a/src/libstd/par.rs b/src/libstd/par.rs index 8293ff1c2afdf..3929e8c0ea763 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -58,7 +58,7 @@ fn map_slices( do vec::as_imm_buf(xs) |p, _len| { let f = f(); let base = base; - let f = do future_spawn() |move f| { + let f = do future_spawn() || { unsafe { let len = end - base; let slice = (ptr::offset(p, base), @@ -72,7 +72,7 @@ fn map_slices( f(base, slice) } }; - futures.push(move f); + futures.push(f); }; base += items_per_task; } diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs index a25a4196b4cab..b216834a20500 100644 --- a/src/libstd/priority_queue.rs +++ b/src/libstd/priority_queue.rs @@ -139,27 +139,27 @@ impl PriorityQueue { priv fn siftup(&mut self, start: uint, mut pos: uint) { unsafe { - let new = move *addr_of(&self.data[pos]); + let new = *addr_of(&self.data[pos]); while pos > start { let parent = (pos - 1) >> 1; if new > self.data[parent] { let mut x = rusti::init(); x <-> self.data[parent]; - rusti::move_val_init(&mut self.data[pos], move x); + rusti::move_val_init(&mut self.data[pos], x); pos = parent; loop } break } - rusti::move_val_init(&mut self.data[pos], move new); + rusti::move_val_init(&mut self.data[pos], new); } } priv fn siftdown_range(&mut self, mut pos: uint, end: uint) { unsafe { let start = pos; - let new = move *addr_of(&self.data[pos]); + let new = *addr_of(&self.data[pos]); let mut child = 2 * pos + 1; while child < end { @@ -169,12 +169,12 @@ impl PriorityQueue { } let mut x = rusti::init(); x <-> self.data[child]; - rusti::move_val_init(&mut self.data[pos], move x); + rusti::move_val_init(&mut self.data[pos], x); pos = child; child = 2 * pos + 1; } - rusti::move_val_init(&mut self.data[pos], move new); + rusti::move_val_init(&mut self.data[pos], new); self.siftup(start, pos); } } diff --git a/src/libstd/rl.rs b/src/libstd/rl.rs index 30baa3cc5f15a..1ee67d76af571 100644 --- a/src/libstd/rl.rs +++ b/src/libstd/rl.rs @@ -71,7 +71,7 @@ fn complete_key(_v: @CompletionCb) {} /// Bind to the main completion callback pub unsafe fn complete(cb: CompletionCb) { unsafe { - task::local_data::local_data_set(complete_key, @(move cb)); + task::local_data::local_data_set(complete_key, @(cb)); extern fn callback(line: *c_char, completions: *()) { unsafe { diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index 8ff90b940fb56..8e878c8fc2e31 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -848,11 +848,11 @@ pub mod node { offset += 1u; i += 1u; } - cast::forget(move local_buf); + cast::forget(local_buf); } } } - return cast::transmute(move buf); + return cast::transmute(buf); } } diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs index 1d91fafa4f962..242e318e8a8f0 100644 --- a/src/libstd/sha1.rs +++ b/src/libstd/sha1.rs @@ -265,7 +265,7 @@ pub fn sha1() -> Sha1 { computed: false, work_buf: @mut vec::from_elem(work_buf_len, 0u32) }; - let mut sh = (move st) as Sha1; + let mut sh = (st) as Sha1; sh.reset(); return sh; } diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 98a451dc8abdd..e56f4cb87cd43 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -59,7 +59,7 @@ pub pure fn merge_sort(v: &[const T], le: Le) -> ~[T] { } rs.push_all(vec::slice(a, a_ix, a_len)); rs.push_all(vec::slice(b, b_ix, b_len)); - move rs + rs } } @@ -241,7 +241,7 @@ fn binarysort(array: &mut [T], start: uint) { let mut n = start-left; copy_vec(array, left+1, array, left, n); - array[left] = move pivot; + array[left] = pivot; start += 1; } } @@ -816,7 +816,7 @@ mod test_qsort { do quick_sort(names) |x, y| { int::le(*x, *y) }; - let immut_names = move names; + let immut_names = names; let pairs = vec::zip_slice(expected, immut_names); for vec::each(pairs) |p| { @@ -1022,14 +1022,14 @@ mod big_tests { let res = do vec::from_fn(num) |i| { arr[i % size] }; - move res + res } fn makeRange(n: uint) -> ~[uint] { let one = do vec::from_fn(n) |i| { i }; let mut two = copy one; vec::reverse(two); - vec::append(move two, one) + vec::append(two, one) } fn tabulate_unique(lo: uint, hi: uint) { @@ -1048,7 +1048,7 @@ mod big_tests { let arr = do vec::from_fn(n) |_i| { rng.gen_float() }; - let mut arr = move arr; + let mut arr = arr; tim_sort(arr); // *sort isSorted(arr); @@ -1089,7 +1089,7 @@ mod big_tests { let mut arr = if n > 4 { let part = vec::view(arr, 0, 4); multiplyVec(part, n) - } else { move arr }; + } else { arr }; tim_sort(arr); // ~sort isSorted(arr); @@ -1120,7 +1120,7 @@ mod big_tests { let arr = do vec::from_fn(n) |_i| { @rng.gen_float() }; - let mut arr = move arr; + let mut arr = arr; tim_sort(arr); // *sort isSorted(arr); @@ -1161,7 +1161,7 @@ mod big_tests { let mut arr = if n > 4 { let part = vec::view(arr, 0, 4); multiplyVec(part, n) - } else { move arr }; + } else { arr }; tim_sort(arr); // ~sort isSorted(arr); diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index af773f5bf4e50..fd0b0d6be3a2d 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -40,7 +40,7 @@ struct Waitqueue { head: pipes::Port, fn new_waitqueue() -> Waitqueue { let (block_head, block_tail) = pipes::stream(); - Waitqueue { head: move block_head, tail: move block_tail } + Waitqueue { head: block_head, tail: block_tail } } // Signals one live task from the queue. @@ -86,7 +86,7 @@ enum Sem = Exclusive>; #[doc(hidden)] fn new_sem(count: int, q: Q) -> Sem { Sem(exclusive(SemInner { - mut count: count, waiters: new_waitqueue(), blocked: move q })) + mut count: count, waiters: new_waitqueue(), blocked: q })) } #[doc(hidden)] fn new_sem_and_signal(count: int, num_condvars: uint) @@ -109,9 +109,9 @@ impl &Sem { // Create waiter nobe. let (WaitEnd, SignalEnd) = pipes::oneshot(); // Tell outer scope we need to block. - waiter_nobe = Some(move WaitEnd); + waiter_nobe = Some(WaitEnd); // Enqueue ourself. - state.waiters.tail.send(move SignalEnd); + state.waiters.tail.send(SignalEnd); } } } @@ -119,7 +119,7 @@ impl &Sem { /* for 1000.times { task::yield(); } */ // Need to wait outside the exclusive. if waiter_nobe.is_some() { - let _ = pipes::recv_one(option::unwrap(move waiter_nobe)); + let _ = pipes::recv_one(option::unwrap(waiter_nobe)); } } fn release() { @@ -215,8 +215,8 @@ impl &Condvar { fn wait_on(condvar_id: uint) { // Create waiter nobe. let (WaitEnd, SignalEnd) = pipes::oneshot(); - let mut WaitEnd = Some(move WaitEnd); - let mut SignalEnd = Some(move SignalEnd); + let mut WaitEnd = Some(WaitEnd); + let mut SignalEnd = Some(SignalEnd); let mut reacquire = None; let mut out_of_bounds = None; unsafe { @@ -231,7 +231,7 @@ impl &Condvar { } // Enqueue ourself to be woken up by a signaller. let SignalEnd = option::swap_unwrap(&mut SignalEnd); - state.blocked[condvar_id].tail.send(move SignalEnd); + state.blocked[condvar_id].tail.send(SignalEnd); } else { out_of_bounds = Some(vec::len(state.blocked)); } @@ -737,7 +737,7 @@ mod tests { pub fn test_sem_as_mutex() { let s = ~semaphore(1); let s2 = ~s.clone(); - do task::spawn |move s2| { + do task::spawn || { do s2.access { for 5.times { task::yield(); } } @@ -752,7 +752,7 @@ mod tests { let (p,c) = pipes::stream(); let s = ~semaphore(0); let s2 = ~s.clone(); - do task::spawn |move s2, move c| { + do task::spawn || { s2.acquire(); c.send(()); } @@ -764,7 +764,7 @@ mod tests { let (p,c) = pipes::stream(); let s = ~semaphore(0); let s2 = ~s.clone(); - do task::spawn |move s2, move p| { + do task::spawn || { for 5.times { task::yield(); } s2.release(); let _ = p.recv(); @@ -780,7 +780,7 @@ mod tests { let s2 = ~s.clone(); let (p1,c1) = pipes::stream(); let (p2,c2) = pipes::stream(); - do task::spawn |move s2, move c1, move p2| { + do task::spawn || { do s2.access { let _ = p2.recv(); c1.send(()); @@ -799,10 +799,10 @@ mod tests { let s = ~semaphore(1); let s2 = ~s.clone(); let (p,c) = pipes::stream(); - let child_data = ~mut Some((move s2, move c)); + let child_data = ~mut Some((s2, c)); do s.access { let (s2,c) = option::swap_unwrap(child_data); - do task::spawn |move c, move s2| { + do task::spawn || { c.send(()); do s2.access { } c.send(()); @@ -825,7 +825,7 @@ mod tests { let m2 = ~m.clone(); let mut sharedstate = ~0; let ptr = ptr::addr_of(&(*sharedstate)); - do task::spawn |move m2, move c| { + do task::spawn || { let sharedstate: &mut int = unsafe { cast::reinterpret_cast(&ptr) }; access_shared(sharedstate, m2, 10); @@ -854,7 +854,7 @@ mod tests { // Child wakes up parent do m.lock_cond |cond| { let m2 = ~m.clone(); - do task::spawn |move m2| { + do task::spawn || { do m2.lock_cond |cond| { let woken = cond.signal(); assert woken; @@ -865,7 +865,7 @@ mod tests { // Parent wakes up child let (port,chan) = pipes::stream(); let m3 = ~m.clone(); - do task::spawn |move chan, move m3| { + do task::spawn || { do m3.lock_cond |cond| { chan.send(()); cond.wait(); @@ -887,8 +887,8 @@ mod tests { for num_waiters.times { let mi = ~m.clone(); let (port, chan) = pipes::stream(); - ports.push(move port); - do task::spawn |move chan, move mi| { + ports.push(port); + do task::spawn || { do mi.lock_cond |cond| { chan.send(()); cond.wait(); @@ -918,7 +918,7 @@ mod tests { pub fn test_mutex_cond_no_waiter() { let m = ~Mutex(); let m2 = ~m.clone(); - do task::try |move m| { + do task::try || { do m.lock_cond |_x| { } }; do m2.lock_cond |cond| { @@ -931,7 +931,7 @@ mod tests { let m = ~Mutex(); let m2 = ~m.clone(); - let result: result::Result<(),()> = do task::try |move m2| { + let result: result::Result<(),()> = do task::try || { do m2.lock { fail!(); } @@ -947,9 +947,9 @@ mod tests { let m = ~Mutex(); let m2 = ~m.clone(); - let result: result::Result<(),()> = do task::try |move m2| { + let result: result::Result<(),()> = do task::try || { let (p,c) = pipes::stream(); - do task::spawn |move p| { // linked + do task::spawn || { // linked let _ = p.recv(); // wait for sibling to get in the mutex task::yield(); fail!(); @@ -972,19 +972,19 @@ mod tests { let m2 = ~m.clone(); let (p,c) = pipes::stream(); - let result: result::Result<(),()> = do task::try |move c, move m2| { + let result: result::Result<(),()> = do task::try || { let mut sibling_convos = ~[]; for 2.times { let (p,c) = pipes::stream(); - let c = ~mut Some(move c); - sibling_convos.push(move p); + let c = ~mut Some(c); + sibling_convos.push(p); let mi = ~m2.clone(); // spawn sibling task - do task::spawn |move mi, move c| { // linked + do task::spawn || { // linked do mi.lock_cond |cond| { let c = option::swap_unwrap(c); c.send(()); // tell sibling to go ahead - let _z = SendOnFailure(move c); + let _z = SendOnFailure(c); cond.wait(); // block forever } } @@ -993,7 +993,7 @@ mod tests { let _ = p.recv(); // wait for sibling to get in the mutex } do m2.lock { } - c.send(move sibling_convos); // let parent wait on all children + c.send(sibling_convos); // let parent wait on all children fail!(); }; assert result.is_err(); @@ -1015,7 +1015,7 @@ mod tests { fn SendOnFailure(c: pipes::Chan<()>) -> SendOnFailure { SendOnFailure { - c: move c + c: c } } } @@ -1025,7 +1025,7 @@ mod tests { let m = ~Mutex(); do m.lock_cond |cond| { let m2 = ~m.clone(); - do task::spawn |move m2| { + do task::spawn || { do m2.lock_cond |cond| { cond.signal_on(0); } @@ -1039,7 +1039,7 @@ mod tests { let m = ~mutex_with_condvars(2); let m2 = ~m.clone(); let (p,c) = pipes::stream(); - do task::spawn |move m2, move c| { + do task::spawn || { do m2.lock_cond |cond| { c.send(()); cond.wait_on(1); @@ -1088,7 +1088,7 @@ mod tests { }, DowngradeRead => do x.write_downgrade |mode| { - let mode = x.downgrade(move mode); + let mode = x.downgrade(mode); (&mode).read(blk); }, } @@ -1103,7 +1103,7 @@ mod tests { let x2 = ~x.clone(); let mut sharedstate = ~0; let ptr = ptr::addr_of(&(*sharedstate)); - do task::spawn |move c, move x2| { + do task::spawn || { let sharedstate: &mut int = unsafe { cast::reinterpret_cast(&ptr) }; access_shared(sharedstate, x2, mode1, 10); @@ -1148,7 +1148,7 @@ mod tests { let x2 = ~x.clone(); let (p1,c1) = pipes::stream(); let (p2,c2) = pipes::stream(); - do task::spawn |move c1, move x2, move p2| { + do task::spawn || { if !make_mode2_go_first { let _ = p2.recv(); // parent sends to us once it locks, or ... } @@ -1185,10 +1185,10 @@ mod tests { // Tests that downgrade can unlock the lock in both modes let x = ~RWlock(); do lock_rwlock_in_mode(x, Downgrade) { } - test_rwlock_handshake(move x, Read, Read, false); + test_rwlock_handshake(x, Read, Read, false); let y = ~RWlock(); do lock_rwlock_in_mode(y, DowngradeRead) { } - test_rwlock_exclusion(move y, Write, Write); + test_rwlock_exclusion(y, Write, Write); } #[test] pub fn test_rwlock_read_recursive() { @@ -1203,7 +1203,7 @@ mod tests { // Child wakes up parent do x.write_cond |cond| { let x2 = ~x.clone(); - do task::spawn |move x2| { + do task::spawn || { do x2.write_cond |cond| { let woken = cond.signal(); assert woken; @@ -1214,7 +1214,7 @@ mod tests { // Parent wakes up child let (port,chan) = pipes::stream(); let x3 = ~x.clone(); - do task::spawn |move x3, move chan| { + do task::spawn || { do x3.write_cond |cond| { chan.send(()); cond.wait(); @@ -1250,8 +1250,8 @@ mod tests { for num_waiters.times { let xi = ~x.clone(); let (port, chan) = pipes::stream(); - ports.push(move port); - do task::spawn |move chan, move xi| { + ports.push(port); + do task::spawn || { do lock_cond(xi, dg1) |cond| { chan.send(()); cond.wait(); @@ -1286,7 +1286,7 @@ mod tests { let x = ~RWlock(); let x2 = ~x.clone(); - let result: result::Result<(),()> = do task::try |move x2| { + let result: result::Result<(),()> = do task::try || { do lock_rwlock_in_mode(x2, mode1) { fail!(); } @@ -1332,7 +1332,7 @@ mod tests { let x = ~RWlock(); let y = ~RWlock(); do x.write_downgrade |xwrite| { - let mut xopt = Some(move xwrite); + let mut xopt = Some(xwrite); do y.write_downgrade |_ywrite| { y.downgrade(option::swap_unwrap(&mut xopt)); error!("oops, y.downgrade(x) should have failed!"); diff --git a/src/libstd/task_pool.rs b/src/libstd/task_pool.rs index 5ed2195d2d2ad..6f479fbb9f7f5 100644 --- a/src/libstd/task_pool.rs +++ b/src/libstd/task_pool.rs @@ -50,11 +50,11 @@ pub impl TaskPool { let (port, chan) = pipes::stream::>(); let init_fn = init_fn_factory(); - let task_body: ~fn() = |move port, move init_fn| { + let task_body: ~fn() = || { let local_data = init_fn(i); loop { match port.recv() { - Execute(move f) => f(&local_data), + Execute(f) => f(&local_data), Quit => break } } @@ -64,23 +64,23 @@ pub impl TaskPool { match opt_sched_mode { None => { // Run on this scheduler. - task::spawn(move task_body); + task::spawn(task_body); } Some(sched_mode) => { - task::task().sched_mode(sched_mode).spawn(move task_body); + task::task().sched_mode(sched_mode).spawn(task_body); } } - move chan + chan }; - return TaskPool { channels: move channels, next_index: 0 }; + return TaskPool { channels: channels, next_index: 0 }; } /// Executes the function `f` on a task in the pool. The function /// receives a reference to the local data returned by the `init_fn`. fn execute(&self, f: ~fn(&T)) { - self.channels[self.next_index].send(Execute(move f)); + self.channels[self.next_index].send(Execute(f)); self.next_index += 1; if self.next_index == self.channels.len() { self.next_index = 0; } } @@ -90,9 +90,9 @@ pub impl TaskPool { fn test_task_pool() { let f: ~fn() -> ~fn(uint) -> uint = || { let g: ~fn(uint) -> uint = |i| i; - move g + g }; - let pool = TaskPool::new(4, Some(SingleThreaded), move f); + let pool = TaskPool::new(4, Some(SingleThreaded), f); for 8.times { pool.execute(|i| io::println(fmt!("Hello from thread %u!", *i))); } diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 2eae377b91af5..cd03de9118390 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -120,8 +120,8 @@ pub struct TestDescAndFn { pub fn test_main(args: &[~str], tests: ~[TestDescAndFn]) { let opts = match parse_opts(args) { - either::Left(move o) => o, - either::Right(move m) => fail!(m) + either::Left(o) => o, + either::Right(m) => fail!(m) }; if !run_tests_console(&opts, tests) { fail!(~"Some tests failed"); } } @@ -173,8 +173,8 @@ pub fn parse_opts(args: &[~str]) -> OptRes { getopts::optopt(~"logfile")]; let matches = match getopts::getopts(args_, opts) { - Ok(move m) => m, - Err(move f) => return either::Right(getopts::fail_str(f)) + Ok(m) => m, + Err(f) => return either::Right(getopts::fail_str(f)) }; let filter = @@ -260,7 +260,7 @@ pub fn run_tests_console(opts: &TestOpts, st.failed += 1; write_failed(st.out, st.use_color); st.out.write_line(~""); - st.failures.push(move test); + st.failures.push(test); } TrIgnored => { st.ignored += 1; @@ -410,7 +410,7 @@ fn should_sort_failures_before_printing_them() { mut failed: 0u, mut ignored: 0u, mut benchmarked: 0u, - mut failures: ~[move test_b, move test_a] + mut failures: ~[test_b, test_a] }; print_failures(st); @@ -486,7 +486,7 @@ fn run_tests(opts: &TestOpts, callback(TeWait(copy b.desc)); run_test(!opts.run_benchmarks, b, ch.clone()); let (test, result) = p.recv(); - callback(TeResult(move test, result)); + callback(TeResult(test, result)); } } @@ -514,7 +514,7 @@ pub fn filter_tests( // Remove tests that don't match the test filter filtered = if opts.filter.is_none() { - move filtered + filtered } else { let filter_str = match opts.filter { @@ -534,7 +534,7 @@ pub fn filter_tests( // Maybe pull out the ignored test and unignore them filtered = if !opts.run_ignored { - move filtered + filtered } else { fn filter(test: TestDescAndFn) -> Option { if test.desc.ignore { @@ -556,7 +556,7 @@ pub fn filter_tests( } sort::quick_sort(filtered, lteq); - move filtered + filtered } struct TestFuture { @@ -582,9 +582,9 @@ pub fn run_test(force_ignore: bool, do task::spawn { let mut result_future = None; // task::future_result(builder); task::task().unlinked().future_result(|+r| { - result_future = Some(move r); + result_future = Some(r); }).spawn(testfn_cell.take()); - let task_result = option::unwrap(move result_future).recv(); + let task_result = option::unwrap(result_future).recv(); let test_result = calc_result(&desc, task_result == task::Success); monitor_ch.send((desc, test_result)); @@ -965,9 +965,9 @@ mod tests { }, testfn: DynTestFn(copy testfn), }; - tests.push(move test); + tests.push(test); } - move tests + tests }; let filtered = filter_tests(&opts, tests); @@ -980,7 +980,7 @@ mod tests { ~"test::parse_ignored_flag", ~"test::sort_tests"]; - let pairs = vec::zip(expected, move filtered); + let pairs = vec::zip(expected, filtered); for vec::each(pairs) |p| { match *p { diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 77e7e3c3054d8..0b8b6c8d34d68 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -170,7 +170,7 @@ pub fn at_utc(clock: Timespec) -> Tm { let mut Timespec { sec, nsec } = clock; let mut tm = empty_tm(); rustrt::rust_gmtime(sec, nsec, tm); - move tm + tm } } @@ -185,7 +185,7 @@ pub fn at(clock: Timespec) -> Tm { let mut Timespec { sec, nsec } = clock; let mut tm = empty_tm(); rustrt::rust_localtime(sec, nsec, tm); - move tm + tm } } @@ -205,7 +205,7 @@ pub pure fn strptime(s: &str, format: &str) -> Result { pub pure fn strftime(format: &str, tm: &Tm) -> ~str { // unsafe only because do_strftime is annoying to make pure // (it does IO with a str_reader) - move unsafe { do_strftime(format, tm) } + unsafe { do_strftime(format, tm) } } impl Tm { @@ -240,7 +240,7 @@ impl Tm { /// Formats the time according to the format string. pure fn strftime(&self, format: &str) -> ~str { - move strftime(format, self) + strftime(format, self) } /** @@ -689,7 +689,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result { '%' => { match parse_type(s, pos, rdr.read_char(), &mut tm) { Ok(next) => pos = next, - Err(move e) => { result = Err(move e); break; } + Err(e) => { result = Err(e); break; } } }, c => { @@ -714,7 +714,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result { tm_zone: copy tm.tm_zone, tm_nsec: tm.tm_nsec, }) - } else { move result } + } else { result } } } @@ -882,7 +882,7 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str { } } - move buf + buf } #[cfg(test)] diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 3152f0b540524..872d53e93ebbe 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -98,7 +98,7 @@ fn get_monitor_task_gl() -> IoTask { fn spawn_loop() -> IoTask { let builder = do task().add_wrapper |task_body| { - fn~(move task_body) { + fn~() { // The I/O loop task also needs to be weak so it doesn't keep // the runtime alive unsafe { @@ -116,7 +116,7 @@ fn spawn_loop() -> IoTask { } }; let builder = builder.unlinked(); - spawn_iotask(move builder) + spawn_iotask(builder) } #[cfg(test)] diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index a93bdf86a6428..be4240237adf4 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -78,7 +78,7 @@ pub fn spawn_iotask(task: task::TaskBuilder) -> IoTask { */ pub unsafe fn interact(iotask: &IoTask, cb: fn~(*c_void)) { - send_msg(iotask, Interaction(move cb)); + send_msg(iotask, Interaction(cb)); } /** @@ -150,7 +150,7 @@ struct IoTaskLoopData { fn send_msg(iotask: &IoTask, msg: IoTaskMsg) { - iotask.op_chan.send(move msg); + iotask.op_chan.send(msg); unsafe { ll::async_send(iotask.async_handle); } diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index f99b2a62f4750..96b285b8c0a85 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -1252,7 +1252,6 @@ pub mod test { get_data_for_uv_handle(stream as *libc::c_void) as *request_wrapper; let buf_base = get_base_from_buf(buf); - let buf_len = get_len_from_buf(buf); let bytes = vec::from_buf(buf_base, nread as uint); let read_chan = (*client_data).read_chan.clone(); let msg_from_server = str::from_bytes(bytes); diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index 87a72f988c36a..cb0f7d84b4117 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -235,7 +235,7 @@ fn json_encode>(t: &T) -> ~str { fn json_decode>(s: &str) -> T { do io::with_str_reader(s) |rdr| { let j = result::unwrap(json::from_reader(rdr)); - Decodable::decode(&json::Decoder(move j)) + Decodable::decode(&json::Decoder(j)) } } @@ -323,20 +323,20 @@ impl TPrep for @Mut { Decodable>(&self, blk: ~fn(&Exec) -> T) -> Work { - let mut bo = Some(move blk); + let mut bo = Some(blk); do self.borrow_imm |p| { let cached = do p.ctxt.db.borrow_mut |db| { db.prepare(p.fn_name, &p.declared_inputs) }; - match move cached { + match cached { Some((ref disc_in, ref disc_out, ref res)) if self.all_fresh("declared input", &p.declared_inputs) && self.all_fresh("discovered input", disc_in) && self.all_fresh("discovered output", disc_out) => { - Work::new(*self, move Left(json_decode(*res))) + Work::new(*self, Left(json_decode(*res))) } _ => { @@ -344,16 +344,16 @@ impl TPrep for @Mut { let mut blk = None; blk <-> bo; let blk = blk.unwrap(); - let chan = ~mut Some(move chan); - do task::spawn |move blk, move chan| { + let chan = ~mut Some(chan); + do task::spawn || { let exe = Exec{discovered_inputs: LinearMap::new(), discovered_outputs: LinearMap::new()}; let chan = option::swap_unwrap(&mut *chan); let v = blk(&exe); - send_one(move chan, (move exe, move v)); + send_one(chan, (exe, v)); } - Work::new(*self, move Right(move port)) + Work::new(*self, Right(port)) } } } @@ -365,7 +365,7 @@ impl> Work { static fn new(p: @Mut, e: Either>) -> Work { - move Work { prep: p, res: Some(move e) } + Work { prep: p, res: Some(e) } } } @@ -374,18 +374,18 @@ fn unwrap Decodable>(w: Work) -> T { - let mut ww = move w; + let mut ww = w; let mut s = None; ww.res <-> s; - match move s { + match s { None => fail!(), - Some(Left(move v)) => move v, - Some(Right(move port)) => { + Some(Left(v)) => v, + Some(Right(port)) => { - let (exe, v) = match recv(move port) { - oneshot::send(move data) => move data + let (exe, v) = match recv(port) { + oneshot::send(data) => data }; let s = json_encode(&v); @@ -399,7 +399,7 @@ fn unwrap Date: Fri, 15 Feb 2013 00:18:22 -0800 Subject: [PATCH 02/10] libstd: Fix broken test. --- src/libstd/future.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/future.rs b/src/libstd/future.rs index 6de6363695c77..e8c9a568a96e7 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -203,7 +203,7 @@ pub mod test { pub fn test_sendable_future() { let expected = ~"schlorf"; let f = do spawn |copy expected| { copy expected }; - do task::spawn |f, expected| { + do task::spawn || { let actual = f.get(); assert actual == expected; } From 4b7d27c2a7311836f6b131759d4402cb48dadb51 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 00:27:41 -0800 Subject: [PATCH 03/10] libcargo: Get rid of `move`. --- src/libcargo/cargo.rc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcargo/cargo.rc b/src/libcargo/cargo.rc index 782878e05c70f..98fd50909545b 100644 --- a/src/libcargo/cargo.rc +++ b/src/libcargo/cargo.rc @@ -744,7 +744,7 @@ pub fn configure(opts: Options) -> Cargo { ~" or package manager to get it to work correctly"); } - move c + c } pub fn for_each_package(c: &Cargo, b: fn(s: @Source, p: &Package)) { @@ -1655,10 +1655,10 @@ pub fn dump_sources(c: &Cargo) { _ => () } - hash.insert(copy k, json::Object(move chash)); + hash.insert(copy k, json::Object(chash)); } - json::to_writer(writer, &json::Object(move hash)) + json::to_writer(writer, &json::Object(hash)) } result::Err(e) => { error(fmt!("could not dump sources: %s", e)); From 78f3e0da700ef88ce9b46078292295e51355a756 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 00:37:08 -0800 Subject: [PATCH 04/10] librustdoc: Get rid of `move`. --- src/librustdoc/astsrv.rs | 6 +++--- src/librustdoc/attr_pass.rs | 2 +- src/librustdoc/config.rs | 10 +++++----- src/librustdoc/fold.rs | 32 +++++++++++++++---------------- src/librustdoc/markdown_pass.rs | 10 +++++----- src/librustdoc/markdown_writer.rs | 20 +++++++++---------- src/librustdoc/page_pass.rs | 2 +- src/librustdoc/path_pass.rs | 2 +- src/librustdoc/rustdoc.rc | 2 +- src/librustdoc/sort_pass.rs | 2 +- src/librustdoc/text_pass.rs | 4 ++-- 11 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/librustdoc/astsrv.rs b/src/librustdoc/astsrv.rs index f07701f05e799..f34a7ffbbdbcf 100644 --- a/src/librustdoc/astsrv.rs +++ b/src/librustdoc/astsrv.rs @@ -91,7 +91,7 @@ fn run(owner: SrvOwner, source: ~str, parse: Parser) -> T { let res = owner(srv_.clone()); srv_.ch.send(Exit); - move res + res } fn act(po: &Port, source: ~str, parse: Parser) { @@ -120,10 +120,10 @@ pub fn exec( f: fn~(ctxt: Ctxt) -> T ) -> T { let (po, ch) = stream(); - let msg = HandleRequest(fn~(move f, ctxt: Ctxt) { + let msg = HandleRequest(fn~(ctxt: Ctxt) { ch.send(f(ctxt)) }); - srv.ch.send(move msg); + srv.ch.send(msg); po.recv() } diff --git a/src/librustdoc/attr_pass.rs b/src/librustdoc/attr_pass.rs index 9669beae57589..85ac952d6d481 100644 --- a/src/librustdoc/attr_pass.rs +++ b/src/librustdoc/attr_pass.rs @@ -115,7 +115,7 @@ fn parse_item_attrs( srv: astsrv::Srv, id: doc::AstId, parse_attrs: fn~(a: ~[ast::attribute]) -> T) -> T { - do astsrv::exec(srv) |move parse_attrs, ctxt| { + do astsrv::exec(srv) |ctxt| { let attrs = match ctxt.ast_map.get(&id) { ast_map::node_item(item, _) => copy item.attrs, ast_map::node_foreign_item(item, _, _) => copy item.attrs, diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index f75f4b83a1d62..ceea3d0e798d2 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -133,7 +133,7 @@ pub fn parse_config_( result::Ok(matches) => { if matches.free.len() == 1 { let input_crate = Path(vec::head(matches.free)); - config_from_opts(&input_crate, &matches, move program_output) + config_from_opts(&input_crate, &matches, program_output) } else if matches.free.is_empty() { result::Err(~"no crates specified") } else { @@ -191,11 +191,11 @@ fn config_from_opts( } } }; - let program_output = Cell(move program_output); + let program_output = Cell(program_output); let result = do result::chain(result) |config| { let pandoc_cmd = getopts::opt_maybe_str(matches, opt_pandoc_cmd()); let pandoc_cmd = maybe_find_pandoc( - &config, pandoc_cmd, move program_output.take()); + &config, pandoc_cmd, program_output.take()); do result::chain(pandoc_cmd) |pandoc_cmd| { result::Ok(Config { pandoc_cmd: pandoc_cmd, @@ -268,7 +268,7 @@ fn should_find_pandoc() { status: 0, out: ~"pandoc 1.8.2.1", err: ~"" } }; - let result = maybe_find_pandoc(&config, None, move mock_program_output); + let result = maybe_find_pandoc(&config, None, mock_program_output); assert result == result::Ok(Some(~"pandoc")); } @@ -284,7 +284,7 @@ fn should_error_with_no_pandoc() { status: 1, out: ~"", err: ~"" } }; - let result = maybe_find_pandoc(&config, None, move mock_program_output); + let result = maybe_find_pandoc(&config, None, mock_program_output); assert result == result::Err(~"couldn't find pandoc"); } diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index b9e598dc19d66..113cce422c474 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -87,25 +87,25 @@ fn mk_fold( fold_struct: FoldStruct ) -> Fold { Fold { - ctxt: move ctxt, - fold_doc: move fold_doc, - fold_crate: move fold_crate, - fold_item: move fold_item, - fold_mod: move fold_mod, - fold_nmod: move fold_nmod, - fold_fn: move fold_fn, - fold_const: move fold_const, - fold_enum: move fold_enum, - fold_trait: move fold_trait, - fold_impl: move fold_impl, - fold_type: move fold_type, - fold_struct: move fold_struct + ctxt: ctxt, + fold_doc: fold_doc, + fold_crate: fold_crate, + fold_item: fold_item, + fold_mod: fold_mod, + fold_nmod: fold_nmod, + fold_fn: fold_fn, + fold_const: fold_const, + fold_enum: fold_enum, + fold_trait: fold_trait, + fold_impl: fold_impl, + fold_type: fold_type, + fold_struct: fold_struct } } pub fn default_any_fold(ctxt: T) -> Fold { mk_fold( - move ctxt, + ctxt, |f, d| default_seq_fold_doc(f, d), |f, d| default_seq_fold_crate(f, d), |f, d| default_seq_fold_item(f, d), @@ -123,7 +123,7 @@ pub fn default_any_fold(ctxt: T) -> Fold { pub fn default_seq_fold(ctxt: T) -> Fold { mk_fold( - move ctxt, + ctxt, |f, d| default_seq_fold_doc(f, d), |f, d| default_seq_fold_crate(f, d), |f, d| default_seq_fold_item(f, d), @@ -141,7 +141,7 @@ pub fn default_seq_fold(ctxt: T) -> Fold { pub fn default_par_fold(ctxt: T) -> Fold { mk_fold( - move ctxt, + ctxt, |f, d| default_seq_fold_doc(f, d), |f, d| default_seq_fold_crate(f, d), |f, d| default_seq_fold_item(f, d), diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index bf499e2c5d0ec..6a56a1c66e71a 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -74,7 +74,7 @@ fn run( ~"mods last", mods_last ).f)(srv, copy doc); - write_markdown(sorted_doc, move writer_factory); + write_markdown(sorted_doc, writer_factory); return doc; } @@ -148,7 +148,7 @@ fn should_request_new_writer_for_each_page() { let (srv, doc) = test::create_doc_srv(~"mod a { }"); // Split the document up into pages let doc = (page_pass::mk_pass(config::DocPerMod).f)(srv, doc); - write_markdown(doc, move writer_factory); + write_markdown(doc, writer_factory); // We expect two pages to have been written for iter::repeat(2) { po.recv(); @@ -180,7 +180,7 @@ fn should_write_title_for_each_page() { let (srv, doc) = test::create_doc_srv( ~"#[link(name = \"core\")]; mod a { }"); let doc = (page_pass::mk_pass(config::DocPerMod).f)(srv, doc); - write_markdown(doc, move writer_factory); + write_markdown(doc, writer_factory); for iter::repeat(2) { let (page, markdown) = po.recv(); match page { @@ -894,7 +894,7 @@ mod test { doc: doc::Doc ) -> ~str { let (writer_factory, po) = markdown_writer::future_writer_factory(); - write_markdown(doc, move writer_factory); + write_markdown(doc, writer_factory); return po.recv().second(); } @@ -903,7 +903,7 @@ mod test { doc: doc::Doc ) -> ~str { let (writer_factory, po) = markdown_writer::future_writer_factory(); - let pass = mk_pass(move writer_factory); + let pass = mk_pass(writer_factory); (pass.f)(srv, doc); return po.recv().second(); } diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs index f0d9effe6fc51..a6cc517079693 100644 --- a/src/librustdoc/markdown_writer.rs +++ b/src/librustdoc/markdown_writer.rs @@ -129,12 +129,12 @@ fn pandoc_writer( os::close(pipe_in.out); let (stdout_po, stdout_ch) = pipes::stream(); - do task::spawn_sched(task::SingleThreaded) |move stdout_ch| { + do task::spawn_sched(task::SingleThreaded) || { stdout_ch.send(readclose(pipe_out.in)); } let (stderr_po, stderr_ch) = pipes::stream(); - do task::spawn_sched(task::SingleThreaded) |move stderr_ch| { + do task::spawn_sched(task::SingleThreaded) || { stderr_ch.send(readclose(pipe_err.in)); } let stdout = stdout_po.recv(); @@ -169,7 +169,7 @@ fn readclose(fd: libc::c_int) -> ~str { fn generic_writer(process: fn~(markdown: ~str)) -> Writer { let (po, ch) = stream::(); - do task::spawn |move process, move setup_ch| { + do task::spawn || { let mut markdown = ~""; let mut keep_going = true; while keep_going { @@ -178,7 +178,7 @@ fn generic_writer(process: fn~(markdown: ~str)) -> Writer { Done => keep_going = false } } - process(move markdown); + process(markdown); }; fn~(instr: WriteInstr) { ch.send(instr); @@ -298,24 +298,24 @@ pub fn future_writer_factory( let writer_factory = fn~(page: doc::Page) -> Writer { let (writer_po, writer_ch) = pipes::stream(); let markdown_ch = markdown_ch.clone(); - do task::spawn |move writer_ch| { + do task::spawn || { let (writer, future) = future_writer(); - writer_ch.send(move writer); + writer_ch.send(writer); let s = future.get(); markdown_ch.send((copy page, s)); } writer_po.recv() }; - (move writer_factory, markdown_po) + (writer_factory, markdown_po) } fn future_writer() -> (Writer, future::Future<~str>) { let (port, chan) = pipes::stream(); - let writer = fn~(move chan, instr: WriteInstr) { + let writer = fn~(instr: WriteInstr) { chan.send(copy instr); }; - let future = do future::from_fn |move port| { + let future = do future::from_fn || { let mut res = ~""; loop { match port.recv() { @@ -325,5 +325,5 @@ fn future_writer() -> (Writer, future::Future<~str>) { } res }; - (move writer, move future) + (writer, future) } diff --git a/src/librustdoc/page_pass.rs b/src/librustdoc/page_pass.rs index 08abe4b351b6f..4971806c7ed81 100644 --- a/src/librustdoc/page_pass.rs +++ b/src/librustdoc/page_pass.rs @@ -71,7 +71,7 @@ fn make_doc_from_pages(page_port: &PagePort) -> doc::Doc { loop { let val = page_port.recv(); if val.is_some() { - pages += ~[option::unwrap(move val)]; + pages += ~[option::unwrap(val)]; } else { break; } diff --git a/src/librustdoc/path_pass.rs b/src/librustdoc/path_pass.rs index 7dc8d0202cbf1..ac50221445f73 100644 --- a/src/librustdoc/path_pass.rs +++ b/src/librustdoc/path_pass.rs @@ -54,7 +54,7 @@ fn run(srv: astsrv::Srv, doc: doc::Doc) -> doc::Doc { fold_item: fold_item, fold_mod: fold_mod, fold_nmod: fold_nmod, - .. fold::default_any_fold(move ctxt) + .. fold::default_any_fold(ctxt) }; (fold.fold_doc)(&fold, doc) } diff --git a/src/librustdoc/rustdoc.rc b/src/librustdoc/rustdoc.rc index b3e9c43e87a1e..7d94352cc8233 100644 --- a/src/librustdoc/rustdoc.rc +++ b/src/librustdoc/rustdoc.rc @@ -149,5 +149,5 @@ fn time(what: ~str, f: fn() -> T) -> T { let rv = f(); let end = std::time::precise_time_s(); info!("time: %3.3f s %s", end - start, what); - move rv + rv } diff --git a/src/librustdoc/sort_pass.rs b/src/librustdoc/sort_pass.rs index b7614a785c742..3bdb08974044d 100644 --- a/src/librustdoc/sort_pass.rs +++ b/src/librustdoc/sort_pass.rs @@ -42,7 +42,7 @@ fn run( ) -> doc::Doc { let fold = Fold { fold_mod: fold_mod, - .. fold::default_any_fold(move lteq) + .. fold::default_any_fold(lteq) }; (fold.fold_doc)(&fold, doc) } diff --git a/src/librustdoc/text_pass.rs b/src/librustdoc/text_pass.rs index 79ba8f0684a58..ab1d77a36db40 100644 --- a/src/librustdoc/text_pass.rs +++ b/src/librustdoc/text_pass.rs @@ -42,14 +42,14 @@ fn run( op: Op ) -> doc::Doc { let op = NominalOp { - op: move op + op: op }; let fold = Fold { fold_item: fold_item, fold_enum: fold_enum, fold_trait: fold_trait, fold_impl: fold_impl, - .. fold::default_any_fold(move op) + .. fold::default_any_fold(op) }; (fold.fold_doc)(&fold, doc) } From 5912b1448ca1b5bcddf8af1ed9e16fc41775af9c Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 03:51:28 -0500 Subject: [PATCH 05/10] libcore: Get rid of `move`. --- src/libcore/at_vec.rs | 4 +- src/libcore/cast.rs | 20 ++--- src/libcore/dlist.rs | 2 +- src/libcore/dvec.rs | 68 +++++++------- src/libcore/either.rs | 10 +-- src/libcore/extfmt.rs | 18 ++-- src/libcore/flate.rs | 4 +- src/libcore/hash.rs | 6 +- src/libcore/io.rs | 16 ++-- src/libcore/iter-trait.rs | 2 +- src/libcore/iter-trait/dvec.rs | 2 +- src/libcore/iter.rs | 12 +-- src/libcore/mutable.rs | 6 +- src/libcore/option.rs | 42 ++++----- src/libcore/os.rs | 14 +-- src/libcore/path.rs | 50 +++++------ src/libcore/pipes.rs | 134 ++++++++++++++-------------- src/libcore/private.rs | 82 ++++++++--------- src/libcore/rand.rs | 6 +- src/libcore/reflect.rs | 2 +- src/libcore/repr.rs | 8 +- src/libcore/result.rs | 24 ++--- src/libcore/run.rs | 14 +-- src/libcore/sys.rs | 4 +- src/libcore/task/local_data_priv.rs | 6 +- src/libcore/task/mod.rs | 78 ++++++++-------- src/libcore/task/spawn.rs | 68 +++++++------- src/libcore/to_str.rs | 2 +- src/libcore/util.rs | 14 +-- src/libcore/vec.rs | 2 +- 30 files changed, 358 insertions(+), 362 deletions(-) diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 75db5359e2e31..71af60314da82 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -229,12 +229,12 @@ pub mod raw { (**repr).unboxed.fill += sys::size_of::(); let p = addr_of(&((**repr).unboxed.data)); let p = ptr::offset(p, fill) as *mut T; - rusti::move_val_init(&mut(*p), move initval); + rusti::move_val_init(&mut(*p), initval); } pub unsafe fn push_slow(v: &mut @[const T], initval: T) { reserve_at_least(&mut *v, v.len() + 1u); - push_fast(v, move initval); + push_fast(v, initval); } /** diff --git a/src/libcore/cast.rs b/src/libcore/cast.rs index 14cc79ceaffed..22ed4f7694310 100644 --- a/src/libcore/cast.rs +++ b/src/libcore/cast.rs @@ -29,7 +29,7 @@ pub unsafe fn reinterpret_cast(src: &T) -> U { * reinterpret_cast on pointer types. */ #[inline(always)] -pub unsafe fn forget(thing: T) { rusti::forget(move thing); } +pub unsafe fn forget(thing: T) { rusti::forget(thing); } /** * Force-increment the reference count on a shared box. If used @@ -37,7 +37,7 @@ pub unsafe fn forget(thing: T) { rusti::forget(move thing); } * and/or reinterpret_cast when such calls would otherwise scramble a box's * reference count */ -pub unsafe fn bump_box_refcount(t: @T) { forget(move t); } +pub unsafe fn bump_box_refcount(t: @T) { forget(t); } /** * Transform a value of one type into a value of another type. @@ -50,23 +50,23 @@ pub unsafe fn bump_box_refcount(t: @T) { forget(move t); } #[inline(always)] pub unsafe fn transmute(thing: L) -> G { let newthing: G = reinterpret_cast(&thing); - forget(move thing); - move newthing + forget(thing); + newthing } /// Coerce an immutable reference to be mutable. #[inline(always)] -pub unsafe fn transmute_mut(ptr: &a/T) -> &a/mut T { transmute(move ptr) } +pub unsafe fn transmute_mut(ptr: &a/T) -> &a/mut T { transmute(ptr) } /// Coerce a mutable reference to be immutable. #[inline(always)] pub unsafe fn transmute_immut(ptr: &a/mut T) -> &a/T { - transmute(move ptr) + transmute(ptr) } /// Coerce a borrowed pointer to have an arbitrary associated region. #[inline(always)] -pub unsafe fn transmute_region(ptr: &a/T) -> &b/T { transmute(move ptr) } +pub unsafe fn transmute_region(ptr: &a/T) -> &b/T { transmute(ptr) } /// Coerce an immutable reference to be mutable. #[inline(always)] @@ -83,7 +83,7 @@ pub unsafe fn transmute_immut_unsafe(ptr: *const T) -> *T { /// Coerce a borrowed mutable pointer to have an arbitrary associated region. #[inline(always)] pub unsafe fn transmute_mut_region(ptr: &a/mut T) -> &b/mut T { - transmute(move ptr) + transmute(ptr) } /// Transforms lifetime of the second pointer to match the first. @@ -132,9 +132,9 @@ pub mod tests { use managed::raw::BoxRepr; unsafe { let x = @100u8; - let x: *BoxRepr = transmute(move x); + let x: *BoxRepr = transmute(x); assert (*x).data == 100; - let _x: @int = transmute(move x); + let _x: @int = transmute(x); } } diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index 0af0ecb16aa10..09de94f1aaf7d 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -493,7 +493,7 @@ impl DList { v[index] = *data; } } - move v + v } } diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 0a96bd633d1ef..03a921d7ea504 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -67,18 +67,18 @@ pub pure fn DVec() -> DVec { /// Creates a new dvec with a single element pub pure fn from_elem(e: A) -> DVec { - DVec {mut data: ~[move e]} + DVec {mut data: ~[e]} } /// Creates a new dvec with the contents of a vector pub pure fn from_vec(v: ~[A]) -> DVec { - DVec {mut data: move v} + DVec {mut data: v} } /// Consumes the vector and returns its contents pub pure fn unwrap(d: DVec) -> ~[A] { - let DVec {data: v} = move d; - move v + let DVec {data: v} = d; + v } priv impl DVec { @@ -99,14 +99,14 @@ priv impl DVec { data <-> self.data; let data_ptr: *() = cast::reinterpret_cast(&data); if data_ptr.is_null() { fail!(~"Recursive use of dvec"); } - return f(move data); + return f(data); } } #[inline(always)] fn give_back(data: ~[A]) { unsafe { - self.data = move data; + self.data = data; } } @@ -130,7 +130,7 @@ impl DVec { */ #[inline(always)] fn swap(f: &fn(v: ~[A]) -> ~[A]) { - self.check_out(|v| self.give_back(f(move v))) + self.check_out(|v| self.give_back(f(v))) } /** @@ -141,7 +141,7 @@ impl DVec { #[inline(always)] fn swap_mut(f: &fn(v: ~[mut A]) -> ~[mut A]) { do self.swap |v| { - vec::cast_from_mut(f(vec::cast_to_mut(move v))) + vec::cast_from_mut(f(vec::cast_to_mut(v))) } } @@ -156,16 +156,16 @@ impl DVec { #[inline(always)] fn set(w: ~[A]) { self.check_not_borrowed(); - self.data = move w; + self.data = w; } /// Remove and return the last element fn pop() -> A { do self.check_out |v| { - let mut v = move v; + let mut v = v; let result = v.pop(); - self.give_back(move v); - move result + self.give_back(v); + result } } @@ -176,8 +176,8 @@ impl DVec { data <-> self.data; let data_ptr: *() = cast::reinterpret_cast(&data); if data_ptr.is_null() { fail!(~"Recursive use of dvec"); } - self.data = move ~[move t]; - self.data.push_all_move(move data); + self.data = ~[t]; + self.data.push_all_move(data); } } @@ -185,25 +185,25 @@ impl DVec { #[inline(always)] fn push(t: A) { self.check_not_borrowed(); - self.data.push(move t); + self.data.push(t); } /// Remove and return the first element fn shift() -> A { do self.check_out |v| { - let mut v = move v; + let mut v = v; let result = v.shift(); - self.give_back(move v); - move result + self.give_back(v); + result } } /// Reverse the elements in the list, in place fn reverse() { do self.check_out |v| { - let mut v = move v; + let mut v = v; vec::reverse(v); - self.give_back(move v); + self.give_back(v); } } @@ -211,18 +211,18 @@ impl DVec { fn borrow(op: fn(x: &[A]) -> R) -> R { do self.check_out |v| { let result = op(v); - self.give_back(move v); - move result + self.give_back(v); + result } } /// Gives access to the vector as a slice with mutable contents fn borrow_mut(op: fn(x: &[mut A]) -> R) -> R { do self.check_out |v| { - let mut v = move v; + let mut v = v; let result = op(v); - self.give_back(move v); - move result + self.give_back(v); + result } } } @@ -240,7 +240,7 @@ impl DVec { /// Appends elements from `from_idx` to `to_idx` (exclusive) fn push_slice(ts: &[const A], from_idx: uint, to_idx: uint) { do self.swap |v| { - let mut v = move v; + let mut v = v; let new_len = vec::len(v) + to_idx - from_idx; vec::reserve(&mut v, new_len); let mut i = from_idx; @@ -248,7 +248,7 @@ impl DVec { v.push(ts[i]); i += 1u; } - move v + v } } @@ -265,7 +265,7 @@ impl DVec { none { v } Some(h) { let len = v.len() + h; - let mut v = move v; + let mut v = v; vec::reserve(v, len); v } @@ -286,8 +286,8 @@ impl DVec { unsafe { do self.check_out |v| { let w = copy v; - self.give_back(move v); - move w + self.give_back(v); + w } } } @@ -312,9 +312,9 @@ impl DVec { */ fn grow_set_elt(idx: uint, initval: &A, val: A) { do self.swap |v| { - let mut v = move v; + let mut v = v; v.grow_set(idx, initval, val); - move v + v } } @@ -340,7 +340,7 @@ impl DVec { for vec::rev_each(v) |e| { if !f(e) { break; } } - move v + v } } @@ -353,7 +353,7 @@ impl DVec { for vec::rev_eachi(v) |i, e| { if !f(i, e) { break; } } - move v + v } } } diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 54c9f7b98793b..72aecdd82954f 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -84,7 +84,7 @@ pub fn partition(eithers: ~[Either]) Right(r) => rights.push(r) } } - return (move lefts, move rights); + return (lefts, rights); } #[inline(always)] @@ -131,8 +131,8 @@ pub pure fn is_right(eith: &Either) -> bool { pub pure fn unwrap_left(eith: Either) -> T { //! Retrieves the value in the left branch. Fails if the either is Right. - match move eith { - Left(move x) => move x, + match eith { + Left(x) => x, Right(_) => fail!(~"either::unwrap_left Right") } } @@ -141,8 +141,8 @@ pub pure fn unwrap_left(eith: Either) -> T { pub pure fn unwrap_right(eith: Either) -> U { //! Retrieves the value in the right branch. Fails if the either is Left. - match move eith { - Right(move x) => move x, + match eith { + Right(x) => x, Left(_) => fail!(~"either::unwrap_right Left") } } diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index 3dbc3bef01733..36ea67ea6954e 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -510,7 +510,7 @@ pub mod rt { unsafe { str::unshift_char(&mut s, ' ') }; } } - return unsafe { pad(cv, move s, PadSigned) }; + return unsafe { pad(cv, s, PadSigned) }; } pub pure fn conv_uint(cv: Conv, u: uint) -> ~str { let prec = get_int_precision(cv); @@ -522,7 +522,7 @@ pub mod rt { TyBits => uint_to_str_prec(u, 2, prec), TyOctal => uint_to_str_prec(u, 8, prec) }; - return unsafe { pad(cv, move rs, PadUnsigned) }; + return unsafe { pad(cv, rs, PadUnsigned) }; } pub pure fn conv_bool(cv: Conv, b: bool) -> ~str { let s = if b { ~"true" } else { ~"false" }; @@ -532,7 +532,7 @@ pub mod rt { } pub pure fn conv_char(cv: Conv, c: char) -> ~str { let mut s = str::from_char(c); - return unsafe { pad(cv, move s, PadNozero) }; + return unsafe { pad(cv, s, PadNozero) }; } pub pure fn conv_str(cv: Conv, s: &str) -> ~str { // For strings, precision is the maximum characters @@ -545,7 +545,7 @@ pub mod rt { s.to_owned() } }; - return unsafe { pad(cv, move unpadded, PadNozero) }; + return unsafe { pad(cv, unpadded, PadNozero) }; } pub pure fn conv_float(cv: Conv, f: float) -> ~str { let (to_str, digits) = match cv.precision { @@ -560,7 +560,7 @@ pub mod rt { s = ~" " + s; } } - return unsafe { pad(cv, move s, PadFloat) }; + return unsafe { pad(cv, s, PadFloat) }; } pub pure fn conv_poly(cv: Conv, v: &T) -> ~str { let s = sys::log_str(v); @@ -589,7 +589,7 @@ pub mod rt { let diff = prec - len; let pad = str::from_chars(vec::from_elem(diff, '0')); pad + s - } else { move s } + } else { s } }; } pub pure fn get_int_precision(cv: Conv) -> uint { @@ -603,13 +603,13 @@ pub mod rt { pub enum PadMode { PadSigned, PadUnsigned, PadNozero, PadFloat } pub fn pad(cv: Conv, s: ~str, mode: PadMode) -> ~str { - let mut s = move s; // sadtimes + let mut s = s; // sadtimes let uwidth : uint = match cv.width { - CountImplied => return (move s), + CountImplied => return (s), CountIs(width) => { width as uint } }; let strlen = str::char_len(s); - if uwidth <= strlen { return (move s); } + if uwidth <= strlen { return (s); } let mut padchar = ' '; let diff = uwidth - strlen; if have_flag(cv.flags, flag_left_justify) { diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index 6b5c083662b84..c47e27e75d950 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -50,7 +50,7 @@ pub fn deflate_bytes(bytes: &[const u8]) -> ~[u8] { let out = vec::raw::from_buf_raw(res as *u8, outsz as uint); libc::free(res); - move out + out } } } @@ -68,7 +68,7 @@ pub fn inflate_bytes(bytes: &[const u8]) -> ~[u8] { let out = vec::raw::from_buf_raw(res as *u8, outsz as uint); libc::free(res); - move out + out } } } diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs index b4f4e7d343b0a..40a9de0cea349 100644 --- a/src/libcore/hash.rs +++ b/src/libcore/hash.rs @@ -183,7 +183,7 @@ fn SipState(key0: u64, key1: u64) -> SipState { mut ntail : 0u, }; (&state).reset(); - move state + state } @@ -352,7 +352,7 @@ impl Streaming for &SipState { for vec::each(r) |b| { s += uint::to_str_radix(*b as uint, 16u); } - move s + s } #[inline(always)] @@ -447,7 +447,7 @@ pub fn test_siphash() { for vec::each(*r) |b| { s += uint::to_str_radix(*b as uint, 16u); } - move s + s } while t < 64 { diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 2173efe5ac66f..34a9f6a8588d3 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -178,7 +178,7 @@ impl ReaderUtil for T { let count = self.read(bytes, len); unsafe { vec::raw::set_len(&mut bytes, count); } - move bytes + bytes } fn read_line(&self) -> ~str { @@ -249,7 +249,7 @@ impl ReaderUtil for T { bytes = vec::slice(bytes, offset, bytes.len()); } } - move chars + chars } fn read_char(&self) -> char { @@ -273,7 +273,7 @@ impl ReaderUtil for T { fn read_whole_stream(&self) -> ~[u8] { let mut bytes: ~[u8] = ~[]; while !self.eof() { bytes.push_all(self.read_bytes(2048u)); } - move bytes + bytes } fn each_byte(&self, it: fn(int) -> bool) { @@ -999,7 +999,7 @@ pub struct BytesWriter { impl Writer for BytesWriter { fn write(&self, v: &[const u8]) { do self.bytes.swap |bytes| { - let mut bytes = move bytes; + let mut bytes = bytes; let v_len = v.len(); let bytes_len = bytes.len(); @@ -1014,7 +1014,7 @@ impl Writer for BytesWriter { self.pos += v_len; - move bytes + bytes } } fn seek(&self, offset: int, whence: SeekStyle) { @@ -1035,7 +1035,7 @@ pub pure fn with_bytes_writer(f: fn(Writer)) -> ~[u8] { let wr = @BytesWriter(); f(wr as Writer); // FIXME (#3758): This should not be needed. - unsafe { wr.bytes.check_out(|bytes| move bytes) } + unsafe { wr.bytes.check_out(|bytes| bytes) } } pub pure fn with_str_writer(f: fn(Writer)) -> ~str { @@ -1048,7 +1048,7 @@ pub pure fn with_str_writer(f: fn(Writer)) -> ~str { } assert str::is_utf8(v); - unsafe { move ::cast::transmute(move v) } + unsafe { ::cast::transmute(v) } } // Utility functions @@ -1126,7 +1126,7 @@ pub mod fsync { pub fn Res(arg: Arg) -> Res{ Res { - arg: move arg + arg: arg } } diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index 7c2b5d7ffcd40..9a8f01baed1eb 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -42,7 +42,7 @@ impl iter::ExtendedIter for IMPL_T { } #[inline(always)] pure fn foldl(&self, b0: B, blk: fn(&B, &A) -> B) -> B { - iter::foldl(self, move b0, blk) + iter::foldl(self, b0, blk) } #[inline(always)] pure fn position(&self, f: fn(&A) -> bool) -> Option { diff --git a/src/libcore/iter-trait/dvec.rs b/src/libcore/iter-trait/dvec.rs index af788989e9c0f..986aa18ad4ab1 100644 --- a/src/libcore/iter-trait/dvec.rs +++ b/src/libcore/iter-trait/dvec.rs @@ -25,7 +25,7 @@ mod inst { unsafe { do self.swap |v| { v.each(f); - move v + v } } } diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index a36fa56fc79ba..25cdb11456a06 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -154,11 +154,11 @@ pub pure fn flat_map_to_vec,IB:BaseIter>( pub pure fn foldl>(self: &IA, b0: B, blk: fn(&B, &A) -> B) -> B { - let mut b = move b0; + let mut b = b0; for self.each |a| { b = blk(&b, a); } - move b + b } #[inline(always)] @@ -215,12 +215,12 @@ pub pure fn min>(self: &IA) -> A { match do foldl::,IA>(self, None) |a, b| { match a { &Some(ref a_) if *a_ < *b => { - *(move a) + *(a) } _ => Some(*b) } } { - Some(move val) => val, + Some(val) => val, None => fail!(~"min called on empty iterator") } } @@ -230,12 +230,12 @@ pub pure fn max>(self: &IA) -> A { match do foldl::,IA>(self, None) |a, b| { match a { &Some(ref a_) if *a_ > *b => { - *(move a) + *(a) } _ => Some(*b) } } { - Some(move val) => val, + Some(val) => val, None => fail!(~"max called on empty iterator") } } diff --git a/src/libcore/mutable.rs b/src/libcore/mutable.rs index 49e0d0bdd8a65..1fb855520ba49 100644 --- a/src/libcore/mutable.rs +++ b/src/libcore/mutable.rs @@ -32,15 +32,15 @@ struct Data { pub type Mut = Data; pub fn Mut(t: T) -> Mut { - Data {value: move t, mode: ReadOnly} + Data {value: t, mode: ReadOnly} } pub fn unwrap(m: Mut) -> T { // Borrowck should prevent us from calling unwrap while the value // is in use, as that would be a move from a borrowed value. assert (m.mode as uint) == (ReadOnly as uint); - let Data {value: move value, mode: _} = move m; - move value + let Data {value: value, mode: _} = m; + value } impl Data { diff --git a/src/libcore/option.rs b/src/libcore/option.rs index e57d664c2aaee..a90364c7d8ced 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -33,8 +33,8 @@ match msg { } // Remove the contained string, destroying the Option -let unwrapped_msg = match move msg { - Some(move m) => m, +let unwrapped_msg = match msg { + Some(m) => m, None => ~"default message" }; ~~~ @@ -126,8 +126,8 @@ pub pure fn chain(opt: Option, * function that returns an option. */ - match move opt { - Some(move t) => f(move t), + match opt { + Some(t) => f(t), None => None } } @@ -148,9 +148,9 @@ pub pure fn or(opta: Option, optb: Option) -> Option { /*! * Returns the leftmost Some() value, or None if both are None. */ - match move opta { - Some(move opta) => Some(move opta), - _ => move optb + match opta { + Some(opta) => Some(opta), + _ => optb } } @@ -158,9 +158,9 @@ pub pure fn or(opta: Option, optb: Option) -> Option { pub pure fn while_some(x: Option, blk: fn(v: T) -> Option) { //! Applies a function zero or more times until the result is none. - let mut opt = move x; + let mut opt = x; while opt.is_some() { - opt = blk(unwrap(move opt)); + opt = blk(unwrap(opt)); } } @@ -197,7 +197,7 @@ pub pure fn map_default(opt: &r/Option, def: U, f: fn(&r/T) -> U) -> U { //! Applies a function to the contained value or returns a default - match *opt { None => move def, Some(ref t) => f(t) } + match *opt { None => def, Some(ref t) => f(t) } } #[inline(always)] @@ -224,8 +224,8 @@ pub pure fn unwrap(opt: Option) -> T { Instead, prefer to use pattern matching and handle the `None` case explicitly. */ - match move opt { - Some(move x) => move x, + match opt { + Some(x) => x, None => fail!(~"option::unwrap none") } } @@ -247,8 +247,8 @@ pub fn swap_unwrap(opt: &mut Option) -> T { #[inline(always)] pub pure fn expect(opt: Option, reason: &str) -> T { //! As unwrap, but with a specified failure message. - match move opt { - Some(move val) => val, + match opt { + Some(val) => val, None => fail!(reason.to_owned()), } } @@ -285,7 +285,7 @@ impl Option { /// Applies a function to the contained value or returns a default #[inline(always)] pure fn map_default(&self, def: U, f: fn(&self/T) -> U) -> U { - map_default(self, move def, f) + map_default(self, def, f) } /// As `map_default`, but consumes the option and gives `f` @@ -402,8 +402,8 @@ impl Option { fn test_unwrap_ptr() { let x = ~0; let addr_x = ptr::addr_of(&(*x)); - let opt = Some(move x); - let y = unwrap(move opt); + let opt = Some(x); + let y = unwrap(opt); let addr_y = ptr::addr_of(&(*y)); assert addr_x == addr_y; } @@ -412,8 +412,8 @@ fn test_unwrap_ptr() { fn test_unwrap_str() { let x = ~"test"; let addr_x = str::as_buf(x, |buf, _len| buf); - let opt = Some(move x); - let y = unwrap(move opt); + let opt = Some(x); + let y = unwrap(opt); let addr_y = str::as_buf(y, |buf, _len| buf); assert addr_x == addr_y; } @@ -434,8 +434,8 @@ fn test_unwrap_resource() { let i = @mut 0; { let x = R(i); - let opt = Some(move x); - let _y = unwrap(move opt); + let opt = Some(x); + let _y = unwrap(opt); } assert *i == 1; } diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 91cc20d97f30c..f2401589cd81d 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -171,7 +171,7 @@ pub fn env() -> ~[(~str,~str)] { assert vec::len(vs) == 2u; pairs.push((copy vs[0], copy vs[1])); } - move pairs + pairs } } } @@ -482,7 +482,7 @@ pub fn tmpdir() -> Path { fn getenv_nonempty(v: &str) -> Option { match getenv(v) { - Some(move x) => + Some(x) => if str::is_empty(x) { None } else { @@ -915,7 +915,7 @@ unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] { for uint::range(0, argc as uint) |i| { vec::push(&mut args, str::raw::from_c_str(*argv.offset(i))); } - move args + args } /** @@ -1137,7 +1137,7 @@ mod tests { let rng: rand::Rng = rand::Rng(); let n = ~"TEST" + rng.gen_str(10u); assert getenv(n).is_none(); - move n + n } #[test] @@ -1171,7 +1171,7 @@ mod tests { let n = make_rand_name(); setenv(n, s); log(debug, copy s); - assert getenv(n) == option::Some(move s); + assert getenv(n) == option::Some(s); } #[test] @@ -1197,7 +1197,7 @@ mod tests { // MingW seems to set some funky environment variables like // "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned // from env() but not visible from getenv(). - assert v2.is_none() || v2 == option::Some(move v); + assert v2.is_none() || v2 == option::Some(v); } } @@ -1210,7 +1210,7 @@ mod tests { assert !vec::contains(e, &(copy n, ~"VALUE")); e = env(); - assert vec::contains(e, &(move n, ~"VALUE")); + assert vec::contains(e, &(n, ~"VALUE")); } #[test] diff --git a/src/libcore/path.rs b/src/libcore/path.rs index f196b97e5e53e..531ce95d067be 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -245,7 +245,7 @@ impl Path { let mut st = stat::arch::default_stat(); let r = libc::stat(buf, &mut st); - if r == 0 { Some(move st) } else { None } + if r == 0 { Some(st) } else { None } } } } @@ -257,7 +257,7 @@ impl Path { let mut st = stat::arch::default_stat(); let r = libc::lstat(buf, &mut st); - if r == 0 { Some(move st) } else { None } + if r == 0 { Some(st) } else { None } } } } @@ -381,7 +381,7 @@ impl GenericPath for PosixPath { let mut components = str::split_nonempty(s, |c| c == '/'); let is_absolute = (s.len() != 0 && s[0] == '/' as u8); return PosixPath { is_absolute: is_absolute, - components: move components } + components: components } } pure fn dirname() -> ~str { @@ -390,7 +390,7 @@ impl GenericPath for PosixPath { if s.len() == 0 { ~"." } else { - move s + s } } } @@ -430,7 +430,7 @@ impl GenericPath for PosixPath { let dpath = PosixPath(d); match self.filename() { Some(ref f) => dpath.push(*f), - None => move dpath + None => dpath } } @@ -477,7 +477,7 @@ impl GenericPath for PosixPath { Some(ref f) => ~[copy *f] }; return PosixPath { is_absolute: false, - components: move cs } + components: cs } } pure fn push_rel(other: &PosixPath) -> PosixPath { @@ -491,17 +491,17 @@ impl GenericPath for PosixPath { let mut ss = str::split_nonempty( *e, |c| windows::is_sep(c as u8)); - unsafe { v.push_all_move(move ss); } + unsafe { v.push_all_move(ss); } } PosixPath { is_absolute: self.is_absolute, - components: move v } + components: v } } pure fn push(s: &str) -> PosixPath { let mut v = copy self.components; let mut ss = str::split_nonempty(s, |c| windows::is_sep(c as u8)); - unsafe { v.push_all_move(move ss); } - PosixPath { components: move v, ..copy self } + unsafe { v.push_all_move(ss); } + PosixPath { components: v, ..copy self } } pure fn pop() -> PosixPath { @@ -511,7 +511,7 @@ impl GenericPath for PosixPath { } return PosixPath { is_absolute: self.is_absolute, - components: move cs + components: cs } //..self } } @@ -577,10 +577,10 @@ impl GenericPath for WindowsPath { let mut components = str::split_nonempty(rest, |c| windows::is_sep(c as u8)); let is_absolute = (rest.len() != 0 && windows::is_sep(rest[0])); - return WindowsPath { host: move host, - device: move device, + return WindowsPath { host: host, + device: device, is_absolute: is_absolute, - components: move components } + components: components } } pure fn dirname() -> ~str { @@ -589,7 +589,7 @@ impl GenericPath for WindowsPath { if s.len() == 0 { ~"." } else { - move s + s } } } @@ -629,7 +629,7 @@ impl GenericPath for WindowsPath { let dpath = WindowsPath(d); match self.filename() { Some(ref f) => dpath.push(*f), - None => move dpath + None => dpath } } @@ -677,7 +677,7 @@ impl GenericPath for WindowsPath { return WindowsPath { host: None, device: None, is_absolute: false, - components: move cs } + components: cs } } pure fn push_rel(other: &WindowsPath) -> WindowsPath { @@ -691,22 +691,22 @@ impl GenericPath for WindowsPath { let mut ss = str::split_nonempty( *e, |c| windows::is_sep(c as u8)); - unsafe { v.push_all_move(move ss); } + unsafe { v.push_all_move(ss); } } // tedious, but as-is, we can't use ..self return WindowsPath { host: copy self.host, device: copy self.device, is_absolute: self.is_absolute, - components: move v + components: v } } pure fn push(s: &str) -> WindowsPath { let mut v = copy self.components; let mut ss = str::split_nonempty(s, |c| windows::is_sep(c as u8)); - unsafe { v.push_all_move(move ss); } - return WindowsPath { components: move v, ..copy self } + unsafe { v.push_all_move(ss); } + return WindowsPath { components: v, ..copy self } } pure fn pop() -> WindowsPath { @@ -718,7 +718,7 @@ impl GenericPath for WindowsPath { host: copy self.host, device: copy self.device, is_absolute: self.is_absolute, - components: move cs + components: cs } } @@ -748,7 +748,7 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] { } } } - move cs + cs } // Various windows helpers, and tests for the impl. @@ -771,7 +771,7 @@ pub mod windows { if s[i] == '\\' as u8 { let pre = s.slice(2, i); let rest = s.slice(i, s.len()); - return Some((move pre, move rest)); + return Some((pre, rest)); } i += 1; } @@ -789,7 +789,7 @@ pub mod windows { } else { s.slice(2, s.len()) }; - return Some((s.slice(0,1), move rest)); + return Some((s.slice(0,1), rest)); } None } diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index a26a6b5f8ec3d..b9e07135f2c9b 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -101,7 +101,7 @@ use vec; const SPIN_COUNT: uint = 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 } ) ) #[doc(hidden)] @@ -233,7 +233,7 @@ fn unibuffer() -> ~Buffer> { unsafe { b.data.header.buffer = reinterpret_cast(&b); } - move b + b } #[doc(hidden)] @@ -241,7 +241,7 @@ pub fn packet() -> *Packet { let b = unibuffer(); let p = ptr::addr_of(&(b.data)); // We'll take over memory management from here. - unsafe { forget(move b) } + unsafe { forget(b) } p } @@ -252,7 +252,7 @@ pub fn entangle_buffer( -> (SendPacketBuffered, RecvPacketBuffered) { let p = init(unsafe { reinterpret_cast(&buffer) }, &buffer.data); - unsafe { forget(move buffer) } + unsafe { forget(buffer) } (SendPacketBuffered(p), RecvPacketBuffered(p)) } @@ -295,7 +295,7 @@ pub fn swap_task(dst: &mut *rust_task, src: *rust_task) -> *rust_task { // It might be worth making both acquire and release versions of // this. unsafe { - transmute(rusti::atomic_xchg(transmute(move dst), src as int)) + transmute(rusti::atomic_xchg(transmute(dst), src as int)) } } @@ -335,14 +335,14 @@ fn wait_event(this: *rust_task) -> *libc::c_void { #[doc(hidden)] 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)) } } #[doc(hidden)] 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)) } } @@ -368,7 +368,7 @@ struct BufferResource { // go go gadget drop glue } else { - forget(move b) + forget(b) } } } @@ -381,7 +381,7 @@ fn BufferResource(b: ~Buffer) -> BufferResource { BufferResource { // tjc: ???? - buffer: move b + buffer: b } } @@ -392,7 +392,7 @@ pub fn send(p: SendPacketBuffered, payload: T) -> bool { let p = unsafe { &*p_ }; assert ptr::addr_of(&(p.header)) == header; assert p.payload.is_none(); - p.payload = move Some(move payload); + p.payload = Some(payload); let old_state = swap_state_rel(&mut p.header.state, Full); match old_state { Empty => { @@ -434,7 +434,7 @@ Fails if the sender closes the connection. */ pub fn recv( p: RecvPacketBuffered) -> T { - try_recv(move p).expect("connection closed") + try_recv(p).expect("connection closed") } /** Attempts to receive a message from a pipe. @@ -474,7 +474,7 @@ pub fn try_recv(p: RecvPacketBuffered) let mut payload = None; payload <-> p.payload; p.header.state = Empty; - return Some(option::unwrap(move payload)) + return Some(option::unwrap(payload)) }, Terminated => return None, _ => {} @@ -532,7 +532,7 @@ pub fn try_recv(p: RecvPacketBuffered) } } p.header.state = Empty; - return Some(option::unwrap(move payload)) + return Some(option::unwrap(payload)) } Terminated => { // This assert detects when we've accidentally unsafely @@ -723,8 +723,8 @@ pub fn select2( let i = wait_many([a.header(), b.header()]); match i { - 0 => Left((try_recv(move a), move b)), - 1 => Right((move a, try_recv(move b))), + 0 => Left((try_recv(a), b)), + 1 => Right((a, try_recv(b))), _ => fail!(~"select2 return an invalid packet") } } @@ -761,10 +761,10 @@ pub fn select(endpoints: ~[RecvPacketBuffered]) -> (uint, Option, ~[RecvPacketBuffered]) { let ready = wait_many(endpoints.map(|p| p.header())); - let mut remaining = move endpoints; + let mut remaining = endpoints; let port = remaining.swap_remove(ready); - let result = try_recv(move port); - (ready, move result, move remaining) + let result = try_recv(port); + (ready, result, remaining) } /** The sending end of a pipe. It can be used to send exactly one @@ -791,7 +791,7 @@ impl ::ops::Drop for SendPacketBuffered { if self.p != None { let mut p = None; p <-> self.p; - sender_terminate(option::unwrap(move p)) + sender_terminate(option::unwrap(p)) } //unsafe { error!("send_drop: %?", // if self.buffer == none { @@ -816,7 +816,7 @@ impl SendPacketBuffered { fn unwrap() -> *Packet { let mut p = None; p <-> self.p; - option::unwrap(move p) + option::unwrap(p) } pure fn header() -> *PacketHeader { @@ -835,7 +835,7 @@ impl SendPacketBuffered { //error!("send reuse_buffer"); let mut tmp = None; tmp <-> self.buffer; - option::unwrap(move tmp) + option::unwrap(tmp) } } @@ -860,7 +860,7 @@ impl ::ops::Drop for RecvPacketBuffered { if self.p != None { let mut p = None; p <-> self.p; - receiver_terminate(option::unwrap(move p)) + receiver_terminate(option::unwrap(p)) } //unsafe { error!("recv_drop: %?", // if self.buffer == none { @@ -873,14 +873,14 @@ impl RecvPacketBuffered { fn unwrap() -> *Packet { let mut p = None; p <-> self.p; - option::unwrap(move p) + option::unwrap(p) } fn reuse_buffer() -> BufferResource { //error!("recv reuse_buffer"); let mut tmp = None; tmp <-> self.buffer; - option::unwrap(move tmp) + option::unwrap(tmp) } } @@ -933,14 +933,14 @@ pub fn spawn_service( // This is some nasty gymnastics required to safely move the pipe // into a new task. - let server = ~mut Some(move server); - do task::spawn |move service, move server| { + let server = ~mut Some(server); + do task::spawn || { let mut server_ = None; server_ <-> *server; - service(option::unwrap(move server_)) + service(option::unwrap(server_)) } - move client + client } /** Like `spawn_service_recv`, but for protocols that start in the @@ -957,14 +957,14 @@ pub fn spawn_service_recv( // This is some nasty gymnastics required to safely move the pipe // into a new task. - let server = ~mut Some(move server); - do task::spawn |move service, move server| { + let server = ~mut Some(server); + do task::spawn || { let mut server_ = None; server_ <-> *server; - service(option::unwrap(move server_)) + service(option::unwrap(server_)) } - move client + client } // Streams - Make pipes a little easier in general. @@ -1041,7 +1041,7 @@ impl GenericChan for Chan { let mut endp = None; endp <-> self.endp; self.endp = Some( - streamp::client::data(unwrap(move endp), move x)) + streamp::client::data(unwrap(endp), x)) } } @@ -1050,9 +1050,9 @@ impl GenericSmartChan for Chan { fn try_send(x: T) -> bool { let mut endp = None; endp <-> self.endp; - match move streamp::client::try_data(unwrap(move endp), move x) { - Some(move next) => { - self.endp = Some(move next); + match streamp::client::try_data(unwrap(endp), x) { + Some(next) => { + self.endp = Some(next); true } None => false @@ -1064,18 +1064,18 @@ impl GenericPort for Port { fn recv() -> T { let mut endp = None; endp <-> self.endp; - let streamp::data(x, endp) = pipes::recv(unwrap(move endp)); - self.endp = Some(move endp); - move x + let streamp::data(x, endp) = pipes::recv(unwrap(endp)); + self.endp = Some(endp); + x } fn try_recv() -> Option { let mut endp = None; endp <-> self.endp; - match move pipes::try_recv(unwrap(move endp)) { - Some(streamp::data(move x, move endp)) => { - self.endp = Some(move endp); - Some(move x) + match pipes::try_recv(unwrap(endp)) { + Some(streamp::data(x, endp)) => { + self.endp = Some(endp); + Some(x) } None => None } @@ -1122,13 +1122,13 @@ pub fn PortSet() -> PortSet{ impl PortSet { fn add(port: pipes::Port) { - self.ports.push(move port) + self.ports.push(port) } fn chan() -> Chan { let (po, ch) = stream(); - self.add(move po); - move ch + self.add(po); + ch } } @@ -1142,9 +1142,9 @@ impl GenericPort for PortSet { ports <-> self.ports; while result.is_none() && ports.len() > 0 { let i = wait_many(ports); - match move ports[i].try_recv() { - Some(move m) => { - result = Some(move m); + match ports[i].try_recv() { + Some(m) => { + result = Some(m); } None => { // Remove this port. @@ -1153,7 +1153,7 @@ impl GenericPort for PortSet { } } ports <-> self.ports; - move result + result } fn recv() -> T { @@ -1178,29 +1178,29 @@ pub type SharedChan = private::Exclusive>; impl GenericChan for SharedChan { fn send(x: T) { - let mut xx = Some(move x); + let mut xx = Some(x); do self.with_imm |chan| { let mut x = None; x <-> xx; - chan.send(option::unwrap(move x)) + chan.send(option::unwrap(x)) } } } impl GenericSmartChan for SharedChan { fn try_send(x: T) -> bool { - let mut xx = Some(move x); + let mut xx = Some(x); do self.with_imm |chan| { let mut x = None; x <-> xx; - chan.try_send(option::unwrap(move x)) + chan.try_send(option::unwrap(x)) } } } /// Converts a `chan` into a `shared_chan`. pub fn SharedChan(c: Chan) -> SharedChan { - private::exclusive(move c) + private::exclusive(c) } /// Receive a message from one of two endpoints. @@ -1267,24 +1267,24 @@ impl ChanOne { * closed. */ pub fn recv_one(port: PortOne) -> T { - let oneshot::send(message) = recv(move port); - move message + let oneshot::send(message) = recv(port); + message } /// Receive a message from a oneshot pipe unless the connection was closed. pub fn try_recv_one (port: PortOne) -> Option { - let message = try_recv(move port); + let message = try_recv(port); if message.is_none() { None } else { - let oneshot::send(message) = option::unwrap(move message); - Some(move message) + let oneshot::send(message) = option::unwrap(message); + Some(message) } } /// Send a message on a oneshot pipe, failing if the connection was closed. pub fn send_one(chan: ChanOne, data: T) { - oneshot::client::send(move chan, move data); + oneshot::client::send(chan, data); } /** @@ -1293,7 +1293,7 @@ pub fn send_one(chan: ChanOne, data: T) { */ pub fn try_send_one(chan: ChanOne, data: T) -> bool { - oneshot::client::try_send(move chan, move data).is_some() + oneshot::client::try_send(chan, data).is_some() } pub mod rt { @@ -1301,7 +1301,7 @@ pub mod rt { // These are used to hide the option constructors from the // compiler because their names are changing - pub fn make_some(val: T) -> Option { Some(move val) } + pub fn make_some(val: T) -> Option { Some(val) } pub fn make_none() -> Option { None } } @@ -1318,7 +1318,7 @@ pub mod test { c1.send(~"abc"); - match (move p1, move p2).select() { + match (p1, p2).select() { Right(_) => fail!(), _ => () } @@ -1330,9 +1330,9 @@ pub mod test { pub fn test_oneshot() { let (c, p) = oneshot::init(); - oneshot::client::send(move c, ()); + oneshot::client::send(c, ()); - recv_one(move p) + recv_one(p) } #[test] @@ -1341,7 +1341,7 @@ pub mod test { { // Destroy the channel - let _chan = move chan; + let _chan = chan; } assert !port.peek(); diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 9df31bbd81f2c..5b69c348c1591 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -145,11 +145,11 @@ struct ArcDestruct { cast::reinterpret_cast(&data.unwrapper); let (message, response) = option::swap_unwrap(p); // Send 'ready' and wait for a response. - pipes::send_one(move message, ()); + pipes::send_one(message, ()); // Unkillable wait. Message guaranteed to come. - if pipes::recv_one(move response) { + if pipes::recv_one(response) { // Other task got the data. - cast::forget(move data); + cast::forget(data); } else { // Other task was killed. drop glue takes over. } @@ -157,7 +157,7 @@ struct ArcDestruct { // drop glue takes over. } } else { - cast::forget(move data); + cast::forget(data); } } } @@ -182,13 +182,13 @@ pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) // tried to wake us whether they should hand-off the data to // us. if task::failing() { - pipes::send_one(move response, false); + pipes::send_one(response, false); // Either this swap_unwrap or the one below (at "Got // here") ought to run. cast::forget(option::swap_unwrap(&mut self.ptr)); } else { assert self.ptr.is_none(); - pipes::send_one(move response, true); + pipes::send_one(response, true); } } } @@ -198,8 +198,8 @@ pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) let ptr: ~ArcData = cast::reinterpret_cast(&rc.data); let (p1,c1) = pipes::oneshot(); // () let (p2,c2) = pipes::oneshot(); // bool - let server: UnwrapProto = ~mut Some((move c1,move p2)); - let serverp: int = cast::transmute(move server); + let server: UnwrapProto = ~mut Some((c1,p2)); + let serverp: int = cast::transmute(server); // Try to put our server end in the unwrapper slot. if compare_and_swap(&mut ptr.unwrapper, 0, serverp) { // Got in. Step 0: Tell destructor not to run. We are now it. @@ -210,15 +210,15 @@ pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) if new_count == 0 { // We were the last owner. Can unwrap immediately. // Also we have to free the server endpoints. - let _server: UnwrapProto = cast::transmute(move serverp); + let _server: UnwrapProto = cast::transmute(serverp); option::swap_unwrap(&mut ptr.data) // drop glue takes over. } else { // The *next* person who sees the refcount hit 0 will wake us. let end_result = - DeathThroes { ptr: Some(move ptr), - response: Some(move c2) }; - let mut p1 = Some(move p1); // argh + DeathThroes { ptr: Some(ptr), + response: Some(c2) }; + let mut p1 = Some(p1); // argh do task::rekillable { pipes::recv_one(option::swap_unwrap(&mut p1)); } @@ -230,9 +230,9 @@ pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) } } else { // Somebody else was trying to unwrap. Avoid guaranteed deadlock. - cast::forget(move ptr); + cast::forget(ptr); // Also we have to free the (rejected) server endpoints. - let _server: UnwrapProto = cast::transmute(move serverp); + let _server: UnwrapProto = cast::transmute(serverp); fail!(~"Another task is already unwrapping this ARC!"); } } @@ -248,9 +248,9 @@ pub type SharedMutableState = ArcDestruct; pub unsafe fn shared_mutable_state(data: T) -> SharedMutableState { - let data = ~ArcData { count: 1, unwrapper: 0, data: Some(move data) }; + let data = ~ArcData { count: 1, unwrapper: 0, data: Some(data) }; unsafe { - let ptr = cast::transmute(move data); + let ptr = cast::transmute(data); ArcDestruct(ptr) } } @@ -263,7 +263,7 @@ pub unsafe fn get_shared_mutable_state( let ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); assert ptr.count > 0; let r = cast::transmute(option::get_ref(&ptr.data)); - cast::forget(move ptr); + cast::forget(ptr); return r; } } @@ -275,7 +275,7 @@ pub unsafe fn get_shared_immutable_state( assert ptr.count > 0; // Cast us back into the correct region let r = cast::transmute_region(option::get_ref(&ptr.data)); - cast::forget(move ptr); + cast::forget(ptr); return r; } } @@ -286,7 +286,7 @@ pub unsafe fn clone_shared_mutable_state(rc: &SharedMutableState) let ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); let new_count = rusti::atomic_xadd(&mut ptr.count, 1) + 1; assert new_count >= 2; - cast::forget(move ptr); + cast::forget(ptr); } ArcDestruct((*rc).data) } @@ -355,9 +355,9 @@ pub struct Exclusive { x: SharedMutableState> } pub fn exclusive(user_data: T) -> Exclusive { let data = ExData { - lock: LittleLock(), mut failed: false, mut data: move user_data + lock: LittleLock(), mut failed: false, mut data: user_data }; - Exclusive { x: unsafe { shared_mutable_state(move data) } } + Exclusive { x: unsafe { shared_mutable_state(data) } } } impl Clone for Exclusive { @@ -386,7 +386,7 @@ impl Exclusive { (*rec).failed = true; let result = f(&mut (*rec).data); (*rec).failed = false; - move result + result } } } @@ -401,10 +401,10 @@ impl Exclusive { // FIXME(#3724) make this a by-move method on the exclusive pub fn unwrap_exclusive(arc: Exclusive) -> T { - let Exclusive { x: x } = move arc; - let inner = unsafe { unwrap_shared_mutable_state(move x) }; - let ExData { data: data, _ } = move inner; - move data + let Exclusive { x: x } = arc; + let inner = unsafe { unwrap_shared_mutable_state(x) }; + let ExData { data: data, _ } = inner; + data } #[cfg(test)] @@ -430,9 +430,9 @@ pub mod tests { for uint::range(0, num_tasks) |_i| { let total = total.clone(); let (port, chan) = pipes::stream(); - futures.push(move port); + futures.push(port); - do task::spawn |move total, move chan| { + do task::spawn || { for uint::range(0, count) |_i| { do total.with |count| { **count += 1; @@ -455,7 +455,7 @@ pub mod tests { // accesses will also fail. let x = exclusive(1); let x2 = x.clone(); - do task::try |move x2| { + do task::try || { do x2.with |one| { assert *one == 2; } @@ -468,31 +468,31 @@ pub mod tests { #[test] pub fn exclusive_unwrap_basic() { let x = exclusive(~~"hello"); - assert unwrap_exclusive(move x) == ~~"hello"; + assert unwrap_exclusive(x) == ~~"hello"; } #[test] pub fn exclusive_unwrap_contended() { let x = exclusive(~~"hello"); let x2 = ~mut Some(x.clone()); - do task::spawn |move x2| { + do task::spawn || { let x2 = option::swap_unwrap(x2); do x2.with |_hello| { } task::yield(); } - assert unwrap_exclusive(move x) == ~~"hello"; + assert unwrap_exclusive(x) == ~~"hello"; // Now try the same thing, but with the child task blocking. let x = exclusive(~~"hello"); let x2 = ~mut Some(x.clone()); let mut res = None; - do task::task().future_result(|+r| res = Some(move r)).spawn - |move x2| { + do task::task().future_result(|+r| res = Some(r)).spawn + || { let x2 = option::swap_unwrap(x2); - assert unwrap_exclusive(move x2) == ~~"hello"; + assert unwrap_exclusive(x2) == ~~"hello"; } // Have to get rid of our reference before blocking. - { let _x = move x; } // FIXME(#3161) util::ignore doesn't work here + { let _x = x; } // FIXME(#3161) util::ignore doesn't work here let res = option::swap_unwrap(&mut res); res.recv(); } @@ -502,12 +502,12 @@ pub mod tests { let x = exclusive(~~"hello"); let x2 = ~mut Some(x.clone()); let mut res = None; - do task::task().future_result(|+r| res = Some(move r)).spawn - |move x2| { + do task::task().future_result(|+r| res = Some(r)).spawn + || { let x2 = option::swap_unwrap(x2); - assert unwrap_exclusive(move x2) == ~~"hello"; + assert unwrap_exclusive(x2) == ~~"hello"; } - assert unwrap_exclusive(move x) == ~~"hello"; + assert unwrap_exclusive(x) == ~~"hello"; let res = option::swap_unwrap(&mut res); res.recv(); } @@ -526,7 +526,7 @@ pub mod tests { for 10.times { task::yield(); } // try to let the unwrapper go fail!(); // punt it awake from its deadlock } - let _z = unwrap_exclusive(move x); + let _z = unwrap_exclusive(x); do x2.with |_hello| { } }; assert result.is_err(); diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 47a0e11941cb0..cc747521030c9 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -273,7 +273,7 @@ impl Rng { s = s + str::from_char(self.gen_char_from(charset)); i += 1u; } - move s + s } /// Return a random byte string of the specified length @@ -339,14 +339,14 @@ impl Rng { r.push(item.item); } } - move r + r } /// Shuffle a vec fn shuffle(values: &[T]) -> ~[T] { let mut m = vec::from_slice(values); self.shuffle_mut(m); - move m + m } /// Shuffle a mutable vec in place diff --git a/src/libcore/reflect.rs b/src/libcore/reflect.rs index eb407cf1128e9..8983c63f42a1f 100644 --- a/src/libcore/reflect.rs +++ b/src/libcore/reflect.rs @@ -42,7 +42,7 @@ pub struct MovePtrAdaptor { inner: V } pub fn MovePtrAdaptor(v: V) -> MovePtrAdaptor { - MovePtrAdaptor { inner: move v } + MovePtrAdaptor { inner: v } } impl MovePtrAdaptor { diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index c2266f4fdb042..7f1687b08608a 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -200,8 +200,8 @@ impl ReprVisitor { fn visit_ptr_inner(ptr: *c_void, inner: *TyDesc) -> bool { unsafe { let mut u = ReprVisitor(ptr, self.writer); - let v = reflect::MovePtrAdaptor(move u); - visit_tydesc(inner, (move v) as @TyVisitor); + let v = reflect::MovePtrAdaptor(u); + visit_tydesc(inner, (v) as @TyVisitor); true } } @@ -569,8 +569,8 @@ pub fn write_repr(writer: @Writer, object: &T) { let ptr = ptr::to_unsafe_ptr(object) as *c_void; let tydesc = intrinsic::get_tydesc::(); let mut u = ReprVisitor(ptr, writer); - let v = reflect::MovePtrAdaptor(move u); - visit_tydesc(tydesc, (move v) as @TyVisitor) + let v = reflect::MovePtrAdaptor(u); + visit_tydesc(tydesc, (v) as @TyVisitor) } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index fb824087f2199..64c62c925849f 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -125,9 +125,9 @@ pub pure fn to_either(res: &Result) #[inline(always)] pub pure fn chain(res: Result, op: fn(T) -> Result) -> Result { - match move res { - Ok(move t) => op(move t), - Err(move e) => Err(move e) + match res { + Ok(t) => op(t), + Err(e) => Err(e) } } @@ -144,9 +144,9 @@ pub pure fn chain_err( res: Result, op: fn(t: V) -> Result) -> Result { - match move res { - Ok(move t) => Ok(move t), - Err(move v) => op(move v) + match res { + Ok(t) => Ok(t), + Err(v) => op(v) } } @@ -309,7 +309,7 @@ pub fn map_vec( Err(copy u) => return Err(u) } } - return Ok(move vs); + return Ok(vs); } #[inline(always)] @@ -349,7 +349,7 @@ pub fn map_vec2(ss: &[S], ts: &[T], } i += 1u; } - return Ok(move vs); + return Ok(vs); } /** @@ -377,8 +377,8 @@ pub fn iter_vec2(ss: &[S], ts: &[T], /// Unwraps a result, assuming it is an `ok(T)` #[inline(always)] pub pure fn unwrap(res: Result) -> T { - match move res { - Ok(move t) => move t, + match res { + Ok(t) => t, Err(_) => fail!(~"unwrap called on an err result") } } @@ -386,8 +386,8 @@ pub pure fn unwrap(res: Result) -> T { /// Unwraps a result, assuming it is an `err(U)` #[inline(always)] pub pure fn unwrap_err(res: Result) -> U { - match move res { - Err(move u) => move u, + match res { + Err(u) => u, Ok(_) => fail!(~"unwrap called on an ok result") } } diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 7a597aa9c75c7..5103025d12051 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -258,7 +258,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program { fn ProgRes(r: ProgRepr) -> ProgRes { ProgRes { - r: move r + r: r } } @@ -344,11 +344,11 @@ pub fn program_output(prog: &str, args: &[~str]) -> ProgramOutput { let ch_clone = ch.clone(); do task::spawn_sched(task::SingleThreaded) { let errput = readclose(pipe_err.in); - ch.send((2, move errput)); + ch.send((2, errput)); }; do task::spawn_sched(task::SingleThreaded) { let output = readclose(pipe_out.in); - ch_clone.send((1, move output)); + ch_clone.send((1, output)); }; let status = run::waitpid(pid); let mut errs = ~""; @@ -358,10 +358,10 @@ pub fn program_output(prog: &str, args: &[~str]) -> ProgramOutput { let stream = p.recv(); match stream { (1, copy s) => { - outs = move s; + outs = s; } (2, copy s) => { - errs = move s; + errs = s; } (n, _) => { fail!(fmt!("program_output received an unexpected file \ @@ -371,8 +371,8 @@ pub fn program_output(prog: &str, args: &[~str]) -> ProgramOutput { count -= 1; }; return ProgramOutput {status: status, - out: move outs, - err: move errs}; + out: outs, + err: errs}; } } diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 1571e64511784..afc9d7f1417e4 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -216,7 +216,7 @@ pub mod tests { assert f(20) == 30; - let original_closure: Closure = cast::transmute(move f); + let original_closure: Closure = cast::transmute(f); let actual_function_pointer = original_closure.code; let environment = original_closure.env; @@ -226,7 +226,7 @@ pub mod tests { env: environment }; - let new_f: fn(int) -> int = cast::transmute(move new_closure); + let new_f: fn(int) -> int = cast::transmute(new_closure); assert new_f(20) == 30; } } diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index 35bbc0347ee11..949c36545dd03 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -73,7 +73,7 @@ unsafe fn get_task_local_map(task: *rust_task) -> TaskLocalMap { cast::bump_box_refcount(map); map } else { - let map = cast::transmute(move map_ptr); + let map = cast::transmute(map_ptr); cast::bump_box_refcount(map); map } @@ -119,7 +119,7 @@ unsafe fn local_get_helper( // overwriting the local_data_box we need to give an extra reference. // We must also give an extra reference when not removing. let (index, data_ptr) = *result; - let data: @T = cast::transmute(move data_ptr); + let data: @T = cast::transmute(data_ptr); cast::bump_box_refcount(data); if do_pop { (*map).set_elt(index, None); @@ -182,6 +182,6 @@ pub unsafe fn local_modify( // Could be more efficient by doing the lookup work, but this is easy. let newdata = modify_fn(local_pop(task, key)); if newdata.is_some() { - local_set(task, key, option::unwrap(move newdata)); + local_set(task, key, option::unwrap(newdata)); } } diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 09c558e3be599..4b15d1f76c98a 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -203,7 +203,7 @@ pub struct TaskBuilder { pub fn task() -> TaskBuilder { TaskBuilder { opts: default_task_opts(), - gen_body: |body| move body, // Identity function + gen_body: |body| body, // Identity function can_not_copy: None, mut consumed: false, } @@ -315,7 +315,7 @@ impl TaskBuilder { // Construct the future and give it to the caller. let (notify_pipe_po, notify_pipe_ch) = stream::(); - blk(move notify_pipe_po); + blk(notify_pipe_po); // Reconfigure self to use a notify channel. TaskBuilder { @@ -336,7 +336,7 @@ impl TaskBuilder { opts: TaskOpts { linked: self.opts.linked, supervised: self.opts.supervised, - notify_chan: move notify_chan, + notify_chan: notify_chan, sched: SchedOpts { mode: mode, foreign_stack_size: None} }, can_not_copy: None, @@ -366,11 +366,7 @@ impl TaskBuilder { notify_chan: notify_chan, sched: self.opts.sched }, - // tjc: I think this is the line that gets miscompiled - // w/ last-use off, if we leave out the move prev_gen_body? - // that makes no sense, though... - gen_body: |move prev_gen_body, - body| { wrapper(prev_gen_body(move body)) }, + gen_body: |body| { wrapper(prev_gen_body(body)) }, can_not_copy: None, .. self.consume() } @@ -397,12 +393,12 @@ impl TaskBuilder { notify_chan: notify_chan, sched: x.opts.sched }; - spawn::spawn_raw(move opts, (x.gen_body)(move f)); + spawn::spawn_raw(opts, (x.gen_body)(f)); } /// Runs a task, while transfering ownership of one argument to the child. fn spawn_with(arg: A, f: fn~(v: A)) { - let arg = ~mut Some(move arg); - do self.spawn |move arg, move f| { + let arg = ~mut Some(arg); + do self.spawn || { f(option::swap_unwrap(arg)) } } @@ -425,12 +421,12 @@ impl TaskBuilder { let mut result = None; let fr_task_builder = self.future_result(|+r| { - result = Some(move r); + result = Some(r); }); - do fr_task_builder.spawn |move f, move ch| { + do fr_task_builder.spawn || { ch.send(f()); } - match option::unwrap(move result).recv() { + match option::unwrap(result).recv() { Success => result::Ok(po.recv()), Failure => result::Err(()) } @@ -471,7 +467,7 @@ pub fn spawn(f: fn~()) { * This function is equivalent to `task().spawn(f)`. */ - task().spawn(move f) + task().spawn(f) } pub fn spawn_unlinked(f: fn~()) { @@ -480,7 +476,7 @@ pub fn spawn_unlinked(f: fn~()) { * task or the child task fails, the other will not be killed. */ - task().unlinked().spawn(move f) + task().unlinked().spawn(f) } pub fn spawn_supervised(f: fn~()) { @@ -489,7 +485,7 @@ pub fn spawn_supervised(f: fn~()) { * task or the child task fails, the other will not be killed. */ - task().supervised().spawn(move f) + task().supervised().spawn(f) } pub fn spawn_with(arg: A, f: fn~(v: A)) { @@ -503,7 +499,7 @@ pub fn spawn_with(arg: A, f: fn~(v: A)) { * This function is equivalent to `task().spawn_with(arg, f)`. */ - task().spawn_with(move arg, move f) + task().spawn_with(arg, f) } pub fn spawn_sched(mode: SchedMode, f: fn~()) { @@ -519,7 +515,7 @@ pub fn spawn_sched(mode: SchedMode, f: fn~()) { * greater than zero. */ - task().sched_mode(mode).spawn(move f) + task().sched_mode(mode).spawn(f) } pub fn try(f: fn~() -> T) -> Result { @@ -530,7 +526,7 @@ pub fn try(f: fn~() -> T) -> Result { * This is equivalent to task().supervised().try. */ - task().supervised().try(move f) + task().supervised().try(f) } @@ -719,12 +715,12 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails let mut opts = default_task_opts(); opts.linked = true; opts.supervised = true; - move opts + opts }; let b0 = task(); let b1 = TaskBuilder { - opts: move opts, + opts: opts, can_not_copy: None, .. b0 }; @@ -739,12 +735,12 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails let mut opts = default_task_opts(); opts.linked = true; opts.supervised = true; - move opts + opts }; let b0 = task(); let b1 = TaskBuilder { - opts: move opts, + opts: opts, can_not_copy: None, .. b0 }; @@ -843,7 +839,7 @@ fn test_add_wrapper() { let ch = Wrapper { f: Some(ch) }; let b1 = do b0.add_wrapper |body| { let ch = Wrapper { f: Some(ch.f.swap_unwrap()) }; - fn~(move body) { + fn~() { let ch = ch.f.swap_unwrap(); body(); ch.send(()); @@ -857,15 +853,15 @@ fn test_add_wrapper() { #[ignore(cfg(windows))] fn test_future_result() { let mut result = None; - do task().future_result(|+r| { result = Some(move r); }).spawn { } - assert option::unwrap(move result).recv() == Success; + do task().future_result(|+r| { result = Some(r); }).spawn { } + assert option::unwrap(result).recv() == Success; result = None; do task().future_result(|+r| - { result = Some(move r); }).unlinked().spawn { + { result = Some(r); }).unlinked().spawn { fail!(); } - assert option::unwrap(move result).recv() == Failure; + assert option::unwrap(result).recv() == Failure; } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -1024,7 +1020,7 @@ fn avoid_copying_the_body(spawnfn: fn(v: fn~())) { let x = ~1; let x_in_parent = ptr::addr_of(&(*x)) as uint; - do spawnfn |move x| { + do spawnfn || { let x_in_child = ptr::addr_of(&(*x)) as uint; ch.send(x_in_child); } @@ -1041,7 +1037,7 @@ fn test_avoid_copying_the_body_spawn() { #[test] fn test_avoid_copying_the_body_task_spawn() { do avoid_copying_the_body |f| { - do task().spawn |move f| { + do task().spawn || { f(); } } @@ -1050,7 +1046,7 @@ fn test_avoid_copying_the_body_task_spawn() { #[test] fn test_avoid_copying_the_body_try() { do avoid_copying_the_body |f| { - do try |move f| { + do try || { f() }; } @@ -1059,7 +1055,7 @@ fn test_avoid_copying_the_body_try() { #[test] fn test_avoid_copying_the_body_unlinked() { do avoid_copying_the_body |f| { - do spawn_unlinked |move f| { + do spawn_unlinked || { f(); } } @@ -1096,12 +1092,12 @@ fn test_unkillable() { unsafe { do unkillable { let p = ~0; - let pp: *uint = cast::transmute(move p); + let pp: *uint = cast::transmute(p); // If we are killed here then the box will leak po.recv(); - let _p: ~int = cast::transmute(move pp); + let _p: ~int = cast::transmute(pp); } } @@ -1116,7 +1112,7 @@ fn test_unkillable_nested() { let (po, ch) = pipes::stream(); // We want to do this after failing - do spawn_unlinked |move ch| { + do spawn_unlinked || { for iter::repeat(10) { yield() } ch.send(()); } @@ -1132,12 +1128,12 @@ fn test_unkillable_nested() { do unkillable { do unkillable {} // Here's the difference from the previous test. let p = ~0; - let pp: *uint = cast::transmute(move p); + let pp: *uint = cast::transmute(p); // If we are killed here then the box will leak po.recv(); - let _p: ~int = cast::transmute(move pp); + let _p: ~int = cast::transmute(pp); } } @@ -1181,7 +1177,7 @@ fn test_child_doesnt_ref_parent() { fn test_sched_thread_per_core() { let (port, chan) = pipes::stream(); - do spawn_sched(ThreadPerCore) |move chan| { + do spawn_sched(ThreadPerCore) || { unsafe { let cores = rt::rust_num_threads(); let reported_threads = rt::rust_sched_threads(); @@ -1197,7 +1193,7 @@ fn test_sched_thread_per_core() { fn test_spawn_thread_on_demand() { let (port, chan) = pipes::stream(); - do spawn_sched(ManualThreads(2)) |move chan| { + do spawn_sched(ManualThreads(2)) || { unsafe { let max_threads = rt::rust_sched_threads(); assert(max_threads as int == 2); @@ -1206,7 +1202,7 @@ fn test_spawn_thread_on_demand() { let (port2, chan2) = pipes::stream(); - do spawn_sched(CurrentScheduler) |move chan2| { + do spawn_sched(CurrentScheduler) || { chan2.send(()); } diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index a57e8a8ee44b7..d72cacc2c4be7 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -93,7 +93,7 @@ use uint; use util; 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 } ) ) type TaskSet = LinearSet<*rust_task>; @@ -195,10 +195,10 @@ fn each_ancestor(list: &mut AncestorList, if coalesce_this.is_some() { // Needed coalesce. Our next ancestor becomes our old // ancestor's next ancestor. ("next = old_next->next;") - *list = move option::unwrap(move coalesce_this); + *list = option::unwrap(coalesce_this); } else { // No coalesce; restore from tmp. ("next = old_next;") - *list = move tmp_list; + *list = tmp_list; } return early_break; } @@ -279,7 +279,7 @@ fn each_ancestor(list: &mut AncestorList, // Swap the list out here; the caller replaces us with it. let rest = util::replace(&mut nobe.ancestors, AncestorList(None)); - (Some(move rest), need_unwind) + (Some(rest), need_unwind) } else { (None, need_unwind) } @@ -292,8 +292,8 @@ fn each_ancestor(list: &mut AncestorList, // If this trips, more likely the problem is 'blk' failed inside. let tmp_arc = option::swap_unwrap(&mut *parent_group); let result = do access_group(&tmp_arc) |tg_opt| { blk(tg_opt) }; - *parent_group = move Some(move tmp_arc); - move result + *parent_group = Some(tmp_arc); + result } } } @@ -337,15 +337,15 @@ struct TCB { fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList, is_main: bool, notifier: Option) -> TCB { - let notifier = move notifier; + let notifier = notifier; notifier.iter(|x| { x.failed = false; }); TCB { me: me, - tasks: move tasks, - ancestors: move ancestors, + tasks: tasks, + ancestors: ancestors, is_main: is_main, - notifier: move notifier + notifier: notifier } } @@ -360,7 +360,7 @@ struct AutoNotify { fn AutoNotify(chan: Chan) -> AutoNotify { AutoNotify { - notify_chan: move chan, + notify_chan: chan, failed: true // Un-set above when taskgroup successfully made. } } @@ -370,10 +370,10 @@ fn enlist_in_taskgroup(state: TaskGroupInner, me: *rust_task, let newstate = util::replace(&mut *state, None); // If 'None', the group was failing. Can't enlist. if newstate.is_some() { - let group = option::unwrap(move newstate); + let group = option::unwrap(newstate); taskset_insert(if is_member { &mut group.members } else { &mut group.descendants }, me); - *state = Some(move group); + *state = Some(group); true } else { false @@ -386,10 +386,10 @@ fn leave_taskgroup(state: TaskGroupInner, me: *rust_task, let newstate = util::replace(&mut *state, None); // If 'None', already failing and we've already gotten a kill signal. if newstate.is_some() { - let group = option::unwrap(move newstate); + let group = option::unwrap(newstate); taskset_remove(if is_member { &mut group.members } else { &mut group.descendants }, me); - *state = Some(move group); + *state = Some(group); } } @@ -410,7 +410,7 @@ fn kill_taskgroup(state: TaskGroupInner, me: *rust_task, is_main: bool) { // That's ok; only one task needs to do the dirty work. (Might also // see 'None' if Somebody already failed and we got a kill signal.) if newstate.is_some() { - let group = option::unwrap(move newstate); + let group = option::unwrap(newstate); for taskset_each(&group.members) |sibling| { // Skip self - killing ourself won't do much good. if sibling != me { @@ -457,7 +457,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) })); // Main task/group has no ancestors, no notifier, etc. let group = - @TCB(spawner, move tasks, AncestorList(None), true, None); + @TCB(spawner, tasks, AncestorList(None), true, None); local_set(spawner, taskgroup_key!(), group); group } @@ -472,7 +472,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) // Child's ancestors are spawner's ancestors. let a = share_ancestors(&mut spawner_group.ancestors); // Propagate main-ness. - (move g, move a, spawner_group.is_main) + (g, a, spawner_group.is_main) } else { // Child is in a separate group from spawner. let g = private::exclusive(Some(TaskGroupData { @@ -504,7 +504,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) // Child has no ancestors. AncestorList(None) }; - (move g, move a, false) + (g, a, false) }; } @@ -515,10 +515,10 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) // None { ancestor_list(None) } let tmp = util::replace(&mut **ancestors, None); if tmp.is_some() { - let ancestor_arc = option::unwrap(move tmp); + let ancestor_arc = option::unwrap(tmp); let result = ancestor_arc.clone(); - **ancestors = move Some(move ancestor_arc); - AncestorList(Some(move result)) + **ancestors = Some(ancestor_arc); + AncestorList(Some(result)) } else { AncestorList(None) } @@ -530,7 +530,7 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) { gen_child_taskgroup(opts.linked, opts.supervised); unsafe { - let child_data = ~mut Some((move child_tg, move ancestors, move f)); + let child_data = ~mut Some((child_tg, ancestors, f)); // Being killed with the unsafe task/closure pointers would leak them. do unkillable { // Agh. Get move-mode items into the closure. FIXME (#2829) @@ -548,8 +548,8 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) { Some(option::swap_unwrap(&mut opts.notify_chan)) }; - let child_wrapper = make_child_wrapper(new_task, move child_tg, - move ancestors, is_main, move notify_chan, move f); + let child_wrapper = make_child_wrapper(new_task, child_tg, + ancestors, is_main, notify_chan, f); let closure = cast::transmute(&child_wrapper); @@ -557,7 +557,7 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) { // closure. (Reordering them wouldn't help - then getting killed // between them would leak.) rt::start_task(new_task, closure); - cast::forget(move child_wrapper); + cast::forget(child_wrapper); } } @@ -571,8 +571,8 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) { ancestors: AncestorList, is_main: bool, notify_chan: Option>, f: fn~()) -> fn~() { - let child_data = ~mut Some((move child_arc, move ancestors)); - return fn~(move notify_chan, move child_data, move f) { + let child_data = ~mut Some((child_arc, ancestors)); + return fn~() { // Agh. Get move-mode items into the closure. FIXME (#2829) let mut (child_arc, ancestors) = option::swap_unwrap(child_data); // Child task runs this code. @@ -584,14 +584,14 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) { let notifier = match notify_chan { Some(ref notify_chan_value) => { let moved_ncv = move_it!(*notify_chan_value); - Some(AutoNotify(move moved_ncv)) + Some(AutoNotify(moved_ncv)) } _ => None }; if enlist_many(child, &child_arc, &mut ancestors) { - let group = @TCB(child, move child_arc, move ancestors, - is_main, move notifier); + let group = @TCB(child, child_arc, ancestors, + is_main, notifier); unsafe { local_set(child, taskgroup_key!(), group); } @@ -694,7 +694,7 @@ fn test_spawn_raw_unsupervise() { notify_chan: None, .. default_task_opts() }; - do spawn_raw(move opts) { + do spawn_raw(opts) { fail!(); } } @@ -708,7 +708,7 @@ fn test_spawn_raw_notify_success() { notify_chan: Some(notify_ch), .. default_task_opts() }; - do spawn_raw(move opts) { + do spawn_raw(opts) { } assert notify_po.recv() == Success; } @@ -724,7 +724,7 @@ fn test_spawn_raw_notify_failure() { notify_chan: Some(notify_ch), .. default_task_opts() }; - do spawn_raw(move opts) { + do spawn_raw(opts) { fail!(); } assert notify_po.recv() == Failure; diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index a1e77a494d5bd..e545f6567ec32 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -87,7 +87,7 @@ impl ToStr for ~[A] { } } str::push_char(&mut acc, ']'); - move acc + acc } } } diff --git a/src/libcore/util.rs b/src/libcore/util.rs index 87cbcdfe30b9a..eea172a43ced1 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -19,7 +19,7 @@ use prelude::*; /// The identity function. #[inline(always)] -pub pure fn id(x: T) -> T { move x } +pub pure fn id(x: T) -> T { x } /// Ignores a value. #[inline(always)] @@ -37,10 +37,10 @@ pub fn with( // we wouldn't need to copy... let old_value = *ptr; - *ptr = move new_value; + *ptr = new_value; let result = op(); - *ptr = move old_value; - return move result; + *ptr = old_value; + return result; } /** @@ -58,9 +58,9 @@ pub fn swap(x: &mut T, y: &mut T) { */ #[inline(always)] pub fn replace(dest: &mut T, src: T) -> T { - let mut tmp = move src; + let mut tmp = src; swap(dest, &mut tmp); - move tmp + tmp } /// A non-copyable dummy type. @@ -109,7 +109,7 @@ mod tests { let x = ~[(5, false)]; //FIXME #3387 assert x.eq(id(copy x)); let y = copy x; - assert x.eq(&id(move y)); + assert x.eq(&id(y)); } #[test] pub fn test_swap() { diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 3808e13be1cbc..97519e88f26c8 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -614,7 +614,7 @@ unsafe fn push_fast(v: &mut ~[T], initval: T) { (**repr).unboxed.fill += sys::nonzero_size_of::(); let p = addr_of(&((**repr).unboxed.data)); let p = ptr::offset(p, fill) as *mut T; - rusti::move_val_init(&mut(*p), move initval); + rusti::move_val_init(&mut(*p), initval); } #[inline(never)] From e61b243edffc01854e6e139ea3f5124ec58cf16c Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 01:11:38 -0800 Subject: [PATCH 06/10] compiletest: Get rid of `move`. --- src/compiletest/compiletest.rc | 2 +- src/compiletest/procsrv.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiletest/compiletest.rc b/src/compiletest/compiletest.rc index 5557b1131766b..5ad616963fa66 100644 --- a/src/compiletest/compiletest.rc +++ b/src/compiletest/compiletest.rc @@ -177,7 +177,7 @@ pub fn make_tests(config: config) -> ~[test::TestDescAndFn] { tests.push(make_test(config, file)) } } - move tests + tests } pub fn is_test(config: config, testfile: &Path) -> bool { diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 304266f0f7966..432258b26a638 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -78,12 +78,12 @@ pub fn run(lib_path: ~str, writeclose(pipe_in.out, input); let p = pipes::PortSet(); let ch = p.chan(); - do task::spawn_sched(task::SingleThreaded) |move ch| { + do task::spawn_sched(task::SingleThreaded) || { let errput = readclose(pipe_err.in); ch.send((2, errput)); } let ch = p.chan(); - do task::spawn_sched(task::SingleThreaded) |move ch| { + do task::spawn_sched(task::SingleThreaded) || { let output = readclose(pipe_out.in); ch.send((1, output)); } From 99b3c07b4e788d7120c2754f69613f760a6efd0a Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 04:14:34 -0500 Subject: [PATCH 07/10] librustc: Get rid of `move`. --- src/librustc/back/link.rs | 8 ++-- src/librustc/driver/driver.rs | 4 +- src/librustc/lib/llvm.rs | 2 +- src/librustc/metadata/decoder.rs | 8 ++-- src/librustc/metadata/loader.rs | 2 +- src/librustc/middle/astencode.rs | 2 +- src/librustc/middle/borrowck/check_loans.rs | 2 +- src/librustc/middle/borrowck/gather_loans.rs | 8 ++-- src/librustc/middle/borrowck/mod.rs | 4 +- src/librustc/middle/liveness.rs | 2 +- src/librustc/middle/resolve.rs | 4 +- src/librustc/middle/trans/_match.rs | 6 +-- src/librustc/middle/trans/base.rs | 2 +- src/librustc/middle/trans/cabi_x86_64.rs | 4 +- src/librustc/middle/trans/common.rs | 4 +- src/librustc/middle/trans/debuginfo.rs | 2 +- src/librustc/middle/ty.rs | 14 +++---- src/librustc/middle/typeck/check/method.rs | 42 +++++++++---------- src/librustc/middle/typeck/check/mod.rs | 2 +- src/librustc/middle/typeck/coherence.rs | 2 +- src/librustc/middle/typeck/collect.rs | 2 +- src/librustc/middle/typeck/infer/combine.rs | 4 +- src/librustc/middle/typeck/infer/glb.rs | 2 +- src/librustc/middle/typeck/infer/lub.rs | 2 +- src/librustc/middle/typeck/infer/macros.rs | 4 +- src/librustc/middle/typeck/infer/mod.rs | 6 +-- .../middle/typeck/infer/region_inference.rs | 16 +++---- src/librustc/middle/typeck/infer/test.rs | 4 +- src/librustc/rustc.rc | 4 +- src/librustc/util/common.rs | 2 +- 30 files changed, 85 insertions(+), 85 deletions(-) diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index df362b7798408..894e846e11f68 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -156,7 +156,7 @@ pub mod jit { code: entry, env: ptr::null() }; - let func: fn(++argv: ~[~str]) = cast::transmute(move closure); + let func: fn(++argv: ~[~str]) = cast::transmute(closure); func(~[/*bad*/copy sess.opts.binary]); } @@ -559,11 +559,11 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path, let {name: opt_name, vers: opt_vers, cmh_items: cmh_items} = provided_link_metas(sess, c); - let name = crate_meta_name(sess, output, move opt_name); - let vers = crate_meta_vers(sess, move opt_vers); + let name = crate_meta_name(sess, output, opt_name); + let vers = crate_meta_vers(sess, opt_vers); let dep_hashes = cstore::get_dep_hashes(sess.cstore); let extras_hash = - crate_meta_extras_hash(symbol_hasher, move cmh_items, + crate_meta_extras_hash(symbol_hasher, cmh_items, dep_hashes); return {name: name, vers: vers, extras_hash: extras_hash}; diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index b0024bace37e0..08ba3515fd251 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -172,7 +172,7 @@ pub fn time(do_it: bool, what: ~str, thunk: fn() -> T) -> T { let end = std::time::precise_time_s(); io::stdout().write_str(fmt!("time: %3.3f s\t%s\n", end - start, what)); - move rv + rv } pub enum compile_upto { @@ -257,7 +257,7 @@ pub fn compile_upto(sess: Session, cfg: ast::crate_cfg, let (llmod, link_meta) = { let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars, - region_map, rp_set, move lang_items, crate); + region_map, rp_set, lang_items, crate); let (method_map, vtable_map) = time(time_passes, ~"typechecking", || diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 4b63bb3721538..e18a7e7d1d85a 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -1481,7 +1481,7 @@ pub fn struct_element_types(struct_ty: TypeRef) -> ~[TypeRef] { llvm::LLVMGetStructElementTypes( struct_ty, ptr::to_mut_unsafe_ptr(&mut buf[0])); } - return move buf; + return buf; } } diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 3564e10790d3a..cc97c0060535a 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -752,10 +752,10 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd, def_id: did }; - vec::push(&mut result, move provided_trait_method_info); + vec::push(&mut result, provided_trait_method_info); } - return move result; + return result; } /// Returns the supertraits of the given trait. @@ -766,7 +766,7 @@ pub fn get_supertraits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) for reader::tagged_docs(item_doc, tag_impl_trait) |trait_doc| { results.push(doc_type(trait_doc, tcx, cdata)); } - return dvec::unwrap(move results); + return dvec::unwrap(results); } // If the item in question is a trait, returns its set of methods and @@ -847,7 +847,7 @@ pub fn get_static_methods_if_impl(intr: @ident_interner, } } - return Some(dvec::unwrap(move static_impl_methods)); + return Some(dvec::unwrap(static_impl_methods)); } pub fn get_item_attrs(cdata: cmd, diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index 9e5b1db879f0c..ad19eed6992f3 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -228,7 +228,7 @@ fn get_metadata_section(os: os, csz - vlen); do vec::raw::buf_as_slice(cvbuf1, csz-vlen) |bytes| { let inflated = flate::inflate_bytes(bytes); - found = move Some(@(move inflated)); + found = Some(@(inflated)); } if found != None { return found; diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 3b84216b2e6db..da58062f55376 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -1140,7 +1140,7 @@ fn decode_side_tables(xcx: extended_decode_ctxt, let ids = val_dsr.read_to_vec(|| { xcx.tr_id(val_dsr.read_int()) }); - let dvec = @dvec::from_vec(move ids); + let dvec = @dvec::from_vec(ids); dcx.maps.last_use_map.insert(id, dvec); } else if tag == (c::tag_table_method_map as uint) { dcx.maps.method_map.insert( diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index b6b94faa3db7e..507f3059f32c8 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -632,7 +632,7 @@ fn check_loans_in_fn(fk: visit::fn_kind, _ => {} // Ignore this argument. } } - *self.fn_args = @move fn_args; + *self.fn_args = @fn_args; } } diff --git a/src/librustc/middle/borrowck/gather_loans.rs b/src/librustc/middle/borrowck/gather_loans.rs index 65518398eb752..126a7f3033308 100644 --- a/src/librustc/middle/borrowck/gather_loans.rs +++ b/src/librustc/middle/borrowck/gather_loans.rs @@ -376,8 +376,8 @@ impl GatherLoanCtxt { Some(_) => { match loan::loan(self.bccx, cmt, scope_r, loan_kind) { Err(ref e) => { self.bccx.report((*e)); } - Ok(move loans) => { - self.add_loans(cmt, loan_kind, scope_r, move loans); + Ok(loans) => { + self.add_loans(cmt, loan_kind, scope_r, loans); } } } @@ -540,7 +540,7 @@ impl GatherLoanCtxt { } }; - self.add_loans_to_scope_id(scope_id, move loans); + self.add_loans_to_scope_id(scope_id, loans); if loan_kind.is_freeze() && !cmt.mutbl.is_immutable() { self.bccx.stats.loaned_paths_imm += 1; @@ -566,7 +566,7 @@ impl GatherLoanCtxt { req_loans.push_all(loans); } None => { - let dvec = @dvec::from_vec(move loans); + let dvec = @dvec::from_vec(loans); let req_loan_map = self.req_maps.req_loan_map; req_loan_map.insert(scope_id, dvec); } diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index dd8f889a05732..40f5a00163286 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -420,7 +420,7 @@ pub fn save_and_restore(save_and_restore_t: &mut T, let old_save_and_restore_t = *save_and_restore_t; let u = f(); *save_and_restore_t = old_save_and_restore_t; - move u + u } pub fn save_and_restore_managed(save_and_restore_t: @mut T, @@ -428,7 +428,7 @@ pub fn save_and_restore_managed(save_and_restore_t: @mut T, let old_save_and_restore_t = *save_and_restore_t; let u = f(); *save_and_restore_t = old_save_and_restore_t; - move u + u } impl LoanKind { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index d65c4e0158055..70464d0084a35 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -1520,7 +1520,7 @@ impl Liveness { self.cont_ln.insert(loop_node_id, cont_ln); let r = f(); self.loop_scope.pop(); - move r + r } } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 45838efad708e..44b0da626b68d 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -797,7 +797,7 @@ pub fn Resolver(session: Session, intr: session.intr() }; - move self + self } /// The main resolver class. @@ -3255,7 +3255,7 @@ pub impl Resolver { self.add_exports_for_module(&mut exports2, module_); match copy module_.def_id { Some(def_id) => { - self.export_map2.insert(def_id.node, move exports2); + self.export_map2.insert(def_id.node, exports2); debug!("(computing exports) writing exports for %d (some)", def_id.node); } diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 492adc8631dc9..75c3c35039d3a 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -559,7 +559,7 @@ pub fn enter_opt(bcx: block, m: &[@Match/&r], opt: &Opt, col: uint, Some(fp) => reordered_patterns.push(fp.pat) } } - Some(dvec::unwrap(move reordered_patterns)) + Some(dvec::unwrap(reordered_patterns)) } else { None } @@ -815,7 +815,7 @@ pub fn get_options(ccx: @crate_ctxt, m: &[@Match], col: uint) -> ~[Opt] { _ => {} } } - return dvec::unwrap(move found); + return dvec::unwrap(found); } pub fn extract_variant_args(bcx: block, @@ -1657,7 +1657,7 @@ pub fn trans_match_inner(scope_cx: block, arm_cxs.push(bcx); } - bcx = controlflow::join_blocks(scope_cx, dvec::unwrap(move arm_cxs)); + bcx = controlflow::join_blocks(scope_cx, dvec::unwrap(arm_cxs)); return bcx; fn mk_fail(bcx: block, sp: span, +msg: ~str, diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 8d6d299c92f89..f38e56278c521 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1174,7 +1174,7 @@ pub fn new_block(cx: fn_ctxt, parent: Option, +kind: block_kind, }); let bcx = mk_block(llbb, parent, - move kind, + kind, is_lpad, opt_node_info, cx); diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index a3c5e094ea819..9f717682dae09 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -274,11 +274,11 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] { if words > 4 { all_mem(cls); let cls = cls; - return move cls; + return cls; } classify(ty, cls, 0, 0); fixup(ty, cls); - return move cls; + return cls; } fn llreg_ty(cls: &[x86_64_reg_class]) -> TypeRef { diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 03a91fa15fa08..6ecfbb5762c55 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -593,7 +593,7 @@ pub fn block_(llbb: BasicBlockRef, parent: Option, -kind: block_kind, terminated: false, unreachable: false, parent: parent, - kind: move kind, + kind: kind, is_lpad: is_lpad, node_info: node_info, fcx: fcx @@ -607,7 +607,7 @@ pub enum block = @block_; pub fn mk_block(llbb: BasicBlockRef, parent: Option, -kind: block_kind, is_lpad: bool, node_info: Option, fcx: fn_ctxt) -> block { - block(@block_(llbb, parent, move kind, is_lpad, node_info, fcx)) + block(@block_(llbb, parent, kind, is_lpad, node_info, fcx)) } // First two args are retptr, env diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 7c6f03cb364bc..e2e5526eac08b 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -152,7 +152,7 @@ enum debug_metadata { fn cast_safely(val: T) -> U { unsafe { let val2 = val; - return cast::transmute(move val2); + return cast::transmute(val2); } } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index f7fb5b771aa74..a30e0df8452a1 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -320,7 +320,7 @@ pub pure fn get(t: t) -> t_box { unsafe { let t2 = cast::reinterpret_cast::(&t); let t3 = t2; - cast::forget(move t2); + cast::forget(t2); t3 } } @@ -830,7 +830,7 @@ pub fn mk_ctxt(s: session::Session, inferred_modes: HashMap(), adjustments: HashMap(), normalized_cache: new_ty_hash(), - lang_items: move lang_items, + lang_items: lang_items, legacy_boxed_traits: HashMap(), provided_methods: HashMap(), provided_method_sources: HashMap(), @@ -909,10 +909,10 @@ fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option) -> t { } } - let t = @{sty: move st, id: cx.next_id, flags: flags, o_def_id: o_def_id}; + let t = @{sty: st, id: cx.next_id, flags: flags, o_def_id: o_def_id}; let key = intern_key {sty: to_unsafe_ptr(&t.sty), o_def_id: o_def_id}; - cx.interner.insert(move key, t); + cx.interner.insert(key, t); cx.next_id += 1u; unsafe { cast::reinterpret_cast(&t) } @@ -1178,7 +1178,7 @@ pub fn fold_sig(sig: &FnSig, fldop: fn(t) -> t) -> FnSig { }; FnSig { - inputs: move args, + inputs: args, output: fldop(sig.output) } } @@ -3110,7 +3110,7 @@ pub fn expr_kind(tcx: ctxt, ast::def_local(*) | ast::def_self(*) => LvalueExpr, - move def => { + def => { tcx.sess.span_bug(expr.span, fmt!( "Uncategorized def for expr %?: %?", expr.id, def)); @@ -3617,7 +3617,7 @@ pub fn trait_supertraits(cx: ctxt, } // Unwrap and return the result. - return @dvec::unwrap(move result); + return @dvec::unwrap(result); } pub fn trait_methods(cx: ctxt, id: ast::def_id) -> @~[method] { diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index eca368e5d7673..3524636fe2b77 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -139,7 +139,7 @@ pub fn lookup( let mme = lcx.do_lookup(self_ty); debug!("method lookup for %s yielded %?", expr_repr(fcx.tcx(), expr), mme); - return move mme; + return mme; } pub struct LookupContext { @@ -204,26 +204,26 @@ pub impl LookupContext { check::DontDerefArgs => { match self.search_for_autoderefd_method(self_ty, autoderefs) { - Some(move mme) => { return Some(mme); } + Some(mme) => { return Some(mme); } None => {} } match self.search_for_autoptrd_method(self_ty, autoderefs) { - Some(move mme) => { return Some(move mme); } + Some(mme) => { return Some(mme); } None => {} } } check::DoDerefArgs => { match self.search_for_autoptrd_method(self_ty, autoderefs) { - Some(move mme) => { return Some(move mme); } + Some(mme) => { return Some(mme); } None => {} } match self.search_for_autoderefd_method(self_ty, autoderefs) { - Some(move mme) => { return Some(mme); } + Some(mme) => { return Some(mme); } None => {} } } @@ -457,7 +457,7 @@ pub impl LookupContext { self.create_rcvr_ty_and_substs_for_method( method.self_ty, rcvr_ty, - move init_substs, + init_substs, TransformTypeNormally); let cand = Candidate { @@ -525,12 +525,12 @@ pub impl LookupContext { let (rcvr_ty, rcvr_substs) = self.create_rcvr_ty_and_substs_for_method(method.self_ty, self_ty, - move rcvr_substs, + rcvr_substs, TransformTypeForObject); self.inherent_candidates.push(Candidate { rcvr_ty: rcvr_ty, - rcvr_substs: move rcvr_substs, + rcvr_substs: rcvr_substs, explicit_self: method.self_ty, num_method_tps: method.tps.len(), self_mode: get_mode_from_self_type(method.self_ty), @@ -585,7 +585,7 @@ pub impl LookupContext { self.create_rcvr_ty_and_substs_for_method( method_self_ty, self_ty, - move rcvr_substs, + rcvr_substs, TransformTypeNormally); let origin = if trait_did == did { method_self(trait_did, index) @@ -595,7 +595,7 @@ pub impl LookupContext { }; self.inherent_candidates.push(Candidate { rcvr_ty: rcvr_ty, - rcvr_substs: move rcvr_substs, + rcvr_substs: rcvr_substs, explicit_self: method_self_ty, num_method_tps: method_num_tps, self_mode: get_mode_from_self_type(method_self_ty), @@ -648,12 +648,12 @@ pub impl LookupContext { self.create_rcvr_ty_and_substs_for_method( method.self_type, impl_ty, - move impl_substs, + impl_substs, TransformTypeNormally); candidates.push(Candidate { rcvr_ty: impl_ty, - rcvr_substs: move impl_substs, + rcvr_substs: impl_substs, explicit_self: method.self_type, num_method_tps: method.n_tps, self_mode: get_mode_from_self_type(method.self_type), @@ -693,7 +693,7 @@ pub impl LookupContext { candidates.push(Candidate { rcvr_ty: impl_ty, - rcvr_substs: move impl_substs, + rcvr_substs: impl_substs, explicit_self: provided_method_info.method_info.self_type, num_method_tps: provided_method_info.method_info.n_tps, self_mode: get_mode_from_self_type( @@ -722,10 +722,10 @@ pub impl LookupContext { match self_decl { sty_static | sty_value | sty_by_ref | sty_box(_) | sty_uniq(_) => { - move self_substs + self_substs } sty_region(_) if self_substs.self_r.is_some() => { - move self_substs + self_substs } sty_region(_) => { substs { @@ -761,7 +761,7 @@ pub impl LookupContext { self.consider_reborrow(self_ty, autoderefs); match self.search_for_method(self_ty) { None => None, - Some(move mme) => { + Some(mme) => { debug!("(searching for autoderef'd method) writing \ adjustment (%u) to %d", autoderefs, @@ -945,7 +945,7 @@ pub impl LookupContext { let autoref_ty = mk_autoref_ty(*mutbl, region); match self.search_for_method(autoref_ty) { None => {} - Some(move mme) => { + Some(mme) => { self.fcx.write_adjustment( self.self_expr.id, @ty::AutoAdjustment { @@ -977,8 +977,8 @@ pub impl LookupContext { debug!("searching inherent candidates"); match self.consider_candidates(self_ty, &self.inherent_candidates) { None => {} - Some(move mme) => { - return Some(move mme); + Some(mme) => { + return Some(mme); } } @@ -987,8 +987,8 @@ pub impl LookupContext { None => { return None; } - Some(move mme) => { - return Some(move mme); + Some(mme) => { + return Some(mme); } } } diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index a8439c3c45964..706f6d82c879b 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -870,7 +870,7 @@ pub impl FnCtxt { self.region_lb = lb; let v = f(); self.region_lb = old_region_lb; - move v + v } fn region_var_if_parameterized(@mut self, diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 64ac5a9ae820e..7594b2690a4a3 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -553,7 +553,7 @@ pub impl CoherenceChecker { UniversalQuantificationResult { monotype: monotype, - type_variables: move type_parameters, + type_variables: type_parameters, bounds: polytype.bounds } } diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 2a42e75f53d47..17ed0c0a93f5b 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -320,7 +320,7 @@ pub fn ensure_supertraits(ccx: @mut CrateCtxt, instantiated.push(InstantiatedTraitRef { def_id: did, tpt: tpt }); } tcx.supertraits.insert(local_def(id), - @dvec::unwrap(move instantiated)); + @dvec::unwrap(instantiated)); } /** diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index 54b5867bfa239..89719564adaa6 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -121,9 +121,9 @@ pub struct CombineFields { pub fn expected_found( self: &C, +a: T, +b: T) -> ty::expected_found { if self.a_is_expected() { - ty::expected_found {expected: move a, found: move b} + ty::expected_found {expected: a, found: b} } else { - ty::expected_found {expected: move b, found: move a} + ty::expected_found {expected: b, found: a} } } diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs index 9778ac670c849..e51fd14f66511 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/typeck/infer/glb.rs @@ -186,7 +186,7 @@ pub impl Glb: Combine { new_vars, a_isr, a_vars, b_vars, r)); debug!("sig1 = %s", sig1.inf_str(self.infcx)); - return Ok(move sig1); + return Ok(sig1); fn generalize_region(self: &Glb, snapshot: uint, diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs index e19d5b3f47bed..fd4b2fdf32bf3 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/typeck/infer/lub.rs @@ -144,7 +144,7 @@ pub impl Lub: Combine { &sig0, |r, _in_fn| generalize_region(&self, snapshot, new_vars, a_isr, r)); - return Ok(move sig1); + return Ok(sig1); fn generalize_region(self: &Lub, snapshot: uint, diff --git a/src/librustc/middle/typeck/infer/macros.rs b/src/librustc/middle/typeck/infer/macros.rs index 8cccf75d6dc4e..01174d1620ada 100644 --- a/src/librustc/middle/typeck/infer/macros.rs +++ b/src/librustc/middle/typeck/infer/macros.rs @@ -13,8 +13,8 @@ macro_rules! if_ok( ($inp: expr) => ( match $inp { - Ok(move v) => { move v } - Err(move e) => { return Err(e); } + Ok(v) => { v } + Err(e) => { return Err(e); } } ) ); diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index f6af29c1a8df9..4f7507d4c5a2b 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -599,7 +599,7 @@ impl @mut InferCtxt { self.ty_var_bindings.bindings.truncate(0); self.int_var_bindings.bindings.truncate(0); self.region_vars.commit(); - move r + r } } @@ -613,7 +613,7 @@ impl @mut InferCtxt { Ok(_) => (), Err(_) => self.rollback_to(&snapshot) } - move r + r } } @@ -624,7 +624,7 @@ impl @mut InferCtxt { let snapshot = self.start_snapshot(); let r = self.try(f); self.rollback_to(&snapshot); - move r + r } } } diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs index c838a52a6892f..cc5e860715d6d 100644 --- a/src/librustc/middle/typeck/infer/region_inference.rs +++ b/src/librustc/middle/typeck/infer/region_inference.rs @@ -899,7 +899,7 @@ pub impl RegionVarBindings { // replace the NoValue entry with ErrorValue. let mut values = self.values.take(); values[*rid] = ErrorValue; - self.values.put_back(move values); + self.values.put_back(values); re_static } @@ -999,9 +999,9 @@ pub impl RegionVarBindings { None => {} Some((ref r1, ref r2)) => { result_set = - consider_adding_edge(move result_set, &r, r1, r2); + consider_adding_edge(result_set, &r, r1, r2); result_set = - consider_adding_edge(move result_set, &r, r2, r1); + consider_adding_edge(result_set, &r, r2, r1); } } @@ -1018,13 +1018,13 @@ pub impl RegionVarBindings { r1: &Region, r2: &Region) -> ~[Region] { - let mut result_set = move result_set; + let mut result_set = result_set; if *r == *r1 { // Clearly, this is potentially inefficient. if !result_set.contains(r2) { result_set.push(*r2); } } - return move result_set; + return result_set; } } @@ -1254,8 +1254,8 @@ impl RegionVarBindings { } let mut graph = Graph { - nodes: move nodes, - edges: move edges + nodes: nodes, + edges: edges }; for uint::range(0, num_edges) |edge_idx| { @@ -1273,7 +1273,7 @@ impl RegionVarBindings { } } - return (move graph); + return (graph); fn insert_edge(+graph: &mut Graph, node_id: RegionVid, diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs index d79343e64a69d..27355da4b9aee 100644 --- a/src/librustc/middle/typeck/infer/test.rs +++ b/src/librustc/middle/typeck/infer/test.rs @@ -69,7 +69,7 @@ fn setup_env(test_name: &str, source_string: &str) -> Env { cfg, parse_sess); let tcx = ty::mk_ctxt(sess, dm, amap, freevars, region_map, - region_paramd_items, move lang_items, crate); + region_paramd_items, lang_items, crate); let infcx = infer::new_infer_ctxt(tcx); @@ -192,7 +192,7 @@ impl Env { onceness: ast::Many, region: ty::re_static, bounds: @~[]}, - sig: FnSig {inputs: move inputs, + sig: FnSig {inputs: inputs, output: output_ty} }) } diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 62067a4bd7aae..52a8e5488d8df 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -326,7 +326,7 @@ pub fn monitor(+f: fn~(diagnostic::Emitter)) { let (p, ch) = stream(); let ch = SharedChan(ch); let ch_capture = ch.clone(); - match do task::try |move f| { + match do task::try || { let ch = ch_capture.clone(); let ch_capture = ch.clone(); // The 'diagnostics emitter'. Every error, warning, etc. should @@ -375,7 +375,7 @@ pub fn monitor(+f: fn~(diagnostic::Emitter)) { pub fn main() { let args = os::args(); - do monitor |move args, demitter| { + do monitor |demitter| { run_compiler(&args, demitter); } } diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 85f4ba94e5a9b..7b980b9de0db6 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -27,7 +27,7 @@ pub fn indent(op: fn() -> R) -> R { debug!(">>"); let r = op(); debug!("<< (Result = %?)", r); - move r + r } pub struct _indenter { From e244f103c9622ef0d13b138ec6f8425840201def Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 01:15:53 -0800 Subject: [PATCH 08/10] libsyntax: Get rid of uses of `move` and don't parse it. --- src/libsyntax/attr.rs | 2 +- src/libsyntax/codemap.rs | 4 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/build.rs | 22 ++++---- src/libsyntax/ext/deriving.rs | 82 ++++++++++++++-------------- src/libsyntax/ext/pipes/liveness.rs | 2 +- src/libsyntax/ext/pipes/pipec.rs | 32 +++++------ src/libsyntax/ext/pipes/proto.rs | 2 +- src/libsyntax/ext/tt/macro_parser.rs | 28 +++++----- src/libsyntax/fold.rs | 2 +- src/libsyntax/parse/mod.rs | 16 +++--- src/libsyntax/parse/parser.rs | 51 ++++++++--------- src/libsyntax/print/pp.rs | 6 +- src/libsyntax/util/interner.rs | 2 +- 14 files changed, 123 insertions(+), 130 deletions(-) diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index e3d1fb9781b2e..893647ca9ad82 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -270,7 +270,7 @@ pub fn sort_meta_items(+items: ~[@ast::meta_item]) -> ~[@ast::meta_item] { // This is sort of stupid here, converting to a vec of mutables and back let mut v: ~[@ast::meta_item] = items; std::sort::quick_sort(v, lteq); - move v + v } pub fn remove_meta_items_by_name(items: ~[@ast::meta_item], name: ~str) -> diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 10a4e12bef4fc..3c61e834af6f2 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -152,7 +152,7 @@ pub impl span: Decodable { } pub pure fn spanned(+lo: BytePos, +hi: BytePos, +t: T) -> spanned { - respan(mk_sp(lo, hi), move t) + respan(mk_sp(lo, hi), t) } pub pure fn respan(sp: span, +t: T) -> spanned { @@ -160,7 +160,7 @@ pub pure fn respan(sp: span, +t: T) -> spanned { } pub pure fn dummy_spanned(+t: T) -> spanned { - respan(dummy_sp(), move t) + respan(dummy_sp(), t) } /* assuming that we're not in macro expansion */ diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 951e350f8b290..33eaaaae35b3e 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -281,7 +281,7 @@ pub fn mk_ctxt(parse_sess: parse::parse_sess, mod_path: ~[], trace_mac: false }; - move ((move imp) as @ext_ctxt) + ((imp) as @ext_ctxt) } pub fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str { diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index a050b2316e873..963ea5bfe3329 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -73,7 +73,7 @@ pub fn mk_raw_path_(sp: span, global: false, idents: idents, rp: None, - types: move types } + types: types } } pub fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::path { @ast::path { span: sp, @@ -156,7 +156,7 @@ pub fn mk_field(sp: span, f: &{ident: ast::ident, ex: @ast::expr}) } pub fn mk_fields(sp: span, fields: ~[{ident: ast::ident, ex: @ast::expr}]) -> ~[ast::field] { - move fields.map(|f| mk_field(sp, f)) + fields.map(|f| mk_field(sp, f)) } pub fn mk_rec_e(cx: ext_ctxt, sp: span, @@ -288,33 +288,33 @@ pub fn mk_pat_ident_with_binding_mode(cx: ext_ctxt, bm: ast::binding_mode) -> @ast::pat { let path = mk_raw_path(span, ~[ ident ]); let pat = ast::pat_ident(bm, path, None); - mk_pat(cx, span, move pat) + mk_pat(cx, span, pat) } pub fn mk_pat_enum(cx: ext_ctxt, span: span, path: @ast::path, +subpats: ~[@ast::pat]) -> @ast::pat { - let pat = ast::pat_enum(path, Some(move subpats)); - mk_pat(cx, span, move pat) + let pat = ast::pat_enum(path, Some(subpats)); + mk_pat(cx, span, pat) } pub fn mk_pat_struct(cx: ext_ctxt, span: span, path: @ast::path, +field_pats: ~[ast::field_pat]) -> @ast::pat { - let pat = ast::pat_struct(path, move field_pats, false); - mk_pat(cx, span, move pat) + let pat = ast::pat_struct(path, field_pats, false); + mk_pat(cx, span, pat) } pub fn mk_bool(cx: ext_ctxt, span: span, value: bool) -> @ast::expr { let lit_expr = ast::expr_lit(@codemap::spanned { node: ast::lit_bool(value), span: span }); - build::mk_expr(cx, span, move lit_expr) + build::mk_expr(cx, span, lit_expr) } pub fn mk_stmt(cx: ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt { let stmt_ = ast::stmt_semi(expr, cx.next_id()); - @codemap::spanned { node: move stmt_, span: span } + @codemap::spanned { node: stmt_, span: span } } pub fn mk_ty_path(cx: ext_ctxt, span: span, @@ -322,7 +322,7 @@ pub fn mk_ty_path(cx: ext_ctxt, -> @ast::Ty { let ty = build::mk_raw_path(span, idents); let ty = ast::ty_path(ty, cx.next_id()); - let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span }; + let ty = @ast::Ty { id: cx.next_id(), node: ty, span: span }; ty } pub fn mk_ty_path_global(cx: ext_ctxt, @@ -331,7 +331,7 @@ pub fn mk_ty_path_global(cx: ext_ctxt, -> @ast::Ty { let ty = build::mk_raw_path_global(span, idents); let ty = ast::ty_path(ty, cx.next_id()); - let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span }; + let ty = @ast::Ty { id: cx.next_id(), node: ty, span: span }; ty } pub fn mk_simple_ty_path(cx: ext_ctxt, diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index 8e87357f8b5b9..1aa1d8ca9a07e 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -95,19 +95,19 @@ fn expand_deriving(cx: ext_ctxt, span, struct_def, item.ident, - move ty_params)); + ty_params)); } item_enum(ref enum_definition, copy ty_params) => { result.push(expand_deriving_enum_def(cx, span, enum_definition, item.ident, - move ty_params)); + ty_params)); } _ => () } } - dvec::unwrap(move result) + dvec::unwrap(result) } fn create_impl_item(cx: ext_ctxt, span: span, +item: item_) -> @item { @@ -115,7 +115,7 @@ fn create_impl_item(cx: ext_ctxt, span: span, +item: item_) -> @item { ident: clownshoes_extensions, attrs: ~[], id: cx.next_id(), - node: move item, + node: item, vis: public, span: span, } @@ -161,7 +161,7 @@ fn create_eq_method(cx: ext_ctxt, }; // Create the function declaration. - let fn_decl = build::mk_fn_decl(~[ move arg ], output_type); + let fn_decl = build::mk_fn_decl(~[ arg ], output_type); // Create the body block. let body_block = build::mk_simple_block(cx, span, body); @@ -174,8 +174,8 @@ fn create_eq_method(cx: ext_ctxt, tps: ~[], self_ty: self_ty, purity: pure_fn, - decl: move fn_decl, - body: move body_block, + decl: fn_decl, + body: body_block, id: cx.next_id(), span: span, self_id: cx.next_id(), @@ -194,14 +194,14 @@ fn create_self_type_with_params(cx: ext_ctxt, let self_ty_param = build::mk_simple_ty_path(cx, span, ty_param.ident); - self_ty_params.push(move self_ty_param); + self_ty_params.push(self_ty_param); } - let self_ty_params = dvec::unwrap(move self_ty_params); + let self_ty_params = dvec::unwrap(self_ty_params); // Create the type of `self`. let self_type = build::mk_raw_path_(span, ~[ type_ident ], - move self_ty_params); + self_ty_params); let self_type = ty_path(self_type, cx.next_id()); @ast::Ty { id: cx.next_id(), node: self_type, span: span } } @@ -221,9 +221,9 @@ fn create_derived_impl(cx: ext_ctxt, trait_path.map(|x| *x)); let bounds = @~[ TraitTyParamBound(bound) ]; let impl_ty_param = build::mk_ty_param(cx, ty_param.ident, bounds); - impl_ty_params.push(move impl_ty_param); + impl_ty_params.push(impl_ty_param); } - let impl_ty_params = dvec::unwrap(move impl_ty_params); + let impl_ty_params = dvec::unwrap(impl_ty_params); // Create the reference to the trait. let trait_path = ast::path { @@ -233,12 +233,12 @@ fn create_derived_impl(cx: ext_ctxt, rp: None, types: ~[] }; - let trait_path = @move trait_path; + let trait_path = @trait_path; let trait_ref = ast::trait_ref { path: trait_path, ref_id: cx.next_id() }; - let trait_ref = @move trait_ref; + let trait_ref = @trait_ref; // Create the type of `self`. let self_type = create_self_type_with_params(cx, @@ -247,11 +247,11 @@ fn create_derived_impl(cx: ext_ctxt, ty_params); // Create the impl item. - let impl_item = item_impl(move impl_ty_params, + let impl_item = item_impl(impl_ty_params, Some(trait_ref), self_type, methods.map(|x| *x)); - return create_impl_item(cx, span, move impl_item); + return create_impl_item(cx, span, impl_item); } fn create_derived_eq_impl(cx: ext_ctxt, @@ -310,11 +310,11 @@ fn create_iter_bytes_method(cx: ext_ctxt, let output_type = @ast::Ty { id: cx.next_id(), node: ty_nil, span: span }; // Create the function declaration. - let inputs = ~[ move lsb0_arg, move f_arg ]; - let fn_decl = build::mk_fn_decl(move inputs, output_type); + let inputs = ~[ lsb0_arg, f_arg ]; + let fn_decl = build::mk_fn_decl(inputs, output_type); // Create the body block. - let body_block = build::mk_block_(cx, span, move statements); + let body_block = build::mk_block_(cx, span, statements); // Create the method. let self_ty = spanned { node: sty_region(m_imm), span: span }; @@ -325,8 +325,8 @@ fn create_iter_bytes_method(cx: ext_ctxt, tps: ~[], self_ty: self_ty, purity: pure_fn, - decl: move fn_decl, - body: move body_block, + decl: fn_decl, + body: body_block, id: cx.next_id(), span: span, self_id: cx.next_id(), @@ -348,10 +348,10 @@ fn create_subpatterns(cx: ext_ctxt, // Create the subpattern. let subpath = build::mk_raw_path(span, ~[ ident ]); let subpat = pat_ident(bind_by_ref(m_imm), subpath, None); - let subpat = build::mk_pat(cx, span, move subpat); + let subpat = build::mk_pat(cx, span, subpat); subpats.push(subpat); } - return dvec::unwrap(move subpats); + return dvec::unwrap(subpats); } fn create_enum_variant_pattern(cx: ext_ctxt, @@ -373,7 +373,7 @@ fn create_enum_variant_pattern(cx: ext_ctxt, prefix, variant_args.len()); - return build::mk_pat_enum(cx, span, matching_path, move subpats); + return build::mk_pat_enum(cx, span, matching_path, subpats); } struct_variant_kind(struct_def) => { let matching_path = build::mk_raw_path(span, ~[ variant_ident ]); @@ -508,7 +508,7 @@ fn expand_deriving_eq_struct_def(cx: ext_ctxt, return create_derived_eq_impl(cx, span, type_ident, - move ty_params, + ty_params, eq_method, ne_method); } @@ -541,7 +541,7 @@ fn expand_deriving_eq_enum_def(cx: ext_ctxt, return create_derived_eq_impl(cx, span, type_ident, - move ty_params, + ty_params, eq_method, ne_method); } @@ -561,7 +561,7 @@ fn expand_deriving_iter_bytes_struct_def(cx: ext_ctxt, return create_derived_iter_bytes_impl(cx, span, type_ident, - move ty_params, + ty_params, method); } @@ -580,7 +580,7 @@ fn expand_deriving_iter_bytes_enum_def(cx: ext_ctxt, return create_derived_iter_bytes_impl(cx, span, type_ident, - move ty_params, + ty_params, method); } @@ -671,8 +671,8 @@ fn expand_deriving_iter_bytes_struct_method(cx: ext_ctxt, } // Create the method itself. - let statements = dvec::unwrap(move statements); - return create_iter_bytes_method(cx, span, move statements); + let statements = dvec::unwrap(statements); + return create_iter_bytes_method(cx, span, statements); } fn expand_deriving_eq_enum_method(cx: ext_ctxt, @@ -738,9 +738,9 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt, let matching_arm = ast::arm { pats: ~[ matching_pat ], guard: None, - body: move matching_body_block + body: matching_body_block }; - other_arms.push(move matching_arm); + other_arms.push(matching_arm); // Maybe generate a non-matching case. If there is only one // variant then there will always be a match. @@ -777,11 +777,11 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt, // Create the self pattern body. let other_expr = build::mk_path(cx, span, ~[ other_ident ]); let other_expr = build::mk_unary(cx, span, deref, other_expr); - let other_arms = dvec::unwrap(move other_arms); - let other_match_expr = expr_match(other_expr, move other_arms); + let other_arms = dvec::unwrap(other_arms); + let other_match_expr = expr_match(other_expr, other_arms); let other_match_expr = build::mk_expr(cx, span, - move other_match_expr); + other_match_expr); let other_match_body_block = build::mk_simple_block(cx, span, other_match_expr); @@ -792,15 +792,15 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt, guard: None, body: other_match_body_block, }; - self_arms.push(move self_arm); + self_arms.push(self_arm); } // Create the method body. let self_expr = build::mk_path(cx, span, ~[ self_ident ]); let self_expr = build::mk_unary(cx, span, deref, self_expr); - let self_arms = dvec::unwrap(move self_arms); - let self_match_expr = expr_match(self_expr, move self_arms); - let self_match_expr = build::mk_expr(cx, span, move self_match_expr); + let self_arms = dvec::unwrap(self_arms); + let self_match_expr = expr_match(self_expr, self_arms); + let self_match_expr = build::mk_expr(cx, span, self_match_expr); // Create the method. return create_eq_method(cx, @@ -848,8 +848,8 @@ fn expand_deriving_iter_bytes_enum_method(cx: ext_ctxt, } // Create the pattern body. - let stmts = dvec::unwrap(move stmts); - let match_body_block = build::mk_block_(cx, span, move stmts); + let stmts = dvec::unwrap(stmts); + let match_body_block = build::mk_block_(cx, span, stmts); // Create the arm. ast::arm { diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index b0a8f49c7a243..c690c89c025f2 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -53,7 +53,7 @@ pub fn analyze(proto: protocol, _cx: ext_ctxt) { for state.reachable |s| { bv.set(s.id, true); } - move bv + bv }; let mut i = 0; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index da0ac4e08ab06..0f596e661583d 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -73,10 +73,10 @@ pub impl message: gen_send { if this.proto.is_bounded() { let (sp, rp) = match (this.dir, next.dir) { - (send, send) => (~"move c", ~"move s"), + (send, send) => (~"c", ~"s"), (send, recv) => (~"s", ~"c"), (recv, send) => (~"s", ~"c"), - (recv, recv) => (~"move c", ~"move s") + (recv, recv) => (~"c", ~"s") }; body += ~"let b = pipe.reuse_buffer();\n"; @@ -89,10 +89,10 @@ pub impl message: gen_send { } else { let pat = match (this.dir, next.dir) { - (send, send) => "(move c, move s)", + (send, send) => "(c, s)", (send, recv) => "(s, c)", (recv, send) => "(s, c)", - (recv, recv) => "(move c, move s)" + (recv, recv) => "(c, s)" }; body += fmt!("let %s = ::pipes::entangle();\n", pat); @@ -100,17 +100,17 @@ pub impl message: gen_send { body += fmt!("let message = %s(%s);\n", self.name(), str::connect(vec::append_one( - arg_names.map(|x| ~"move " + cx.str_of(*x)), - ~"move s"), ~", ")); + arg_names.map(|x| cx.str_of(*x)), + ~"s"), ~", ")); if !try { - body += fmt!("::pipes::send(move pipe, move message);\n"); + body += fmt!("::pipes::send(pipe, message);\n"); // return the new channel - body += ~"move c }"; + body += ~"c }"; } else { - body += fmt!("if ::pipes::send(move pipe, move message) {\n \ - ::pipes::rt::make_some(move c) \ + body += fmt!("if ::pipes::send(pipe, message) {\n \ + ::pipes::rt::make_some(c) \ } else { ::pipes::rt::make_none() } }"); } @@ -153,7 +153,7 @@ pub impl message: gen_send { ~"" } else { - ~"(" + str::connect(arg_names.map(|x| ~"move " + *x), + ~"(" + str::connect(arg_names.map(|x| *x), ~", ") + ~")" }; @@ -164,10 +164,10 @@ pub impl message: gen_send { message_args); if !try { - body += fmt!("::pipes::send(move pipe, move message);\n"); + body += fmt!("::pipes::send(pipe, message);\n"); body += ~" }"; } else { - body += fmt!("if ::pipes::send(move pipe, move message) \ + body += fmt!("if ::pipes::send(pipe, message) \ { \ ::pipes::rt::make_some(()) \ } else { \ @@ -319,7 +319,7 @@ pub impl protocol: gen_init { recv => { quote_expr!({ let (s, c) = ::pipes::entangle(); - (move c, move s) + (c, s) }) } } @@ -331,7 +331,7 @@ pub impl protocol: gen_init { recv => { quote_expr!({ let (s, c) = $body; - (move c, move s) + (c, s) }) } } @@ -375,7 +375,7 @@ pub impl protocol: gen_init { quote_expr!({ let buffer = $buffer; - do ::pipes::entangle_buffer(move buffer) |buffer, data| { + do ::pipes::entangle_buffer(buffer) |buffer, data| { $entangle_body } }) diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 6a1d93576941d..1d6534aef3464 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -207,7 +207,7 @@ pub impl protocol { span: self.span, dir: dir, ty_params: ty_params, - messages: move messages, + messages: messages, proto: self }); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 9e89e703c09bb..df10f15c709cb 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -279,7 +279,7 @@ pub fn parse(sess: parse_sess, } new_pos.idx += 1; - cur_eis.push(move new_pos); + cur_eis.push(new_pos); } // can we go around again? @@ -288,19 +288,19 @@ pub fn parse(sess: parse_sess, match copy ei.sep { Some(ref t) if idx == len => { // we need a separator if tok == (*t) { //pass the separator - let ei_t = move ei; + let ei_t = ei; ei_t.idx += 1; - next_eis.push(move ei_t); + next_eis.push(ei_t); } } _ => { // we don't need a separator - let ei_t = move ei; + let ei_t = ei; ei_t.idx = 0; - cur_eis.push(move ei_t); + cur_eis.push(ei_t); } } } else { - eof_eis.push(move ei); + eof_eis.push(ei); } } else { match copy ei.elts[idx].node { @@ -315,26 +315,26 @@ pub fn parse(sess: parse_sess, new_ei.matches[idx].push(@matched_seq(~[], sp)); } - cur_eis.push(move new_ei); + cur_eis.push(new_ei); } let matches = vec::map(ei.matches, // fresh, same size: |_m| DVec::<@named_match>()); - let ei_t = move ei; + let ei_t = ei; cur_eis.push(~{ elts: (*matchers), sep: (*sep), mut idx: 0u, - mut up: matcher_pos_up(Some(move ei_t)), - matches: move matches, + mut up: matcher_pos_up(Some(ei_t)), + matches: matches, match_lo: match_idx_lo, match_hi: match_idx_hi, sp_lo: sp.lo }); } - match_nonterminal(_,_,_) => { bb_eis.push(move ei) } + match_nonterminal(_,_,_) => { bb_eis.push(ei) } match_tok(ref t) => { - let ei_t = move ei; + let ei_t = ei; if (*t) == tok { ei_t.idx += 1; - next_eis.push(move ei_t); + next_eis.push(ei_t); } } } @@ -388,7 +388,7 @@ pub fn parse(sess: parse_sess, } _ => fail!() } - cur_eis.push(move ei); + cur_eis.push(ei); for rust_parser.tokens_consumed.times() || { rdr.next_token(); diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 8cecbfb12101e..ff9a353ee92bb 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -252,7 +252,7 @@ pub fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ { }; item_trait(fold_ty_params(tps, fld), vec::map(traits, |p| fold_trait_ref(*p, fld)), - move methods) + methods) } item_mac(ref m) => { // FIXME #2888: we might actually want to do something here. diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 84d6ebd83c7cd..82c1697bf72b0 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -151,7 +151,7 @@ pub fn parse_from_source_str(f: fn (p: Parser) -> T, p.reader.fatal(~"expected end-of-string"); } p.abort_if_errors(); - move r + r } pub fn next_node_id(sess: parse_sess) -> node_id { @@ -177,16 +177,16 @@ pub fn new_parser_from_file(sess: parse_sess, path: &Path) -> Result { match io::read_whole_file_str(path) { - result::Ok(move src) => { + result::Ok(src) => { - let filemap = sess.cm.new_filemap(path.to_str(), @move src); + let filemap = sess.cm.new_filemap(path.to_str(), @src); let srdr = lexer::new_string_reader(sess.span_diagnostic, filemap, sess.interner); Ok(Parser(sess, cfg, srdr as reader)) } - result::Err(move e) => Err(move e) + result::Err(e) => Err(e) } } @@ -195,8 +195,8 @@ pub fn new_parser_from_file(sess: parse_sess, pub fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: &Path) -> Parser { match new_parser_from_file(sess, cfg, path) { - Ok(move parser) => move parser, - Err(move e) => { + Ok(parser) => parser, + Err(e) => { sess.span_diagnostic.handler().fatal(e) } } @@ -207,8 +207,8 @@ pub fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, pub fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: &Path, sp: span) -> Parser { match new_parser_from_file(sess, cfg, path) { - Ok(move parser) => move parser, - Err(move e) => { + Ok(parser) => parser, + Err(e) => { sess.span_diagnostic.span_fatal(sp, e) } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c9ca28768db46..f6fd894192e77 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -190,8 +190,8 @@ pub fn Parser(sess: parse_sess let interner = rdr.interner(); Parser { - reader: move rdr, - interner: move interner, + reader: rdr, + interner: interner, sess: sess, cfg: cfg, token: tok0.tok, @@ -1083,9 +1083,6 @@ pub impl Parser { let e = self.parse_expr(); ex = expr_copy(e); hi = e.span.hi; - } else if self.eat_keyword(~"move") { - // XXX move keyword is no longer important, remove after snapshot - return self.parse_expr(); } else if self.token == token::MOD_SEP || is_ident(self.token) && !self.is_keyword(~"true") && !self.is_keyword(~"false") { @@ -1197,7 +1194,7 @@ pub impl Parser { hi = self.span.hi; let nd = expr_method_call(e, i, tys, es, NoSugar); - e = self.mk_expr(lo, hi, move nd); + e = self.mk_expr(lo, hi, nd); } _ => { e = self.mk_expr(lo, hi, expr_field(e, i, tys)); @@ -2099,10 +2096,6 @@ pub impl Parser { } else if self.eat_keyword(~"copy") { pat = self.parse_pat_ident(refutable, bind_by_copy); } else { - if self.eat_keyword(~"move") { - /* XXX---remove move keyword */ - } - // XXX---refutable match bindings should work same as let let binding_mode = if refutable {bind_infer} else {bind_by_copy}; @@ -2372,7 +2365,7 @@ pub impl Parser { self.obsolete(copy self.span, ObsoleteUnsafeBlock); } self.expect(token::LBRACE); - let {inner: move inner, next: move next} = + let {inner: inner, next: next} = maybe_parse_inner_attrs_and_next(self, parse_attrs); return (inner, self.parse_block_tail_(lo, default_blk, next)); } @@ -2397,8 +2390,8 @@ pub impl Parser { let mut stmts = ~[]; let mut expr = None; - let {attrs_remaining: move attrs_remaining, - view_items: move view_items, + let {attrs_remaining: attrs_remaining, + view_items: view_items, items: items, _} = self.parse_items_and_view_items(first_item_attrs, IMPORTS_AND_ITEMS_ALLOWED, false); @@ -2570,7 +2563,7 @@ pub impl Parser { } } } - return @move bounds; + return @bounds; } fn parse_ty_param() -> ty_param { @@ -3083,13 +3076,13 @@ pub impl Parser { fn parse_mod_items(term: token::Token, +first_item_attrs: ~[attribute]) -> _mod { // Shouldn't be any view items since we've already parsed an item attr - let {attrs_remaining: move attrs_remaining, - view_items: move view_items, + let {attrs_remaining: attrs_remaining, + view_items: view_items, items: starting_items, _} = self.parse_items_and_view_items(first_item_attrs, VIEW_ITEMS_AND_ITEMS_ALLOWED, true); - let mut items: ~[@item] = move starting_items; + let mut items: ~[@item] = starting_items; let mut first = true; while self.token != term { @@ -3140,7 +3133,7 @@ pub impl Parser { self.bump(); // This mod is in an external file. Let's go get it! let (m, attrs) = self.eval_src_mod(id, outer_attrs, id_span); - (id, m, Some(move attrs)) + (id, m, Some(attrs)) } else { self.push_mod_path(id, outer_attrs); self.expect(token::LBRACE); @@ -3300,9 +3293,9 @@ pub impl Parser { fn parse_foreign_item(+attrs: ~[attribute]) -> @foreign_item { let vis = self.parse_visibility(); if self.is_keyword(~"const") { - self.parse_item_foreign_const(vis, move attrs) + self.parse_item_foreign_const(vis, attrs) } else { - self.parse_item_foreign_fn( move attrs) + self.parse_item_foreign_fn(attrs) } } @@ -3311,15 +3304,15 @@ pub impl Parser { +first_item_attrs: ~[attribute]) -> foreign_mod { // Shouldn't be any view items since we've already parsed an item attr - let {attrs_remaining: move attrs_remaining, - view_items: move view_items, + let {attrs_remaining: attrs_remaining, + view_items: view_items, items: _, - foreign_items: move foreign_items} = + foreign_items: foreign_items} = self.parse_items_and_view_items(first_item_attrs, VIEW_ITEMS_AND_FOREIGN_ITEMS_ALLOWED, true); - let mut items: ~[@foreign_item] = move foreign_items; + let mut items: ~[@foreign_item] = foreign_items; let mut initial_attrs = attrs_remaining; while self.token != token::RBRACE { let attrs = vec::append(initial_attrs, @@ -3329,7 +3322,7 @@ pub impl Parser { } ast::foreign_mod { sort: sort, - abi: move abi, + abi: abi, view_items: view_items, items: items } @@ -3382,14 +3375,14 @@ pub impl Parser { // extern mod { ... } if items_allowed && self.eat(token::LBRACE) { let abi; - match move abi_opt { - Some(move found_abi) => abi = move found_abi, + match abi_opt { + Some(found_abi) => abi = found_abi, None => abi = special_idents::c_abi, } let extra_attrs = self.parse_inner_attrs_and_next(); let m = self.parse_foreign_mod_items(sort, - move abi, + abi, extra_attrs.next); self.expect(token::RBRACE); @@ -3513,7 +3506,7 @@ pub impl Parser { ident = self.parse_ident(); self.expect(token::LBRACE); let nested_enum_def = self.parse_enum_def(ty_params); - kind = enum_variant_kind(move nested_enum_def); + kind = enum_variant_kind(nested_enum_def); needs_comma = false; } else { ident = self.parse_value_ident(); diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index aeebcce1f2b27..a30447d968e1d 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -147,11 +147,11 @@ pub fn mk_printer(out: @io::Writer, linewidth: uint) -> @mut Printer { space: linewidth as int, left: 0, right: 0, - token: move token, - size: move size, + token: token, + size: size, left_total: 0, right_total: 0, - scan_stack: move scan_stack, + scan_stack: scan_stack, scan_stack_empty: true, top: 0, bottom: 0, diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 905571d181721..0677e25a3fedf 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -24,7 +24,7 @@ pub fn mk() -> Interner { let m = oldmap::HashMap::(); let hi: hash_interner = {map: m, vect: DVec()}; - move ((move hi) as Interner::) + ((hi) as Interner::) } pub fn mk_prefill(init: &[T]) -> Interner { From 178882c98feb4d19a88ce950b035bc40ffda2650 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 02:44:18 -0800 Subject: [PATCH 09/10] tests/tutorials: Get rid of `move`. --- doc/rust.md | 2 +- doc/tutorial-borrowed-ptr.md | 2 +- doc/tutorial-tasks.md | 20 +++--- doc/tutorial.md | 2 +- src/librustc/metadata/encoder.rs | 2 +- src/test/auxiliary/cci_class_6.rs | 2 +- src/test/bench/core-vec-append.rs | 2 +- src/test/bench/graph500-bfs.rs | 4 +- src/test/bench/msgsend-pipes-shared.rs | 10 +-- src/test/bench/msgsend-pipes.rs | 12 ++-- src/test/bench/msgsend-ring-mutex-arcs.rs | 28 ++++---- src/test/bench/msgsend-ring-pipes.rs | 29 ++++---- src/test/bench/msgsend-ring-rw-arcs.rs | 27 ++++---- src/test/bench/noise.rs | 4 +- src/test/bench/pingpong.rs | 44 ++++++------- src/test/bench/shootout-chameneos-redux.rs | 2 +- src/test/bench/shootout-k-nucleotide-pipes.rs | 12 ++-- src/test/bench/shootout-mandelbrot.rs | 2 +- src/test/bench/shootout-pfib.rs | 8 +-- src/test/bench/task-perf-alloc-unwind.rs | 2 +- .../bench/task-perf-jargon-metal-smoke.rs | 8 +-- src/test/bench/task-perf-linked-failure.rs | 4 +- ...her-can-live-while-the-other-survives-1.rs | 4 +- ...her-can-live-while-the-other-survives-2.rs | 4 +- ...her-can-live-while-the-other-survives-3.rs | 4 +- ...her-can-live-while-the-other-survives-4.rs | 4 +- .../compile-fail/bind-by-move-no-guards.rs | 6 +- .../compile-fail/bind-by-move-no-lvalues-1.rs | 2 +- .../compile-fail/bind-by-move-no-lvalues-2.rs | 2 +- .../bind-by-move-no-sub-bindings.rs | 4 +- .../borrowck-loan-in-overloaded-op.rs | 2 +- .../borrowck-move-from-unsafe-ptr.rs | 2 +- .../borrowck-vec-pattern-element-loan.rs | 2 +- .../borrowck-vec-pattern-tail-element-loan.rs | 2 +- src/test/compile-fail/copy-a-resource.rs | 2 +- src/test/compile-fail/issue-2548.rs | 2 +- .../compile-fail/issue-3177-mutable-struct.rs | 2 +- src/test/compile-fail/kindck-nonsendable-1.rs | 2 +- src/test/compile-fail/liveness-unused.rs | 2 +- src/test/compile-fail/noncopyable-class.rs | 2 +- src/test/compile-fail/unique-pinned-nocopy.rs | 2 +- src/test/compile-fail/unique-unique-kind.rs | 2 +- src/test/compile-fail/unique-vec-res.rs | 4 +- src/test/compile-fail/unsendable-class.rs | 2 +- src/test/compile-fail/vec-res-add.rs | 4 +- src/test/run-fail/out-of-stack-managed-box.rs | 4 +- src/test/run-fail/out-of-stack-owned-box.rs | 4 +- src/test/run-fail/unwind-box-res.rs | 2 +- src/test/run-fail/unwind-closure.rs | 2 +- src/test/run-fail/unwind-move.rs | 2 +- src/test/run-fail/unwind-resource-fail.rs | 2 +- src/test/run-fail/unwind-resource-fail2.rs | 2 +- .../run-pass/alt-ref-binding-in-guard-3256.rs | 2 +- src/test/run-pass/argument-passing.rs | 2 +- src/test/run-pass/auto-encode.rs | 2 +- src/test/run-pass/auto-ref-sliceable.rs | 2 +- src/test/run-pass/bind-by-move.rs | 4 +- .../borrowck-move-from-unsafe-ptr-ok.rs | 2 +- src/test/run-pass/cap-clause-move.rs | 8 +-- src/test/run-pass/class-poly-methods.rs | 2 +- src/test/run-pass/dvec-test.rs | 2 +- src/test/run-pass/fn-bare-spawn.rs | 2 +- src/test/run-pass/hashmap-memory.rs | 2 +- src/test/run-pass/init-res-into-things.rs | 12 ++-- src/test/run-pass/intrinsic-move-val.rs | 2 +- src/test/run-pass/issue-1895.rs | 2 +- src/test/run-pass/issue-2185.rs | 6 +- src/test/run-pass/issue-2718.rs | 66 +++++++++---------- src/test/run-pass/issue-2834.rs | 2 +- src/test/run-pass/issue-2904.rs | 2 +- src/test/run-pass/issue-2930.rs | 2 +- src/test/run-pass/issue-3168.rs | 6 +- src/test/run-pass/issue-3176.rs | 8 +-- src/test/run-pass/issue-3220.rs | 2 +- src/test/run-pass/issue-3447.rs | 2 +- src/test/run-pass/issue-3878.rs | 2 +- src/test/run-pass/issue-4016.rs | 2 +- src/test/run-pass/last-use-in-block.rs | 4 +- src/test/run-pass/last-use-in-cap-clause.rs | 2 +- src/test/run-pass/liveness-move-in-loop.rs | 2 +- src/test/run-pass/log-linearized.rs | 2 +- ...nomorphized-callees-with-ty-params-3314.rs | 2 +- src/test/run-pass/move-1-unique.rs | 2 +- src/test/run-pass/move-1.rs | 2 +- src/test/run-pass/move-2-unique.rs | 2 +- src/test/run-pass/move-2.rs | 2 +- src/test/run-pass/move-3-unique.rs | 2 +- src/test/run-pass/move-3.rs | 2 +- src/test/run-pass/move-4-unique.rs | 6 +- src/test/run-pass/move-4.rs | 6 +- src/test/run-pass/move-arg-2-unique.rs | 2 +- src/test/run-pass/move-arg-2.rs | 2 +- src/test/run-pass/move-arg.rs | 2 +- src/test/run-pass/move-nullary-fn.rs | 2 +- src/test/run-pass/move-scalar.rs | 2 +- src/test/run-pass/move-self.rs | 2 +- src/test/run-pass/non-legacy-modes.rs | 2 +- src/test/run-pass/option-unwrap.rs | 6 +- src/test/run-pass/pipe-bank-proto.rs | 30 ++++----- src/test/run-pass/pipe-detect-term.rs | 6 +- src/test/run-pass/pipe-peek.rs | 2 +- src/test/run-pass/pipe-pingpong-bounded.rs | 34 +++++----- src/test/run-pass/pipe-pingpong-proto.rs | 20 +++--- .../run-pass/pipe-presentation-examples.rs | 26 ++++---- src/test/run-pass/pipe-select.rs | 32 ++++----- src/test/run-pass/pipe-sleep.rs | 4 +- src/test/run-pass/regions-copy-closure.rs | 2 +- src/test/run-pass/regions-static-closure.rs | 4 +- .../run-pass/resource-assign-is-not-copy.rs | 4 +- src/test/run-pass/resource-cycle.rs | 8 +-- src/test/run-pass/resource-cycle2.rs | 4 +- src/test/run-pass/resource-cycle3.rs | 4 +- src/test/run-pass/resource-destruct.rs | 2 +- src/test/run-pass/resource-generic.rs | 2 +- src/test/run-pass/rt-sched-1.rs | 2 +- src/test/run-pass/select-macro.rs | 16 ++--- src/test/run-pass/sendfn-spawn-with-fn-arg.rs | 2 +- src/test/run-pass/static-method-test.rs | 4 +- src/test/run-pass/task-comm-0.rs | 2 +- src/test/run-pass/task-comm-10.rs | 6 +- src/test/run-pass/task-comm-11.rs | 4 +- src/test/run-pass/task-comm-12.rs | 4 +- src/test/run-pass/task-comm-13.rs | 2 +- src/test/run-pass/task-comm-14.rs | 4 +- src/test/run-pass/task-comm-15.rs | 2 +- src/test/run-pass/task-comm-16.rs | 2 +- src/test/run-pass/task-comm-3.rs | 4 +- src/test/run-pass/task-comm-7.rs | 8 +-- src/test/run-pass/task-comm-9.rs | 6 +- .../trait-default-method-bound-subst.rs | 4 +- .../trait-default-method-bound-subst2.rs | 4 +- .../trait-default-method-bound-subst3.rs | 4 +- .../trait-default-method-bound-subst4.rs | 4 +- src/test/run-pass/trait-to-str.rs | 2 +- src/test/run-pass/unique-decl-move-temp.rs | 2 +- src/test/run-pass/unique-decl-move.rs | 2 +- src/test/run-pass/unique-fn-arg-move.rs | 2 +- src/test/run-pass/unique-move-drop.rs | 2 +- src/test/run-pass/unique-move-temp.rs | 2 +- src/test/run-pass/unique-move.rs | 2 +- src/test/run-pass/unreachable-code-1.rs | 2 +- src/test/run-pass/unreachable-code.rs | 2 +- src/test/run-pass/unused-move-capture.rs | 2 +- src/test/run-pass/unused-move.rs | 2 +- src/test/run-pass/unwind-resource.rs | 2 +- src/test/run-pass/unwind-resource2.rs | 2 +- src/test/run-pass/weird-exprs.rs | 4 +- src/test/run-pass/while-loop-constraints-2.rs | 2 +- src/test/run-pass/yield.rs | 4 +- src/test/run-pass/yield1.rs | 4 +- 150 files changed, 409 insertions(+), 411 deletions(-) diff --git a/doc/rust.md b/doc/rust.md index 23035b3b34a0f..14efa3fcead88 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -213,7 +213,7 @@ else enum extern false fn for if impl let log loop -match mod move mut +match mod mut priv pub pure ref return self static struct super diff --git a/doc/tutorial-borrowed-ptr.md b/doc/tutorial-borrowed-ptr.md index 939051ca6058d..c13b2528598c1 100644 --- a/doc/tutorial-borrowed-ptr.md +++ b/doc/tutorial-borrowed-ptr.md @@ -431,7 +431,7 @@ fn example5c(x: @S) -> int { let y = &v.g; ... } - x.f = move v; // Replace x.f + x.f = v; // Replace x.f ... # return 0; } diff --git a/doc/tutorial-tasks.md b/doc/tutorial-tasks.md index 5900fc1a9ff2d..a3d0ecaa4ba65 100644 --- a/doc/tutorial-tasks.md +++ b/doc/tutorial-tasks.md @@ -161,7 +161,7 @@ use pipes::{stream, Port, Chan}; let (port, chan): (Port, Chan) = stream(); -do spawn |move chan| { +do spawn || { let result = some_expensive_computation(); chan.send(result); } @@ -192,7 +192,7 @@ spawns the child task. # 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); } @@ -229,7 +229,7 @@ following program is ill-typed: # fn some_expensive_computation() -> int { 42 } let (port, chan) = stream(); -do spawn |move chan| { +do spawn { chan.send(some_expensive_computation()); } @@ -248,12 +248,12 @@ Instead we can use a `SharedChan`, a type that allows a single 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)); } } @@ -283,10 +283,10 @@ might look like the example below. // 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 @@ -398,13 +398,13 @@ before returning. Hence: # fn sleep_forever() { loop { task::yield() } } # do task::try { let (receiver, sender): (Port, Chan) = 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 } @@ -505,7 +505,7 @@ Here is the code for the parent task: let (from_child, to_child) = DuplexStream(); -do spawn |move to_child| { +do spawn { stringifier(&to_child); }; diff --git a/doc/tutorial.md b/doc/tutorial.md index a825b7f535f72..9550dd927fac3 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1260,7 +1260,7 @@ Moving it into a mutable slot makes the elements assignable. 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; diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 12c5e3388dbe7..ad418943ec06c 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1229,7 +1229,7 @@ pub fn encode_metadata(parms: encode_parms, crate: &crate) -> ~[u8] { 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, diff --git a/src/test/auxiliary/cci_class_6.rs b/src/test/auxiliary/cci_class_6.rs index f4b27e04c1304..3ab101bc0b4e8 100644 --- a/src/test/auxiliary/cci_class_6.rs +++ b/src/test/auxiliary/cci_class_6.rs @@ -27,7 +27,7 @@ pub mod kitties { cat { meows: in_x, how_hungry: in_y, - info: move in_info + info: in_info } } } diff --git a/src/test/bench/core-vec-append.rs b/src/test/bench/core-vec-append.rs index b8766d86b017a..1dfcb31f19638 100644 --- a/src/test/bench/core-vec-append.rs +++ b/src/test/bench/core-vec-append.rs @@ -27,7 +27,7 @@ fn collect_dvec(num: uint) -> ~[uint] { for uint::range(0u, num) |i| { result.push(i); } - return dvec::unwrap(move result); + return dvec::unwrap(result); } fn main() { diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs index e88cb62db7345..5910ade013e88 100644 --- a/src/test/bench/graph500-bfs.rs +++ b/src/test/bench/graph500-bfs.rs @@ -141,7 +141,7 @@ fn bfs(graph: graph, key: node_id) -> bfs_result { }; } - move marks + marks } /** @@ -260,7 +260,7 @@ fn pbfs(&&graph: arc::ARC, key: node_id) -> bfs_result { 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) { diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 5b6c5210dbffb..bfbc7ecd20ac6 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -27,7 +27,7 @@ use io::WriterUtil; 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 { @@ -58,7 +58,7 @@ fn run(args: &[~str]) { 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(); @@ -68,8 +68,8 @@ fn run(args: &[~str]) { 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)); @@ -77,7 +77,7 @@ fn run(args: &[~str]) { //error!("worker %? exiting", i); }; } - do task::spawn |move from_parent, move to_parent| { + do task::spawn || { server(from_parent, to_parent); } diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 269d02ae45f33..57d9bb49df25a 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -23,7 +23,7 @@ use io::WriterUtil; 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 { @@ -54,7 +54,7 @@ fn run(args: &[~str]) { 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(); @@ -63,10 +63,10 @@ fn run(args: &[~str]) { 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)); @@ -74,7 +74,7 @@ fn run(args: &[~str]) { //error!("worker %? exiting", i); }; } - do task::spawn |move from_parent, move to_parent| { + do task::spawn || { server(from_parent, to_parent); } diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index 5e1ac20f5eb9f..9b6fee5e23bc1 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -40,7 +40,7 @@ fn recv(p: &pipe) -> uint { fn init() -> (pipe,pipe) { let m = arc::MutexARC(~[]); - ((&m).clone(), move m) + ((&m).clone(), m) } @@ -48,18 +48,18 @@ fn thread_ring(i: uint, 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); }; } @@ -77,7 +77,7 @@ fn main() { 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(); @@ -89,22 +89,22 @@ fn main() { 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() }; diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs index e9281a0c41736..71ca0f9576575 100644 --- a/src/test/bench/msgsend-ring-pipes.rs +++ b/src/test/bench/msgsend-ring-pipes.rs @@ -29,15 +29,15 @@ proto! ring ( ) 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); @@ -45,9 +45,9 @@ fn thread_ring(i: uint, 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)); @@ -70,7 +70,7 @@ fn main() { 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(); @@ -82,23 +82,22 @@ fn main() { 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() }; diff --git a/src/test/bench/msgsend-ring-rw-arcs.rs b/src/test/bench/msgsend-ring-rw-arcs.rs index ff88eea598dfb..eaae8370d6b8b 100644 --- a/src/test/bench/msgsend-ring-rw-arcs.rs +++ b/src/test/bench/msgsend-ring-rw-arcs.rs @@ -40,7 +40,7 @@ fn recv(p: &pipe) -> uint { fn init() -> (pipe,pipe) { let x = arc::RWARC(~[]); - ((&x).clone(), move x) + ((&x).clone(), x) } @@ -48,18 +48,18 @@ fn thread_ring(i: uint, 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); }; } @@ -77,7 +77,7 @@ fn main() { 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(); @@ -89,23 +89,22 @@ fn main() { 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() }; diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs index a07dcee35f4d3..39caba9273293 100644 --- a/src/test/bench/noise.rs +++ b/src/test/bench/noise.rs @@ -35,8 +35,8 @@ fn Noise2DContext() -> ~Noise2DContext { r.shuffle_mut(permutations); ~Noise2DContext{ - rgradients: move rgradients, - permutations: move permutations, + rgradients: rgradients, + permutations: permutations, } } diff --git a/src/test/bench/pingpong.rs b/src/test/bench/pingpong.rs index 3d367c546838b..11a127b9722f4 100644 --- a/src/test/bench/pingpong.rs +++ b/src/test/bench/pingpong.rs @@ -45,17 +45,17 @@ proto! pingpong_unbounded ( // 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!() } } ); @@ -63,10 +63,10 @@ macro_rules! follow ( { $($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!() } } ) @@ -74,7 +74,7 @@ macro_rules! follow ( fn switch(+endp: pipes::RecvPacketBuffered, f: fn(+v: Option) -> U) -> U { - f(pipes::try_recv(move endp)) + f(pipes::try_recv(endp)) } // Here's the benchmark @@ -84,10 +84,10 @@ fn bounded(count: uint) { 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; @@ -96,10 +96,10 @@ fn bounded(count: uint) { 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; @@ -111,10 +111,10 @@ fn unbounded(count: uint) { 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; @@ -123,10 +123,10 @@ fn unbounded(count: uint) { 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; diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 27111ff3b6d45..b42ec246ccb97 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -156,7 +156,7 @@ fn rendezvous(nn: uint, set: ~[color]) { 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()); } diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 3afb86210e1b8..b1b169752122e 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -128,7 +128,7 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>, _ => { ~"" } }; - to_parent.send(move buffer); + to_parent.send(buffer); } // given a FASTA file on stdin, process sequence THREE @@ -149,23 +149,23 @@ fn main() { // 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 }); diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index 76a7688777218..5ab9b068d0b0e 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -172,7 +172,7 @@ fn main() { 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); } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index ac695421059c7..2c9da65cc13ac 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -43,15 +43,15 @@ fn fib(n: int) -> int { } 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() } @@ -86,7 +86,7 @@ fn stress(num_tasks: int) { 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); } diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 5f0530871fc83..b4b02c3aaa8d4 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -99,6 +99,6 @@ fn recurse_or_fail(depth: int, st: Option) { } }; - recurse_or_fail(depth, Some(move st)); + recurse_or_fail(depth, Some(st)); } } diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index 06f4213ee7b93..f2441755a7b1d 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -19,14 +19,14 @@ fn child_generation(gens_left: uint, -c: pipes::Chan<()>) { // 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(()) } @@ -44,7 +44,7 @@ fn main() { }; 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"); } diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs index 4a6195b1ae89c..3b6ececaef90a 100644 --- a/src/test/bench/task-perf-linked-failure.rs +++ b/src/test/bench/task-perf-linked-failure.rs @@ -46,9 +46,9 @@ fn grandchild_group(num_tasks: uint) { 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; } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs index 298e5d53c9401..e9bc4a5e195d7 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs @@ -18,8 +18,8 @@ impl Drop for X { 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!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs index 162a10a370b78..6548adddf1956 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs @@ -18,8 +18,8 @@ impl Drop for X { 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!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs index 1aed491bbf069..aaa9d9f920a6a 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs @@ -20,8 +20,8 @@ enum double_option { some2(T,U), none2 } 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!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs index 9c879e297090f..b5686b64c810b 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs @@ -18,8 +18,8 @@ impl Drop for X { 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!() } } diff --git a/src/test/compile-fail/bind-by-move-no-guards.rs b/src/test/compile-fail/bind-by-move-no-guards.rs index 82f4d57911b4c..40a444df12d36 100644 --- a/src/test/compile-fail/bind-by-move-no-guards.rs +++ b/src/test/compile-fail/bind-by-move-no-guards.rs @@ -12,9 +12,9 @@ fn main() { 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!() } } diff --git a/src/test/compile-fail/bind-by-move-no-lvalues-1.rs b/src/test/compile-fail/bind-by-move-no-lvalues-1.rs index 586285d956691..c8537afa1905e 100644 --- a/src/test/compile-fail/bind-by-move-no-lvalues-1.rs +++ b/src/test/compile-fail/bind-by-move-no-lvalues-1.rs @@ -21,7 +21,7 @@ impl Drop for X { 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!() } } diff --git a/src/test/compile-fail/bind-by-move-no-lvalues-2.rs b/src/test/compile-fail/bind-by-move-no-lvalues-2.rs index 9ed48fe33e319..26b1084c09172 100644 --- a/src/test/compile-fail/bind-by-move-no-lvalues-2.rs +++ b/src/test/compile-fail/bind-by-move-no-lvalues-2.rs @@ -23,7 +23,7 @@ struct Y { y: Option } 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!() } } diff --git a/src/test/compile-fail/bind-by-move-no-sub-bindings.rs b/src/test/compile-fail/bind-by-move-no-sub-bindings.rs index d60ef84f04024..c86158be5ea7f 100644 --- a/src/test/compile-fail/bind-by-move-no-sub-bindings.rs +++ b/src/test/compile-fail/bind-by-move-no-sub-bindings.rs @@ -18,8 +18,8 @@ impl Drop for X { 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!() } } diff --git a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs index 0b9375bc543a1..7b6484fd4aadb 100644 --- a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs +++ b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs @@ -20,6 +20,6 @@ impl Add for foo { 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 } diff --git a/src/test/compile-fail/borrowck-move-from-unsafe-ptr.rs b/src/test/compile-fail/borrowck-move-from-unsafe-ptr.rs index 7154683565960..8f332646bbccd 100644 --- a/src/test/compile-fail/borrowck-move-from-unsafe-ptr.rs +++ b/src/test/compile-fail/borrowck-move-from-unsafe-ptr.rs @@ -9,7 +9,7 @@ // 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; } diff --git a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs index deebff5f43a3c..cec81d8a6ef5b 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs @@ -4,7 +4,7 @@ fn a() -> &[int] { [_a, ..tail] => tail, _ => fail!(~"foo") }; - move tail + tail } fn main() { diff --git a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs index e1ed0f0daa1e8..714a80def9358 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs @@ -4,7 +4,7 @@ fn a() -> &int { [_a, ..tail] => &tail[0], _ => fail!(~"foo") }; - move tail + tail } fn main() { diff --git a/src/test/compile-fail/copy-a-resource.rs b/src/test/compile-fail/copy-a-resource.rs index 95fd9b938f07b..f1b31d66b3f68 100644 --- a/src/test/compile-fail/copy-a-resource.rs +++ b/src/test/compile-fail/copy-a-resource.rs @@ -23,7 +23,7 @@ fn foo(i:int) -> foo { } 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); diff --git a/src/test/compile-fail/issue-2548.rs b/src/test/compile-fail/issue-2548.rs index abc734697191f..951944e24857f 100644 --- a/src/test/compile-fail/issue-2548.rs +++ b/src/test/compile-fail/issue-2548.rs @@ -34,7 +34,7 @@ fn main() { 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); } diff --git a/src/test/compile-fail/issue-3177-mutable-struct.rs b/src/test/compile-fail/issue-3177-mutable-struct.rs index 8a65366d2cb43..a71826c629b6c 100644 --- a/src/test/compile-fail/issue-3177-mutable-struct.rs +++ b/src/test/compile-fail/issue-3177-mutable-struct.rs @@ -17,5 +17,5 @@ struct S { fn main() { let a1 = ~S{ s: true, cant_nest: () }; - let _a2 = ~S{ s: move a1, cant_nest: () }; + let _a2 = ~S{ s: a1, cant_nest: () }; } diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs index a513e367fe5bc..c88dae232fa06 100644 --- a/src/test/compile-fail/kindck-nonsendable-1.rs +++ b/src/test/compile-fail/kindck-nonsendable-1.rs @@ -14,5 +14,5 @@ fn main() { 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` } diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index b5157c669a73a..970abf4fd94b0 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -68,5 +68,5 @@ impl Drop for r { 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 } diff --git a/src/test/compile-fail/noncopyable-class.rs b/src/test/compile-fail/noncopyable-class.rs index 115120ff37263..42bad88633cff 100644 --- a/src/test/compile-fail/noncopyable-class.rs +++ b/src/test/compile-fail/noncopyable-class.rs @@ -37,7 +37,7 @@ fn foo(i:int) -> foo { } 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); } diff --git a/src/test/compile-fail/unique-pinned-nocopy.rs b/src/test/compile-fail/unique-pinned-nocopy.rs index 1eebc7701328c..12eef71f38bb3 100644 --- a/src/test/compile-fail/unique-pinned-nocopy.rs +++ b/src/test/compile-fail/unique-pinned-nocopy.rs @@ -17,7 +17,7 @@ impl Drop for r { } 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); } diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index 25c42ab4adde5..d36b53eb2ee71 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -13,5 +13,5 @@ fn f(_i: T) { fn main() { let i = ~@100; - f(move i); //~ ERROR does not fulfill `Owned` + f(i); //~ ERROR does not fulfill `Owned` } diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index 28a7b37d6e20b..4ff9dd6f9914e 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -24,8 +24,8 @@ fn f(+_i: ~[T], +_j: ~[T]) { 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 diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index e660884e40b9e..8e9ce5f97fc1d 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -26,5 +26,5 @@ fn foo(i:int, j: @~str) -> foo { 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` } diff --git a/src/test/compile-fail/vec-res-add.rs b/src/test/compile-fail/vec-res-add.rs index f21a202dcd82b..b06f91d50f25c 100644 --- a/src/test/compile-fail/vec-res-add.rs +++ b/src/test/compile-fail/vec-res-add.rs @@ -22,8 +22,8 @@ impl Drop for r { 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); } diff --git a/src/test/run-fail/out-of-stack-managed-box.rs b/src/test/run-fail/out-of-stack-managed-box.rs index 85857486cbbb7..9dcdaacb3c1a4 100644 --- a/src/test/run-fail/out-of-stack-managed-box.rs +++ b/src/test/run-fail/out-of-stack-managed-box.rs @@ -15,11 +15,11 @@ // error-pattern:ran out of stack fn main() { - eat(move @0); + eat(@0); } fn eat( +a: @int ) { - eat(move a) + eat(a) } diff --git a/src/test/run-fail/out-of-stack-owned-box.rs b/src/test/run-fail/out-of-stack-owned-box.rs index ef5101d1a9cd5..d4bc70f43ef6e 100644 --- a/src/test/run-fail/out-of-stack-owned-box.rs +++ b/src/test/run-fail/out-of-stack-owned-box.rs @@ -11,11 +11,11 @@ // xfail-test // error-pattern:ran out of stack fn main() { - eat(move ~0); + eat(~0); } fn eat( +a: ~int ) { - eat(move a) + eat(a) } diff --git a/src/test/run-fail/unwind-box-res.rs b/src/test/run-fail/unwind-box-res.rs index f544438a7cae1..ba8f2fa37cb3b 100644 --- a/src/test/run-fail/unwind-box-res.rs +++ b/src/test/run-fail/unwind-box-res.rs @@ -36,7 +36,7 @@ fn main() { 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); diff --git a/src/test/run-fail/unwind-closure.rs b/src/test/run-fail/unwind-closure.rs index 34257b15b7fd8..6d52046b3e2fe 100644 --- a/src/test/run-fail/unwind-closure.rs +++ b/src/test/run-fail/unwind-closure.rs @@ -16,6 +16,6 @@ fn f(a: @int) { fn main() { let b = @0; - let g : fn@() = |move b|f(b); + let g : fn@() = || f(b); g(); } diff --git a/src/test/run-fail/unwind-move.rs b/src/test/run-fail/unwind-move.rs index 539896e831319..b2d30688ec55d 100644 --- a/src/test/run-fail/unwind-move.rs +++ b/src/test/run-fail/unwind-move.rs @@ -15,5 +15,5 @@ fn f(-_a: @int) { fn main() { let a = @0; - f(move a); + f(a); } diff --git a/src/test/run-fail/unwind-resource-fail.rs b/src/test/run-fail/unwind-resource-fail.rs index 8b9d1a6645714..0d57e9279bc72 100644 --- a/src/test/run-fail/unwind-resource-fail.rs +++ b/src/test/run-fail/unwind-resource-fail.rs @@ -19,5 +19,5 @@ fn r(i: int) -> r { r { i: i } } fn main() { @0; - let r = move r(0); + let r = r(0); } diff --git a/src/test/run-fail/unwind-resource-fail2.rs b/src/test/run-fail/unwind-resource-fail2.rs index 9c2c1a24a5e66..0b33326abe719 100644 --- a/src/test/run-fail/unwind-resource-fail2.rs +++ b/src/test/run-fail/unwind-resource-fail2.rs @@ -20,6 +20,6 @@ fn r(i: int) -> r { r { i: i } } fn main() { @0; - let r = move r(0); + let r = r(0); fail!(); } diff --git a/src/test/run-pass/alt-ref-binding-in-guard-3256.rs b/src/test/run-pass/alt-ref-binding-in-guard-3256.rs index a04d8d4618a27..4474aec3d2e50 100644 --- a/src/test/run-pass/alt-ref-binding-in-guard-3256.rs +++ b/src/test/run-pass/alt-ref-binding-in-guard-3256.rs @@ -10,7 +10,7 @@ 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; } }, diff --git a/src/test/run-pass/argument-passing.rs b/src/test/run-pass/argument-passing.rs index e58dc29578d5f..ba9266b8a30f2 100644 --- a/src/test/run-pass/argument-passing.rs +++ b/src/test/run-pass/argument-passing.rs @@ -24,7 +24,7 @@ fn f2(a: int, f: fn(int)) -> int { f(1); return a; } 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); diff --git a/src/test/run-pass/auto-encode.rs b/src/test/run-pass/auto-encode.rs index 53c572e75d099..d4171ceb70fd2 100644 --- a/src/test/run-pass/auto-encode.rs +++ b/src/test/run-pass/auto-encode.rs @@ -46,7 +46,7 @@ fn test_ebml { impl Pushable for ~[T] { fn push_val(&mut self, +t: T) { - self.push(move t); + self.push(t); } } diff --git a/src/test/run-pass/bind-by-move.rs b/src/test/run-pass/bind-by-move.rs index bdcc629566462..1e836740f8e81 100644 --- a/src/test/run-pass/bind-by-move.rs +++ b/src/test/run-pass/bind-by-move.rs @@ -17,8 +17,8 @@ fn dispose(+_x: arc::ARC) unsafe { } 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!() } } diff --git a/src/test/run-pass/borrowck-move-from-unsafe-ptr-ok.rs b/src/test/run-pass/borrowck-move-from-unsafe-ptr-ok.rs index b54791328a0cb..2d83e9746b580 100644 --- a/src/test/run-pass/borrowck-move-from-unsafe-ptr-ok.rs +++ b/src/test/run-pass/borrowck-move-from-unsafe-ptr-ok.rs @@ -12,7 +12,7 @@ fn bar(x: *~int) -> ~int { unsafe { - let y = move *x; + let y = *x; return y; } } diff --git a/src/test/run-pass/cap-clause-move.rs b/src/test/run-pass/cap-clause-move.rs index dd4c7ba6a85cb..e27434400c185 100644 --- a/src/test/run-pass/cap-clause-move.rs +++ b/src/test/run-pass/cap-clause-move.rs @@ -11,21 +11,21 @@ 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; } diff --git a/src/test/run-pass/class-poly-methods.rs b/src/test/run-pass/class-poly-methods.rs index b7e638f40e8c0..5ef5e55b7293e 100644 --- a/src/test/run-pass/class-poly-methods.rs +++ b/src/test/run-pass/class-poly-methods.rs @@ -26,7 +26,7 @@ fn cat(in_x : uint, in_y : int, -in_info: ~[U]) -> cat { cat { meows: in_x, how_hungry: in_y, - info: move in_info + info: in_info } } diff --git a/src/test/run-pass/dvec-test.rs b/src/test/run-pass/dvec-test.rs index a0c6b666554a3..cb8b1c5f25f27 100644 --- a/src/test/run-pass/dvec-test.rs +++ b/src/test/run-pass/dvec-test.rs @@ -31,6 +31,6 @@ pub fn main() { assert *e == exp[i]; } - let v = dvec::unwrap(move d); + let v = dvec::unwrap(d); assert v == exp; } diff --git a/src/test/run-pass/fn-bare-spawn.rs b/src/test/run-pass/fn-bare-spawn.rs index 163063ab745d5..c875b805ea3ca 100644 --- a/src/test/run-pass/fn-bare-spawn.rs +++ b/src/test/run-pass/fn-bare-spawn.rs @@ -11,7 +11,7 @@ // This is what the signature to spawn should look like with bare functions fn spawn(val: T, f: extern fn(T)) { - f(move val); + f(val); } fn f(+i: int) { diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index d7a285d58e662..6a12704d4b4b5 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -39,7 +39,7 @@ mod map_reduce { 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) ); } } diff --git a/src/test/run-pass/init-res-into-things.rs b/src/test/run-pass/init-res-into-things.rs index 0605fac3677bf..0185b19b48177 100644 --- a/src/test/run-pass/init-res-into-things.rs +++ b/src/test/run-pass/init-res-into-things.rs @@ -32,7 +32,7 @@ fn r(i: @mut int) -> r { fn test_box() { let i = @mut 0; { - let a = move @r(i); + let a = @r(i); } assert *i == 1; } @@ -40,7 +40,7 @@ fn test_box() { fn test_rec() { let i = @mut 0; { - let a = move Box {x: r(i)}; + let a = Box {x: r(i)}; } assert *i == 1; } @@ -52,7 +52,7 @@ fn test_tag() { let i = @mut 0; { - let a = move t0(r(i)); + let a = t0(r(i)); } assert *i == 1; } @@ -60,7 +60,7 @@ fn test_tag() { fn test_tup() { let i = @mut 0; { - let a = move (r(i), 0); + let a = (r(i), 0); } assert *i == 1; } @@ -68,7 +68,7 @@ fn test_tup() { fn test_unique() { let i = @mut 0; { - let a = move ~r(i); + let a = ~r(i); } assert *i == 1; } @@ -76,7 +76,7 @@ fn test_unique() { fn test_box_rec() { let i = @mut 0; { - let a = move @Box { + let a = @Box { x: r(i) }; } diff --git a/src/test/run-pass/intrinsic-move-val.rs b/src/test/run-pass/intrinsic-move-val.rs index b17eb37438a50..9e8e9d8bc15be 100644 --- a/src/test/run-pass/intrinsic-move-val.rs +++ b/src/test/run-pass/intrinsic-move-val.rs @@ -18,7 +18,7 @@ pub fn main() { 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; } } diff --git a/src/test/run-pass/issue-1895.rs b/src/test/run-pass/issue-1895.rs index 3d20eb813d8b5..42c6ae38b6afb 100644 --- a/src/test/run-pass/issue-1895.rs +++ b/src/test/run-pass/issue-1895.rs @@ -10,7 +10,7 @@ pub fn main() { let x = 1; - let y = fn@(move x) -> int { + let y = fn@() -> int { x }(); } diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs index ff35b81aad1f6..f3f7f4dacbad4 100644 --- a/src/test/run-pass/issue-2185.rs +++ b/src/test/run-pass/issue-2185.rs @@ -35,11 +35,11 @@ fn filter>(self: IA, prd: fn@(A) -> bool, blk: fn(A)) { } fn foldl>(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)) { diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 0cae04b60bc74..ba7cf0cc45fbc 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -61,18 +61,18 @@ pub mod pipes { // We should consider moving this to ::core::unsafe, although I // suspect graydon would want us to use void pointers instead. pub unsafe fn uniquify(+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)) } } @@ -80,20 +80,20 @@ pub mod pipes { 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 @@ -113,7 +113,7 @@ pub mod pipes { full => { let mut payload = None; payload <-> (*p).payload; - return Some(option::unwrap(move payload)) + return Some(option::unwrap(payload)) } terminated => { assert old_state == terminated; @@ -128,7 +128,7 @@ pub mod pipes { 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 @@ -145,7 +145,7 @@ pub mod pipes { 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. @@ -166,7 +166,7 @@ pub mod pipes { if self.p != None { let mut p = None; p <-> self.p; - sender_terminate(option::unwrap(move p)) + sender_terminate(option::unwrap(p)) } } } @@ -175,7 +175,7 @@ pub mod pipes { fn unwrap() -> *packet { let mut p = None; p <-> self.p; - option::unwrap(move p) + option::unwrap(p) } } @@ -194,7 +194,7 @@ pub mod pipes { if self.p != None { let mut p = None; p <-> self.p; - receiver_terminate(option::unwrap(move p)) + receiver_terminate(option::unwrap(p)) } } } @@ -203,7 +203,7 @@ pub mod pipes { fn unwrap() -> *packet { let mut p = None; p <-> self.p; - option::unwrap(move p) + option::unwrap(p) } } @@ -231,9 +231,9 @@ pub mod pingpong { let addr : *::pipes::send_packet = 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 } } @@ -242,9 +242,9 @@ pub mod pingpong { let addr : *::pipes::send_packet = 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 } } @@ -262,16 +262,16 @@ pub mod pingpong { 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)), ()) } } @@ -282,32 +282,32 @@ pub mod pingpong { pub type pong = ::pipes::send_packet; 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"); } @@ -319,12 +319,12 @@ pub fn main() { 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_ˊ)); diff --git a/src/test/run-pass/issue-2834.rs b/src/test/run-pass/issue-2834.rs index b78cefe1c95e4..84e0f20e61b11 100644 --- a/src/test/run-pass/issue-2834.rs +++ b/src/test/run-pass/issue-2834.rs @@ -19,7 +19,7 @@ proto! streamp ( fn rendezvous() { let (c, s) = streamp::init(); - let streams: ~[streamp::client::open] = ~[move c]; + let streams: ~[streamp::client::open] = ~[c]; error!("%?", streams[0]); } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index eadfa82619acd..9a726bedbc340 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -60,7 +60,7 @@ fn square_from_char(c: char) -> square { } fn read_board_grid(+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 = ~[]; diff --git a/src/test/run-pass/issue-2930.rs b/src/test/run-pass/issue-2930.rs index 4b6985f057ead..6d22a2ea5edcf 100644 --- a/src/test/run-pass/issue-2930.rs +++ b/src/test/run-pass/issue-2930.rs @@ -17,5 +17,5 @@ proto! stream ( pub fn main() { let (bc, _bp) = stream::init(); - stream::client::send(move bc, ~"abc"); + stream::client::send(bc, ~"abc"); } diff --git a/src/test/run-pass/issue-3168.rs b/src/test/run-pass/issue-3168.rs index 02b147e65fce1..d40bf6e32cf87 100644 --- a/src/test/run-pass/issue-3168.rs +++ b/src/test/run-pass/issue-3168.rs @@ -12,15 +12,15 @@ 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(); diff --git a/src/test/run-pass/issue-3176.rs b/src/test/run-pass/issue-3176.rs index b5f2a1d22a6e5..fac73d07b6642 100644 --- a/src/test/run-pass/issue-3176.rs +++ b/src/test/run-pass/issue-3176.rs @@ -14,19 +14,19 @@ use pipes::{Select2, Selectable}; 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"); diff --git a/src/test/run-pass/issue-3220.rs b/src/test/run-pass/issue-3220.rs index 71c83e02617ff..ef65531e5546f 100644 --- a/src/test/run-pass/issue-3220.rs +++ b/src/test/run-pass/issue-3220.rs @@ -23,5 +23,5 @@ impl thing { fn f(self) {} } pub fn main() { let z = thing(); - (move z).f(); + (z).f(); } diff --git a/src/test/run-pass/issue-3447.rs b/src/test/run-pass/issue-3447.rs index 18b47e2925dd2..0bcc5983eb719 100644 --- a/src/test/run-pass/issue-3447.rs +++ b/src/test/run-pass/issue-3447.rs @@ -20,7 +20,7 @@ impl list{ next: option::None }; - self.next = Some(@(move newList)); + self.next = Some(@(newList)); } } diff --git a/src/test/run-pass/issue-3878.rs b/src/test/run-pass/issue-3878.rs index dd41d696b3a93..a5791e3834351 100644 --- a/src/test/run-pass/issue-3878.rs +++ b/src/test/run-pass/issue-3878.rs @@ -11,5 +11,5 @@ pub fn main() { let y = ~1; - move y; + y; } diff --git a/src/test/run-pass/issue-4016.rs b/src/test/run-pass/issue-4016.rs index 515b342faf3df..307d7974762f7 100644 --- a/src/test/run-pass/issue-4016.rs +++ b/src/test/run-pass/issue-4016.rs @@ -20,7 +20,7 @@ trait JD : Deserializable { } fn exec() { let doc = result::unwrap(json::from_str("")); - let _v: T = deserialize(&json::Deserializer(move doc)); + let _v: T = deserialize(&json::Deserializer(doc)); fail!() } diff --git a/src/test/run-pass/last-use-in-block.rs b/src/test/run-pass/last-use-in-block.rs index 9c04ccdcba0aa..e8083dd3f6b21 100644 --- a/src/test/run-pass/last-use-in-block.rs +++ b/src/test/run-pass/last-use-in-block.rs @@ -13,14 +13,14 @@ fn lp(s: ~str, f: fn(~str) -> T) -> T { while false { let r = f(s); - return (move r); + return (r); } fail!(); } fn apply(s: ~str, f: fn(~str) -> T) -> T { fn g(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() {} diff --git a/src/test/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/last-use-in-cap-clause.rs index e8cb47b373846..2fd2cc9d22b81 100644 --- a/src/test/run-pass/last-use-in-cap-clause.rs +++ b/src/test/run-pass/last-use-in-cap-clause.rs @@ -15,7 +15,7 @@ struct A { a: ~int } 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() { diff --git a/src/test/run-pass/liveness-move-in-loop.rs b/src/test/run-pass/liveness-move-in-loop.rs index f8166e2443d80..8c4b7d57bc201 100644 --- a/src/test/run-pass/liveness-move-in-loop.rs +++ b/src/test/run-pass/liveness-move-in-loop.rs @@ -15,7 +15,7 @@ fn the_loop() { loop { let x = 5; if x > 3 { - list += ~[take(move x)]; + list += ~[take(x)]; } else { break; } diff --git a/src/test/run-pass/log-linearized.rs b/src/test/run-pass/log-linearized.rs index db0b24fca1d2d..152dcb3d4a7a7 100644 --- a/src/test/run-pass/log-linearized.rs +++ b/src/test/run-pass/log-linearized.rs @@ -21,7 +21,7 @@ struct V { v: ~[option] } fn mk() -> @Smallintmap { let mut v: ~[option] = ~[]; - return @Smallintmap {mut v: move v}; + return @Smallintmap {mut v: v}; } fn f() { diff --git a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs index 57f7a3f24db21..b5af07207bccd 100644 --- a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs +++ b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs @@ -25,7 +25,7 @@ struct F { a: A } impl Serializable for F { fn serialize(s: S) { - self.a.serialize(move s); + self.a.serialize(s); } } diff --git a/src/test/run-pass/move-1-unique.rs b/src/test/run-pass/move-1-unique.rs index 380c969fa1c7d..45ba5eb974811 100644 --- a/src/test/run-pass/move-1-unique.rs +++ b/src/test/run-pass/move-1-unique.rs @@ -13,7 +13,7 @@ struct Triple { x: int, y: int, z: int } 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; } diff --git a/src/test/run-pass/move-1.rs b/src/test/run-pass/move-1.rs index ea6dc94bb8ef4..35cbe6e080cc8 100644 --- a/src/test/run-pass/move-1.rs +++ b/src/test/run-pass/move-1.rs @@ -13,7 +13,7 @@ struct Triple { x: int, y: int, z: int } 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; } diff --git a/src/test/run-pass/move-2-unique.rs b/src/test/run-pass/move-2-unique.rs index 133837089b8a3..bc3b5405f1867 100644 --- a/src/test/run-pass/move-2-unique.rs +++ b/src/test/run-pass/move-2-unique.rs @@ -11,4 +11,4 @@ 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); } diff --git a/src/test/run-pass/move-2.rs b/src/test/run-pass/move-2.rs index f2b534765cf51..23ec3a178c15a 100644 --- a/src/test/run-pass/move-2.rs +++ b/src/test/run-pass/move-2.rs @@ -11,4 +11,4 @@ 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); } diff --git a/src/test/run-pass/move-3-unique.rs b/src/test/run-pass/move-3-unique.rs index 40d8f9a9bcef7..82b8d2c960921 100644 --- a/src/test/run-pass/move-3-unique.rs +++ b/src/test/run-pass/move-3-unique.rs @@ -15,7 +15,7 @@ struct Triple { x: int, y: int, z: int } 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; } diff --git a/src/test/run-pass/move-3.rs b/src/test/run-pass/move-3.rs index 0e57d0f612689..161dc55f8a34b 100644 --- a/src/test/run-pass/move-3.rs +++ b/src/test/run-pass/move-3.rs @@ -15,7 +15,7 @@ struct Triple { x: int, y: int, z: int } 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; } diff --git a/src/test/run-pass/move-4-unique.rs b/src/test/run-pass/move-4-unique.rs index 7b7b816aeb2ab..8845bdfffe146 100644 --- a/src/test/run-pass/move-4-unique.rs +++ b/src/test/run-pass/move-4-unique.rs @@ -14,9 +14,9 @@ struct Triple {a: int, b: int, c: int} 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; } diff --git a/src/test/run-pass/move-4.rs b/src/test/run-pass/move-4.rs index cdb48b43b35ba..1a5432620d308 100644 --- a/src/test/run-pass/move-4.rs +++ b/src/test/run-pass/move-4.rs @@ -15,9 +15,9 @@ struct Triple { a: int, b: int, c: int } 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; } diff --git a/src/test/run-pass/move-arg-2-unique.rs b/src/test/run-pass/move-arg-2-unique.rs index e6a3670804bae..21969418c3451 100644 --- a/src/test/run-pass/move-arg-2-unique.rs +++ b/src/test/run-pass/move-arg-2-unique.rs @@ -13,7 +13,7 @@ fn test(-foo: ~~[int]) { assert (foo[0] == 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]); diff --git a/src/test/run-pass/move-arg-2.rs b/src/test/run-pass/move-arg-2.rs index 09dc47ab50e00..8c843d2da682f 100644 --- a/src/test/run-pass/move-arg-2.rs +++ b/src/test/run-pass/move-arg-2.rs @@ -13,7 +13,7 @@ fn test(-foo: @~[int]) { assert (foo[0] == 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]); diff --git a/src/test/run-pass/move-arg.rs b/src/test/run-pass/move-arg.rs index 8e65981ebdf1c..570fa6ee39166 100644 --- a/src/test/run-pass/move-arg.rs +++ b/src/test/run-pass/move-arg.rs @@ -10,4 +10,4 @@ fn test(-foo: int) { assert (foo == 10); } -pub fn main() { let x = 10; test(move x); } +pub fn main() { let x = 10; test(x); } diff --git a/src/test/run-pass/move-nullary-fn.rs b/src/test/run-pass/move-nullary-fn.rs index 0aac8857c598d..0114eeefbfb2d 100644 --- a/src/test/run-pass/move-nullary-fn.rs +++ b/src/test/run-pass/move-nullary-fn.rs @@ -12,7 +12,7 @@ fn f2(-thing: fn@()) { } fn f(-thing: fn@()) { - f2(move thing); + f2(thing); } pub fn main() { diff --git a/src/test/run-pass/move-scalar.rs b/src/test/run-pass/move-scalar.rs index 533543ad138cc..a7ddc4e4cdbe2 100644 --- a/src/test/run-pass/move-scalar.rs +++ b/src/test/run-pass/move-scalar.rs @@ -12,6 +12,6 @@ pub fn main() { let y: int = 42; let mut x: int; - x = move y; + x = y; assert (x == 42); } diff --git a/src/test/run-pass/move-self.rs b/src/test/run-pass/move-self.rs index 170dd520ed6f4..37ce1bce9e659 100644 --- a/src/test/run-pass/move-self.rs +++ b/src/test/run-pass/move-self.rs @@ -4,7 +4,7 @@ struct S { impl S { fn foo(self) { - (move self).bar(); + self.bar(); } fn bar(self) { diff --git a/src/test/run-pass/non-legacy-modes.rs b/src/test/run-pass/non-legacy-modes.rs index 6db971121b758..2a1f94a1d8cdf 100644 --- a/src/test/run-pass/non-legacy-modes.rs +++ b/src/test/run-pass/non-legacy-modes.rs @@ -13,7 +13,7 @@ struct X { } fn apply(x: T, f: fn(T)) { - f(move x); + f(x); } fn check_int(x: int) { diff --git a/src/test/run-pass/option-unwrap.rs b/src/test/run-pass/option-unwrap.rs index 9f787c915e59d..7616ff5007eee 100644 --- a/src/test/run-pass/option-unwrap.rs +++ b/src/test/run-pass/option-unwrap.rs @@ -21,8 +21,8 @@ impl Drop for dtor { } fn unwrap(+o: Option) -> T { - match move o { - Some(move v) => move v, + match o { + Some(v) => v, None => fail!() } } @@ -32,7 +32,7 @@ pub fn main() { { let b = Some(dtor { x:x }); - let c = unwrap(move b); + let c = unwrap(b); } assert *x == 0; diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index d79160a41c44a..bc218e71ede9b 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -44,21 +44,21 @@ proto! bank ( ) 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(+endp: pipes::RecvPacket, f: fn(+v: Option) -> U) -> U { - f(pipes::try_recv(move endp)) + f(pipes::try_recv(endp)) } -fn move_it(-x: T) -> T { move x } +fn move_it(-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 })+ @@ -70,15 +70,15 @@ macro_rules! follow ( 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!"); } @@ -91,8 +91,8 @@ fn client_follow(+bank: bank::client::login) { 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) } @@ -100,9 +100,9 @@ fn bank_client(+bank: bank::client::login) { 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!"); } diff --git a/src/test/run-pass/pipe-detect-term.rs b/src/test/run-pass/pipe-detect-term.rs index 6831170734d14..2d76542398841 100644 --- a/src/test/run-pass/pipe-detect-term.rs +++ b/src/test/run-pass/pipe-detect-term.rs @@ -32,7 +32,7 @@ pub fn main() { let iotask = &uv::global_loop::get(); pipes::spawn_service(oneshot::init, |p| { - match try_recv(move p) { + match try_recv(p) { Some(*) => { fail!() } None => { } } @@ -47,11 +47,11 @@ pub fn main() { 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() } } diff --git a/src/test/run-pass/pipe-peek.rs b/src/test/run-pass/pipe-peek.rs index 7dc1feb24179b..baa5ba5bf00a8 100644 --- a/src/test/run-pass/pipe-peek.rs +++ b/src/test/run-pass/pipe-peek.rs @@ -27,7 +27,7 @@ pub fn main() { assert !pipes::peek(&p); - oneshot::client::signal(move c); + oneshot::client::signal(c); assert pipes::peek(&p); } diff --git a/src/test/run-pass/pipe-pingpong-bounded.rs b/src/test/run-pass/pipe-pingpong-bounded.rs index a3b03daf02fbf..b13b262e8645e 100644 --- a/src/test/run-pass/pipe-pingpong-bounded.rs +++ b/src/test/run-pass/pipe-pingpong-bounded.rs @@ -36,7 +36,7 @@ mod pingpong { pong: mk_packet::() } }; - 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)) @@ -53,9 +53,9 @@ mod pingpong { 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, @@ -74,9 +74,9 @@ mod pingpong { 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, @@ -91,34 +91,34 @@ mod test { 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_ˊ)); }; } diff --git a/src/test/run-pass/pipe-pingpong-proto.rs b/src/test/run-pass/pipe-pingpong-proto.rs index 97afbba42c5b5..0d71a2c37d162 100644 --- a/src/test/run-pass/pipe-pingpong-proto.rs +++ b/src/test/run-pass/pipe-pingpong-proto.rs @@ -33,35 +33,35 @@ mod test { 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_ˊ)); }; } diff --git a/src/test/run-pass/pipe-presentation-examples.rs b/src/test/run-pass/pipe-presentation-examples.rs index 401c32b67f9d4..5fd1bb276c1e8 100644 --- a/src/test/run-pass/pipe-presentation-examples.rs +++ b/src/test/run-pass/pipe-presentation-examples.rs @@ -34,10 +34,10 @@ macro_rules! select_if ( ], )* } => { 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!() } @@ -105,33 +105,33 @@ fn render(_buffer: &Buffer) { } 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) } } ); @@ -152,7 +152,7 @@ fn draw_two_frames_bad1(+channel: double_buffer::client::acquire) { channel => { give_buffer(buffer) -> channel { render(&buffer); - release(channel, move buffer) + release(channel, buffer) } } ); @@ -165,9 +165,9 @@ fn draw_two_frames_bad2(+channel: double_buffer::client::acquire) { channel => { give_buffer(buffer) -> channel { render(&buffer); - release(channel, move buffer); + release(channel, buffer); render(&buffer); - release(channel, move buffer); + release(channel, buffer); } } ); diff --git a/src/test/run-pass/pipe-select.rs b/src/test/run-pass/pipe-select.rs index 62765d71398fc..0bf739139cfe1 100644 --- a/src/test/run-pass/pipe-select.rs +++ b/src/test/run-pass/pipe-select.rs @@ -41,24 +41,24 @@ pub fn main() { 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; @@ -68,20 +68,20 @@ pub fn main() { 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(); } @@ -90,26 +90,26 @@ fn 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); } diff --git a/src/test/run-pass/pipe-sleep.rs b/src/test/run-pass/pipe-sleep.rs index ac4829a9c19ad..521c400489e95 100644 --- a/src/test/run-pass/pipe-sleep.rs +++ b/src/test/run-pass/pipe-sleep.rs @@ -26,10 +26,10 @@ proto! oneshot ( 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); } diff --git a/src/test/run-pass/regions-copy-closure.rs b/src/test/run-pass/regions-copy-closure.rs index bfb4ac5f60c99..ff3e115eda9b0 100644 --- a/src/test/run-pass/regions-copy-closure.rs +++ b/src/test/run-pass/regions-copy-closure.rs @@ -13,7 +13,7 @@ struct closure_box { } fn box_it(+x: &r/fn()) -> closure_box/&r { - closure_box {cl: move x} + closure_box {cl: x} } pub fn main() { diff --git a/src/test/run-pass/regions-static-closure.rs b/src/test/run-pass/regions-static-closure.rs index 8b7fbfd3758c0..00f5e695475a2 100644 --- a/src/test/run-pass/regions-static-closure.rs +++ b/src/test/run-pass/regions-static-closure.rs @@ -13,7 +13,7 @@ struct closure_box { } 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) { @@ -22,5 +22,5 @@ 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); } diff --git a/src/test/run-pass/resource-assign-is-not-copy.rs b/src/test/run-pass/resource-assign-is-not-copy.rs index ee28c96defcad..af3c92db8f6a1 100644 --- a/src/test/run-pass/resource-assign-is-not-copy.rs +++ b/src/test/run-pass/resource-assign-is-not-copy.rs @@ -29,8 +29,8 @@ pub fn main() { // 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; diff --git a/src/test/run-pass/resource-cycle.rs b/src/test/run-pass/resource-cycle.rs index fb9a1e8117a5b..d47d56b6021b3 100644 --- a/src/test/run-pass/resource-cycle.rs +++ b/src/test/run-pass/resource-cycle.rs @@ -45,10 +45,10 @@ pub fn main() { 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, @@ -56,7 +56,7 @@ pub fn main() { 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", @@ -69,7 +69,7 @@ pub fn main() { let rs = r(i2p); debug!("r2 = %x", cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&rs))); - move rs + rs } }); diff --git a/src/test/run-pass/resource-cycle2.rs b/src/test/run-pass/resource-cycle2.rs index eea5c43bb9955..1b39093c7d05c 100644 --- a/src/test/run-pass/resource-cycle2.rs +++ b/src/test/run-pass/resource-cycle2.rs @@ -45,10 +45,10 @@ pub fn main() { 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}; diff --git a/src/test/run-pass/resource-cycle3.rs b/src/test/run-pass/resource-cycle3.rs index 544d82e799544..036ca2496698c 100644 --- a/src/test/run-pass/resource-cycle3.rs +++ b/src/test/run-pass/resource-cycle3.rs @@ -54,10 +54,10 @@ pub fn main() { 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}; diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs index 7b5456e21898c..3dc4ca7bd61dc 100644 --- a/src/test/run-pass/resource-destruct.rs +++ b/src/test/run-pass/resource-destruct.rs @@ -30,7 +30,7 @@ fn shrinky_pointer(i: @@mut int) -> shrinky_pointer { 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); } diff --git a/src/test/run-pass/resource-generic.rs b/src/test/run-pass/resource-generic.rs index 17ce27fa60ad1..eb25f20607f41 100644 --- a/src/test/run-pass/resource-generic.rs +++ b/src/test/run-pass/resource-generic.rs @@ -33,6 +33,6 @@ pub fn main() { 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); } diff --git a/src/test/run-pass/rt-sched-1.rs b/src/test/run-pass/rt-sched-1.rs index badd9632cc8a3..cefed420546ea 100644 --- a/src/test/run-pass/rt-sched-1.rs +++ b/src/test/run-pass/rt-sched-1.rs @@ -46,7 +46,7 @@ pub fn main() { }; 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(); } } diff --git a/src/test/run-pass/select-macro.rs b/src/test/run-pass/select-macro.rs index 45df9cfa610c9..d576875be10d8 100644 --- a/src/test/run-pass/select-macro.rs +++ b/src/test/run-pass/select-macro.rs @@ -27,18 +27,18 @@ macro_rules! select_if ( $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!() } @@ -48,7 +48,7 @@ macro_rules! select_if ( $count + 1 $(, $ports => [ $(type_this $messages$(($(x $xs),+))dont_type_this* - -> $nexts => { move $es }),+ + -> $nexts => { $es }),+ ])* ) } @@ -64,7 +64,7 @@ macro_rules! select ( } => { 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 }),+ ])+) } ) diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs index d86dc4d56d7dd..fce0889e0a9b8 100644 --- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs @@ -20,7 +20,7 @@ fn test05() { 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); }); } diff --git a/src/test/run-pass/static-method-test.rs b/src/test/run-pass/static-method-test.rs index 3402da6c55c9d..da79bf53fe06c 100644 --- a/src/test/run-pass/static-method-test.rs +++ b/src/test/run-pass/static-method-test.rs @@ -23,13 +23,13 @@ fn andand(x1: T, x2: T) -> T { impl bool_like for bool { static fn select(&&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(&&b: int, +x1: A, +x2: A) -> A { - if b != 0 { move x1 } else { move x2 } + if b != 0 { x1 } else { x2 } } } diff --git a/src/test/run-pass/task-comm-0.rs b/src/test/run-pass/task-comm-0.rs index b66f295e1bad8..aa8a2a9146cbc 100644 --- a/src/test/run-pass/task-comm-0.rs +++ b/src/test/run-pass/task-comm-0.rs @@ -29,7 +29,7 @@ fn test05_start(ch : Chan) { 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(); diff --git a/src/test/run-pass/task-comm-10.rs b/src/test/run-pass/task-comm-10.rs index a5d55fd823bcf..289a728efc39a 100644 --- a/src/test/run-pass/task-comm-10.rs +++ b/src/test/run-pass/task-comm-10.rs @@ -15,7 +15,7 @@ extern mod std; fn start(c: pipes::Chan>) { let (p, ch) = pipes::stream(); - c.send(move ch); + c.send(ch); let mut a; let mut b; @@ -24,12 +24,12 @@ fn start(c: pipes::Chan>) { 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"); diff --git a/src/test/run-pass/task-comm-11.rs b/src/test/run-pass/task-comm-11.rs index 498b0b7423868..996566abcd89f 100644 --- a/src/test/run-pass/task-comm-11.rs +++ b/src/test/run-pass/task-comm-11.rs @@ -15,11 +15,11 @@ extern mod std; fn start(c: pipes::Chan>) { 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(); } diff --git a/src/test/run-pass/task-comm-12.rs b/src/test/run-pass/task-comm-12.rs index d32e9454f533b..9f23ab1c9dfa6 100644 --- a/src/test/run-pass/task-comm-12.rs +++ b/src/test/run-pass/task-comm-12.rs @@ -17,7 +17,7 @@ fn start(&&task_number: int) { debug!("Started / Finished task."); } 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) } @@ -29,7 +29,7 @@ fn test00() { } // Try joining tasks that have already finished. - option::unwrap(move result).recv(); + option::unwrap(result).recv(); debug!("Joined task."); } diff --git a/src/test/run-pass/task-comm-13.rs b/src/test/run-pass/task-comm-13.rs index c52facf230be9..4ee23ec54d6cb 100644 --- a/src/test/run-pass/task-comm-13.rs +++ b/src/test/run-pass/task-comm-13.rs @@ -22,6 +22,6 @@ fn start(c: pipes::Chan, start: int, number_of_messages: int) { 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"); } diff --git a/src/test/run-pass/task-comm-14.rs b/src/test/run-pass/task-comm-14.rs index dbf8c03493550..f32fbdd04e62e 100644 --- a/src/test/run-pass/task-comm-14.rs +++ b/src/test/run-pass/task-comm-14.rs @@ -19,8 +19,8 @@ pub fn main() { 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; } diff --git a/src/test/run-pass/task-comm-15.rs b/src/test/run-pass/task-comm-15.rs index c65e10d36b7e6..957066005acda 100644 --- a/src/test/run-pass/task-comm-15.rs +++ b/src/test/run-pass/task-comm-15.rs @@ -28,6 +28,6 @@ pub fn main() { // 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(); } diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index afc9290b62db7..648a54d190fa4 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -100,7 +100,7 @@ fn test_tag() { 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? diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index 97280d37c6384..372a0ea434b58 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -44,10 +44,10 @@ fn test00() { 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; } diff --git a/src/test/run-pass/task-comm-7.rs b/src/test/run-pass/task-comm-7.rs index 5ebd191944b61..481df2d1d529b 100644 --- a/src/test/run-pass/task-comm-7.rs +++ b/src/test/run-pass/task-comm-7.rs @@ -27,19 +27,19 @@ fn test00() { 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); } diff --git a/src/test/run-pass/task-comm-9.rs b/src/test/run-pass/task-comm-9.rs index ac259e7f7855b..d3ed48f757523 100644 --- a/src/test/run-pass/task-comm-9.rs +++ b/src/test/run-pass/task-comm-9.rs @@ -28,8 +28,8 @@ fn test00() { 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); } @@ -40,7 +40,7 @@ fn test00() { i += 1; } - option::unwrap(move result).recv(); + option::unwrap(result).recv(); assert (sum == number_of_messages * (number_of_messages - 1) / 2); } diff --git a/src/test/run-pass/trait-default-method-bound-subst.rs b/src/test/run-pass/trait-default-method-bound-subst.rs index 3f69a2e5d909b..5468970ecf555 100644 --- a/src/test/run-pass/trait-default-method-bound-subst.rs +++ b/src/test/run-pass/trait-default-method-bound-subst.rs @@ -11,13 +11,13 @@ // xfail-test trait A { - fn g(x: T, y: U) -> (T, U) { (move x, move y) } + fn g(x: T, y: U) -> (T, U) { (x, y) } } impl A for int { } fn f>(i: V, j: T, k: U) -> (T, U) { - i.g(move j, move k) + i.g(j, k) } fn main () { diff --git a/src/test/run-pass/trait-default-method-bound-subst2.rs b/src/test/run-pass/trait-default-method-bound-subst2.rs index fcb9f60d762c8..71f4165db9d64 100644 --- a/src/test/run-pass/trait-default-method-bound-subst2.rs +++ b/src/test/run-pass/trait-default-method-bound-subst2.rs @@ -11,13 +11,13 @@ // xfail-test trait A { - fn g(x: T) -> T { move x } + fn g(x: T) -> T { x } } impl A for int { } fn f>(i: V, j: T) -> T { - i.g(move j) + i.g(j) } fn main () { diff --git a/src/test/run-pass/trait-default-method-bound-subst3.rs b/src/test/run-pass/trait-default-method-bound-subst3.rs index c89d4abe3dae7..f27bd7c0a7bf9 100644 --- a/src/test/run-pass/trait-default-method-bound-subst3.rs +++ b/src/test/run-pass/trait-default-method-bound-subst3.rs @@ -11,13 +11,13 @@ #[allow(default_methods)]; trait A { - fn g(x: T, y: T) -> (T, T) { (move x, move y) } + fn g(x: T, y: T) -> (T, T) { (x, y) } } impl A for int { } fn f(i: V, j: T, k: T) -> (T, T) { - i.g(move j, move k) + i.g(j, k) } fn main () { diff --git a/src/test/run-pass/trait-default-method-bound-subst4.rs b/src/test/run-pass/trait-default-method-bound-subst4.rs index 7a6dfa33a1ac4..8ea5341795164 100644 --- a/src/test/run-pass/trait-default-method-bound-subst4.rs +++ b/src/test/run-pass/trait-default-method-bound-subst4.rs @@ -11,13 +11,13 @@ #[allow(default_methods)]; trait A { - fn g(x: uint) -> uint { move x } + fn g(x: uint) -> uint { x } } impl A for int { } fn f>(i: V, j: uint) -> uint { - i.g(move j) + i.g(j) } fn main () { diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index 62f4ef89d693d..b3ebc2ba820aa 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -40,7 +40,7 @@ pub fn main() { assert indirect(~[10, 20]) == ~"[10, 20]!"; fn indirect2(x: T) -> ~str { - indirect(move x) + indirect(x) } assert indirect2(~[1]) == ~"[1]!"; } diff --git a/src/test/run-pass/unique-decl-move-temp.rs b/src/test/run-pass/unique-decl-move-temp.rs index fd4f428bd9d7a..96e91093d37a2 100644 --- a/src/test/run-pass/unique-decl-move-temp.rs +++ b/src/test/run-pass/unique-decl-move-temp.rs @@ -9,6 +9,6 @@ // except according to those terms. pub fn main() { - let i = move ~100; + let i = ~100; assert *i == 100; } diff --git a/src/test/run-pass/unique-decl-move.rs b/src/test/run-pass/unique-decl-move.rs index 27600c04e22f9..7723eafc035ee 100644 --- a/src/test/run-pass/unique-decl-move.rs +++ b/src/test/run-pass/unique-decl-move.rs @@ -10,6 +10,6 @@ pub fn main() { let i = ~100; - let j = move i; + let j = i; assert *j == 100; } diff --git a/src/test/run-pass/unique-fn-arg-move.rs b/src/test/run-pass/unique-fn-arg-move.rs index 61cee457b0cf0..12e9820361d77 100644 --- a/src/test/run-pass/unique-fn-arg-move.rs +++ b/src/test/run-pass/unique-fn-arg-move.rs @@ -14,5 +14,5 @@ fn f(-i: ~int) { pub fn main() { let i = ~100; - f(move i); + f(i); } diff --git a/src/test/run-pass/unique-move-drop.rs b/src/test/run-pass/unique-move-drop.rs index fd86d5aa6fefa..5988a3e8658dc 100644 --- a/src/test/run-pass/unique-move-drop.rs +++ b/src/test/run-pass/unique-move-drop.rs @@ -11,6 +11,6 @@ pub fn main() { let i = ~100; let j = ~200; - let j = move i; + let j = i; assert *j == 100; } diff --git a/src/test/run-pass/unique-move-temp.rs b/src/test/run-pass/unique-move-temp.rs index eaa8a1cf7bd40..08a496987c0a6 100644 --- a/src/test/run-pass/unique-move-temp.rs +++ b/src/test/run-pass/unique-move-temp.rs @@ -10,6 +10,6 @@ pub fn main() { let mut i; - i = move ~100; + i = ~100; assert *i == 100; } diff --git a/src/test/run-pass/unique-move.rs b/src/test/run-pass/unique-move.rs index be0426edbe2e4..5e778d581d340 100644 --- a/src/test/run-pass/unique-move.rs +++ b/src/test/run-pass/unique-move.rs @@ -11,6 +11,6 @@ pub fn main() { let i = ~100; let mut j; - j = move i; + j = i; assert *j == 100; } diff --git a/src/test/run-pass/unreachable-code-1.rs b/src/test/run-pass/unreachable-code-1.rs index 8e900aa7ff3c4..9c658fdc25276 100644 --- a/src/test/run-pass/unreachable-code-1.rs +++ b/src/test/run-pass/unreachable-code-1.rs @@ -12,7 +12,7 @@ fn id(x: bool) -> bool { x } fn call_id() { - let c = move fail!(); + let c = fail!(); id(c); //~ WARNING unreachable statement } diff --git a/src/test/run-pass/unreachable-code.rs b/src/test/run-pass/unreachable-code.rs index 75b2bf090ba65..fa93dfd0fe135 100644 --- a/src/test/run-pass/unreachable-code.rs +++ b/src/test/run-pass/unreachable-code.rs @@ -12,7 +12,7 @@ fn id(x: bool) -> bool { x } fn call_id() { - let c = move fail!(); + let c = fail!(); id(c); } diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index 8f3a6f91d173f..665abe23ee893 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -10,6 +10,6 @@ pub fn main() { let x = ~1; - let lam_move = fn@(move x) { }; + let lam_move = fn@() { }; lam_move(); } diff --git a/src/test/run-pass/unused-move.rs b/src/test/run-pass/unused-move.rs index 785eb691459d6..69ce791c1a35a 100644 --- a/src/test/run-pass/unused-move.rs +++ b/src/test/run-pass/unused-move.rs @@ -15,5 +15,5 @@ pub fn main() { let y = ~1; - move y; + y; } diff --git a/src/test/run-pass/unwind-resource.rs b/src/test/run-pass/unwind-resource.rs index 62673fc134d19..93f1c7b5b4509 100644 --- a/src/test/run-pass/unwind-resource.rs +++ b/src/test/run-pass/unwind-resource.rs @@ -33,7 +33,7 @@ fn complainer(c: SharedChan) -> complainer { } fn f(c: SharedChan) { - let _c = move complainer(c); + let _c = complainer(c); fail!(); } diff --git a/src/test/run-pass/unwind-resource2.rs b/src/test/run-pass/unwind-resource2.rs index 967ed727aa535..75ce797cfc842 100644 --- a/src/test/run-pass/unwind-resource2.rs +++ b/src/test/run-pass/unwind-resource2.rs @@ -26,7 +26,7 @@ fn complainer(c: @int) -> complainer { } fn f() { - let c = move complainer(@0); + let c = complainer(@0); fail!(); } diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 28a5a5ca47b55..5b515ae543476 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -50,7 +50,7 @@ fn zombiejesus() { 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); } @@ -73,7 +73,7 @@ fn angrydome() { break; } } -fn evil_lincoln() { let evil = move debug!("lincoln"); } +fn evil_lincoln() { let evil = debug!("lincoln"); } pub fn main() { strange(); diff --git a/src/test/run-pass/while-loop-constraints-2.rs b/src/test/run-pass/while-loop-constraints-2.rs index 3d44cf2669b27..df5f5904793da 100644 --- a/src/test/run-pass/while-loop-constraints-2.rs +++ b/src/test/run-pass/while-loop-constraints-2.rs @@ -15,7 +15,7 @@ pub fn main() { 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); diff --git a/src/test/run-pass/yield.rs b/src/test/run-pass/yield.rs index d5c58bbd0fabf..16f43016b8e67 100644 --- a/src/test/run-pass/yield.rs +++ b/src/test/run-pass/yield.rs @@ -11,13 +11,13 @@ 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() { diff --git a/src/test/run-pass/yield1.rs b/src/test/run-pass/yield1.rs index 1f6170624346b..ae1271f64e4dc 100644 --- a/src/test/run-pass/yield1.rs +++ b/src/test/run-pass/yield1.rs @@ -11,10 +11,10 @@ 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"); } From 3a19eef4966cf9ba7104792ebd70c38015dcecab Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 15 Feb 2013 02:49:32 -0800 Subject: [PATCH 10/10] libsyntax: Remove move as a keyword. --- src/libsyntax/parse/parser.rs | 2 +- src/libsyntax/parse/token.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f6fd894192e77..b4fd7a5d2e8b4 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -712,7 +712,7 @@ pub impl Parser { fn parse_capture_item_or(parse_arg_fn: fn(Parser) -> arg_or_capture_item) -> arg_or_capture_item { - if self.eat_keyword(~"move") || self.eat_keyword(~"copy") { + if self.eat_keyword(~"copy") { // XXX outdated syntax now that moves-based-on-type has gone in self.parse_ident(); either::Right(()) diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 3279c79e5af0d..bdd26fc00a7dc 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -493,7 +493,7 @@ pub fn strict_keyword_table() -> HashMap<~str, ()> { ~"false", ~"fn", ~"for", ~"if", ~"impl", ~"let", ~"log", ~"loop", - ~"match", ~"mod", ~"move", ~"mut", + ~"match", ~"mod", ~"mut", ~"once", ~"priv", ~"pub", ~"pure", ~"ref", ~"return",