diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 75db5359e2e..71af60314da 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 14cc79ceaff..22ed4f76943 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 0af0ecb16aa..09de94f1aaf 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 0a96bd633d1..03a921d7ea5 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 54c9f7b9879..72aecdd8295 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 3dbc3bef017..36ea67ea695 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 6b5c083662b..c47e27e75d9 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 b4f4e7d343b..40a9de0cea3 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 2173efe5ac6..34a9f6a8588 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 7c2b5d7ffcd..9a8f01baed1 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 af788989e9c..986aa18ad4a 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 a36fa56fc79..25cdb11456a 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 49e0d0bdd8a..1fb855520ba 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 e57d664c2aa..a90364c7d8c 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 91cc20d97f3..f2401589cd8 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 f196b97e5e5..531ce95d067 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 a26a6b5f8ec..b9e07135f2c 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 9df31bbd81f..5b69c348c15 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 47a0e11941c..cc747521030 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 eb407cf1128..8983c63f42a 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 c2266f4fdb0..7f1687b0860 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 fb824087f21..64c62c92584 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 7a597aa9c75..5103025d120 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 1571e645117..afc9d7f1417 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 35bbc0347ee..949c36545dd 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 09c558e3be5..4b15d1f76c9 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 a57e8a8ee44..d72cacc2c4b 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 a1e77a494d5..e545f6567ec 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 87cbcdfe30b..eea172a43ce 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 3808e13be1c..97519e88f26 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)]