diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 370c5ddb566a..bb556ed2ca39 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -137,17 +137,17 @@ impl BigBitv { } #[inline(always)] - fn each_storage(op: fn(&v: uint) -> bool) { + fn each_storage(op: fn(v: &mut uint) -> bool) { for uint::range(0, self.storage.len()) |i| { let mut w = self.storage[i]; - let b = !op(w); + let b = !op(&mut w); self.storage[i] = w; if !b { break; } } } #[inline(always)] - fn invert() { for self.each_storage() |w| { w = !w } } + fn invert() { for self.each_storage() |w| { *w = !*w } } #[inline(always)] fn union(b: &BigBitv, nbits: uint) -> bool { @@ -337,7 +337,7 @@ impl Bitv { * bitvectors contain identical elements. */ #[inline(always)] - fn equal(v1: Bitv) -> bool { + fn equal(v1: &Bitv) -> bool { if self.nbits != v1.nbits { return false; } match self.rep { Small(ref b) => match v1.rep { @@ -356,7 +356,7 @@ impl Bitv { fn clear() { match self.rep { Small(ref b) => b.clear(), - Big(ref s) => for s.each_storage() |w| { w = 0u } + Big(ref s) => for s.each_storage() |w| { *w = 0u } } } @@ -365,7 +365,7 @@ impl Bitv { fn set_all() { match self.rep { Small(ref b) => b.set_all(), - Big(ref s) => for s.each_storage() |w| { w = !0u } } + Big(ref s) => for s.each_storage() |w| { *w = !0u } } } /// Invert all bits @@ -373,7 +373,7 @@ impl Bitv { fn invert() { match self.rep { Small(ref b) => b.invert(), - Big(ref s) => for s.each_storage() |w| { w = !w } } + Big(ref s) => for s.each_storage() |w| { *w = !*w } } } /** @@ -386,7 +386,7 @@ impl Bitv { * Returns `true` if `v0` was changed. */ #[inline(always)] - fn difference(v: ~Bitv) -> bool { self.do_op(Difference, v) } + fn difference(v: &Bitv) -> bool { self.do_op(Difference, v) } /// Returns true if all bits are 1 #[inline(always)] @@ -863,14 +863,14 @@ mod tests { fn test_equal_differing_sizes() { let v0 = Bitv(10u, false); let v1 = Bitv(11u, false); - assert !v0.equal(v1); + assert !v0.equal(&v1); } #[test] fn test_equal_greatly_differing_sizes() { let v0 = Bitv(10u, false); let v1 = Bitv(110u, false); - assert !v0.equal(v1); + assert !v0.equal(&v1); } #[test] @@ -881,7 +881,7 @@ mod tests { let b = bitv::Bitv(1, true); b.set(0, true); - assert a.equal(b); + assert a.equal(&b); } #[test] @@ -896,7 +896,7 @@ mod tests { b.set(i, true); } - assert a.equal(b); + assert a.equal(&b); } #[test] diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index fde9df858d79..f4df063a93d6 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -117,7 +117,7 @@ fn get(t: CVec, ofs: uint) -> T { * * Fails if `ofs` is greater or equal to the length of the vector */ -fn set(t: CVec, ofs: uint, v: T) { +fn set(t: CVec, ofs: uint, +v: T) { assert ofs < len(t); unsafe { *ptr::mut_offset((*t).base, ofs) = v }; } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 515f033b1f15..22fdca3b0ab3 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -8,8 +8,8 @@ use core::cmp::{Eq}; trait Deque { fn size() -> uint; - fn add_front(T); - fn add_back(T); + fn add_front(+v: T); + fn add_back(+v: T); fn pop_front() -> T; fn pop_back() -> T; fn peek_front() -> T; @@ -55,7 +55,7 @@ fn create() -> Deque { impl Repr: Deque { fn size() -> uint { return self.nelts; } - fn add_front(t: T) { + fn add_front(+t: T) { let oldlo: uint = self.lo; if self.lo == 0u { self.lo = self.elts.len() - 1u; @@ -68,7 +68,7 @@ fn create() -> Deque { self.elts.set_elt(self.lo, Some(t)); self.nelts += 1u; } - fn add_back(t: T) { + 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.lo = 0u; diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 699fec961c48..820c2bfcc4db 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -738,7 +738,7 @@ impl TcpSocket { result::Result<~[u8], TcpErrData>>, TcpErrData> { read_start(&self) } - fn read_stop(-read_port: + fn read_stop(+read_port: comm::Port>) -> result::Result<(), TcpErrData> { read_stop(&self, move read_port) diff --git a/src/libstd/par.rs b/src/libstd/par.rs index 9cfcd8c2acbc..4168de60646d 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -72,21 +72,21 @@ fn map_slices( } /// A parallel version of map. -pub fn map(xs: ~[A], f: fn~(A) -> B) -> ~[B] { +pub fn map(xs: &[A], f: fn~((&A)) -> B) -> ~[B] { vec::concat(map_slices(xs, || { fn~(_base: uint, slice : &[A], copy f) -> ~[B] { - vec::map(slice, |x| f(*x)) + vec::map(slice, |x| f(x)) } })) } /// A parallel version of mapi. -pub fn mapi(xs: ~[A], - f: fn~(uint, A) -> B) -> ~[B] { +pub fn mapi(xs: &[A], + f: fn~(uint, (&A)) -> B) -> ~[B] { let slices = map_slices(xs, || { fn~(base: uint, slice : &[A], copy f) -> ~[B] { vec::mapi(slice, |i, x| { - f(i + base, *x) + f(i + base, x) }) } }); @@ -119,21 +119,21 @@ pub fn mapi_factory( } /// Returns true if the function holds for all elements in the vector. -pub fn alli(xs: ~[A], f: fn~(uint, A) -> bool) -> bool { +pub fn alli(xs: &[A], f: fn~(uint, (&A)) -> bool) -> bool { do vec::all(map_slices(xs, || { fn~(base: uint, slice : &[A], copy f) -> bool { vec::alli(slice, |i, x| { - f(i + base, *x) + f(i + base, x) }) } })) |x| { *x } } /// Returns true if the function holds for any elements in the vector. -pub fn any(xs: ~[A], f: fn~(A) -> bool) -> bool { +pub fn any(xs: &[A], f: fn~(&(A)) -> bool) -> bool { do vec::any(map_slices(xs, || { fn~(_base : uint, slice: &[A], copy f) -> bool { - vec::any(slice, |x| f(*x)) + vec::any(slice, |x| f(x)) } })) |x| { *x } }