about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Striegel <ben.striegel@gmail.com>2013-01-29 23:13:12 -0500
committerBen Striegel <ben.striegel@gmail.com>2013-01-30 23:21:16 -0500
commit5e55fe875855a39ed87584d155d26c8c54d3adff (patch)
tree4e099901f3bde8e3bb204343254959101dc5e269
parentcc3bb7b68a2e7e43b244a00c4ff96d14b74de251 (diff)
downloadrust-5e55fe875855a39ed87584d155d26c8c54d3adff.tar.gz
rust-5e55fe875855a39ed87584d155d26c8c54d3adff.zip
Revert RIMOV for libcore
-rw-r--r--src/libcore/dvec.rs6
-rw-r--r--src/libcore/hash.rs4
-rw-r--r--src/libcore/io.rs8
-rw-r--r--src/libcore/rand.rs2
-rw-r--r--src/libcore/run.rs4
-rw-r--r--src/libcore/uint-template.rs2
-rw-r--r--src/libcore/vec.rs44
7 files changed, 35 insertions, 35 deletions
diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs
index e755b445134..34b058f6a3b 100644
--- a/src/libcore/dvec.rs
+++ b/src/libcore/dvec.rs
@@ -46,7 +46,7 @@ use vec;
  * # WARNING
  *
  * For maximum performance, this type is implemented using some rather
- * unsafe code.  In particular, this innocent looking `~[A]` pointer
+ * unsafe code.  In particular, this innocent looking `~[mut A]` pointer
  * *may be null!*  Therefore, it is important you not reach into the
  * data structure manually but instead use the provided extensions.
  *
@@ -143,7 +143,7 @@ impl<A> DVec<A> {
      * and return a new vector to replace it with.
      */
     #[inline(always)]
-    fn swap_mut(f: &fn(v: ~[A]) -> ~[A]) {
+    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)))
         }
@@ -223,7 +223,7 @@ impl<A> DVec<A> {
     }
 
     /// Gives access to the vector as a slice with mutable contents
-    fn borrow_mut<R>(op: fn(x: &mut [A]) -> R) -> R {
+    fn borrow_mut<R>(op: fn(x: &[mut A]) -> R) -> R {
         do self.check_out |v| {
             let mut v = move v;
             let result = op(v);
diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs
index 688cd32a1e0..d3d6c5ae242 100644
--- a/src/libcore/hash.rs
+++ b/src/libcore/hash.rs
@@ -169,7 +169,7 @@ struct SipState {
     mut v1: u64,
     mut v2: u64,
     mut v3: u64,
-    mut tail: [u8 * 8], // unprocessed bytes
+    tail: [mut u8 * 8], // unprocessed bytes
     mut ntail: uint,  // how many bytes in tail are valid
 }
 
@@ -183,7 +183,7 @@ fn SipState(key0: u64, key1: u64) -> SipState {
         mut v1 : 0u64,
         mut v2 : 0u64,
         mut v3 : 0u64,
-        mut tail : [0u8,0,0,0,0,0,0,0],
+        tail : [mut 0u8,0,0,0,0,0,0,0],
         mut ntail : 0u,
     };
     (&state).reset();
diff --git a/src/libcore/io.rs b/src/libcore/io.rs
index 9f6eac1d420..6d618627ece 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -59,7 +59,7 @@ pub trait Reader {
     /// Read up to len bytes (or EOF) and put them into bytes (which
     /// must be at least len bytes long). Return number of bytes read.
     // FIXME (#2982): This should probably return an error.
-    fn read(&self, bytes: &mut [u8], len: uint) -> uint;
+    fn read(&self, bytes: &[mut u8], len: uint) -> uint;
 
     /// Read a single byte, returning a negative value for EOF or read error.
     fn read_byte(&self) -> int;
@@ -419,7 +419,7 @@ fn convert_whence(whence: SeekStyle) -> i32 {
 }
 
 impl *libc::FILE: Reader {
-    fn read(&self, bytes: &mut [u8], len: uint) -> uint {
+    fn read(&self, bytes: &[mut u8], len: uint) -> uint {
         unsafe {
             do vec::as_mut_buf(bytes) |buf_p, buf_len| {
                 assert buf_len >= len;
@@ -464,7 +464,7 @@ struct Wrapper<T, C> {
 // duration of its lifetime.
 // FIXME there really should be a better way to do this // #2004
 impl<R: Reader, C> Wrapper<R, C>: Reader {
-    fn read(&self, bytes: &mut [u8], len: uint) -> uint {
+    fn read(&self, bytes: &[mut u8], len: uint) -> uint {
         self.base.read(bytes, len)
     }
     fn read_byte(&self) -> int { self.base.read_byte() }
@@ -531,7 +531,7 @@ pub struct BytesReader {
 }
 
 impl BytesReader: Reader {
-    fn read(&self, bytes: &mut [u8], len: uint) -> uint {
+    fn read(&self, bytes: &[mut u8], len: uint) -> uint {
         let count = uint::min(len, self.bytes.len() - self.pos);
 
         let view = vec::view(self.bytes, self.pos, self.bytes.len());
diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs
index 8f0fc02ac21..976c186912b 100644
--- a/src/libcore/rand.rs
+++ b/src/libcore/rand.rs
@@ -254,7 +254,7 @@ impl Rng {
     }
 
     /// Shuffle a mutable vec in place
-    fn shuffle_mut<T>(values: &mut [T]) {
+    fn shuffle_mut<T>(values: &[mut T]) {
         let mut i = values.len();
         while i >= 2u {
             // invariant: elements with index >= i have been locked in place.
diff --git a/src/libcore/run.rs b/src/libcore/run.rs
index 0963c8bbcd2..8aeae1adeec 100644
--- a/src/libcore/run.rs
+++ b/src/libcore/run.rs
@@ -289,7 +289,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program {
 
 fn read_all(rd: io::Reader) -> ~str {
     let buf = io::with_bytes_writer(|wr| {
-        let mut bytes = [0, ..4096];
+        let mut bytes = [mut 0, ..4096];
         while !rd.eof() {
             let nread = rd.read(bytes, bytes.len());
             wr.write(bytes.view(0, nread));
@@ -387,7 +387,7 @@ pub fn readclose(fd: c_int) -> ~str {
         let file = os::fdopen(fd);
         let reader = io::FILE_reader(file, false);
         let buf = io::with_bytes_writer(|writer| {
-            let mut bytes = [0, ..4096];
+            let mut bytes = [mut 0, ..4096];
             while !reader.eof() {
                 let nread = reader.read(bytes, bytes.len());
                 writer.write(bytes.view(0, nread));
diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs
index eee82f4626f..e4cc6651958 100644
--- a/src/libcore/uint-template.rs
+++ b/src/libcore/uint-template.rs
@@ -252,7 +252,7 @@ pub pure fn to_str_bytes<U>(neg: bool, num: T, radix: uint,
     // Enough room to hold any number in any radix.
     // Worst case: 64-bit number, binary-radix, with
     // a leading negative sign = 65 bytes.
-    let mut buf : [u8 * 65] = [0u8, ..65];
+    let buf : [mut u8 * 65] = [mut 0u8, ..65];
     let len = buf.len();
 
     let mut i = len;
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 7e8dcf72d0f..f516ed366de 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -206,12 +206,12 @@ pub pure fn build_sized_opt<A>(size: Option<uint>,
 }
 
 /// Produces a mut vector from an immutable vector.
-pub pure fn cast_to_mut<T>(v: ~[T]) -> ~[T] {
+pub pure fn cast_to_mut<T>(v: ~[T]) -> ~[mut T] {
     unsafe { ::cast::transmute(v) }
 }
 
 /// Produces an immutable vector from a mut vector.
-pub pure fn cast_from_mut<T>(v: ~[T]) -> ~[T] {
+pub pure fn cast_from_mut<T>(v: ~[mut T]) -> ~[T] {
     unsafe { ::cast::transmute(v) }
 }
 
@@ -562,7 +562,7 @@ pub fn consume<T>(v: ~[T], f: fn(uint, v: T)) {
     }
 }
 
-pub fn consume_mut<T>(v: ~[T], f: fn(uint, v: T)) {
+pub fn consume_mut<T>(v: ~[mut T], f: fn(uint, v: T)) {
     consume(vec::cast_from_mut(v), f)
 }
 
@@ -731,7 +731,7 @@ pub pure fn append_one<T>(lhs: ~[T], x: T) -> ~[T] {
 }
 
 #[inline(always)]
-pub pure fn append_mut<T: Copy>(lhs: ~[T], rhs: &[const T]) -> ~[T] {
+pub pure fn append_mut<T: Copy>(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] {
     cast_to_mut(append(cast_from_mut(lhs), rhs))
 }
 
@@ -1263,12 +1263,12 @@ pub pure fn zip<T, U>(v: ~[T], u: ~[U]) -> ~[(T, U)] {
  * * a - The index of the first element
  * * b - The index of the second element
  */
-pub fn swap<T>(v: &mut [T], a: uint, b: uint) {
+pub fn swap<T>(v: &[mut T], a: uint, b: uint) {
     v[a] <-> v[b];
 }
 
 /// Reverse the order of elements in a vector, in place
-pub fn reverse<T>(v: &mut [T]) {
+pub fn reverse<T>(v: &[mut T]) {
     let mut i: uint = 0;
     let ln = len::<T>(v);
     while i < ln / 2 { v[i] <-> v[ln - i - 1]; i += 1; }
@@ -1349,7 +1349,7 @@ pub pure fn each<T>(v: &r/[T], f: fn(&r/T) -> bool) {
 /// a vector with mutable contents and you would like
 /// to mutate the contents as you iterate.
 #[inline(always)]
-pub fn each_mut<T>(v: &mut [T], f: fn(elem: &mut T) -> bool) {
+pub fn each_mut<T>(v: &[mut T], f: fn(elem: &mut T) -> bool) {
     let mut i = 0;
     let n = v.len();
     while i < n {
@@ -1519,7 +1519,7 @@ pub pure fn as_const_buf<T,U>(s: &[const T],
 
 /// Similar to `as_imm_buf` but passing a `*mut T`
 #[inline(always)]
-pub pure fn as_mut_buf<T,U>(s: &mut [T],
+pub pure fn as_mut_buf<T,U>(s: &[mut T],
                         f: fn(*mut T, uint) -> U) -> U {
 
     unsafe {
@@ -1640,9 +1640,9 @@ pub mod traits {
         }
     }
 
-    impl<T: Copy> ~[T] : Add<&[const T],~[T]> {
+    impl<T: Copy> ~[mut T] : Add<&[const T],~[mut T]> {
         #[inline(always)]
-        pure fn add(&self, rhs: & &self/[const T]) -> ~[T] {
+        pure fn add(&self, rhs: & &self/[const T]) -> ~[mut T] {
             append_mut(copy *self, (*rhs))
         }
     }
@@ -2066,7 +2066,7 @@ pub mod raw {
 
     /** see `to_ptr()` */
     #[inline(always)]
-    pub unsafe fn to_mut_ptr<T>(v: &mut [T]) -> *mut T {
+    pub unsafe fn to_mut_ptr<T>(v: &[mut T]) -> *mut T {
         let repr: **SliceRepr = ::cast::transmute(&v);
         return ::cast::reinterpret_cast(&addr_of(&((**repr).data)));
     }
@@ -2099,7 +2099,7 @@ pub mod raw {
      * is newly allocated.
      */
     #[inline(always)]
-    pub unsafe fn init_elem<T>(v: &mut [T], i: uint, val: T) {
+    pub unsafe fn init_elem<T>(v: &[mut T], i: uint, val: T) {
         let mut box = Some(val);
         do as_mut_buf(v) |p, _len| {
             let mut box2 = None;
@@ -2133,7 +2133,7 @@ pub mod raw {
       * may overlap.
       */
     #[inline(always)]
-    pub unsafe fn copy_memory<T>(dst: &mut [T], src: &[const T],
+    pub unsafe fn copy_memory<T>(dst: &[mut T], src: &[const T],
                                  count: uint) {
         assert dst.len() >= count;
         assert src.len() >= count;
@@ -2200,7 +2200,7 @@ pub mod bytes {
       * may overlap.
       */
     #[inline(always)]
-    pub fn copy_memory(dst: &mut [u8], src: &[const u8], count: uint) {
+    pub fn copy_memory(dst: &[mut u8], src: &[const u8], count: uint) {
         // Bound checks are done at vec::raw::copy_memory.
         unsafe { vec::raw::copy_memory(dst, src, count) }
     }
@@ -3155,7 +3155,7 @@ mod tests {
 
     #[test]
     fn reverse_and_reversed() {
-        let mut v: ~[int] = ~[10, 20];
+        let v: ~[mut int] = ~[mut 10, 20];
         assert (v[0] == 10);
         assert (v[1] == 20);
         reverse(v);
@@ -3170,13 +3170,13 @@ mod tests {
 
         let v4 = reversed::<int>(~[]);
         assert (v4 == ~[]);
-        let mut v3: ~[int] = ~[];
+        let v3: ~[mut int] = ~[mut];
         reverse::<int>(v3);
     }
 
     #[test]
     fn reversed_mut() {
-        let mut v2 = reversed::<int>(~[10, 20]);
+        let v2 = reversed::<int>(~[mut 10, 20]);
         assert (v2[0] == 20);
         assert (v2[1] == 10);
     }
@@ -3302,7 +3302,7 @@ mod tests {
     #[test]
     fn cast_from_mut_no_copy() {
         unsafe {
-            let mut x = ~[1, 2, 3];
+            let x = ~[mut 1, 2, 3];
             let addr = raw::to_ptr(x);
             let x_imm = cast_from_mut(x);
             let addr_imm = raw::to_ptr(x_imm);
@@ -3564,7 +3564,7 @@ mod tests {
     #[ignore(windows)]
     #[should_fail]
     fn test_consume_mut_fail() {
-        let mut v = ~[(~0, @0), (~0, @0), (~0, @0), (~0, @0)];
+        let v = ~[mut (~0, @0), (~0, @0), (~0, @0), (~0, @0)];
         let mut i = 0;
         do consume_mut(v) |_i, _elt| {
             if i == 2 {
@@ -3592,7 +3592,7 @@ mod tests {
     #[ignore(windows)]
     #[should_fail]
     fn test_map_fail() {
-        let mut v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)];
+        let v = [mut (~0, @0), (~0, @0), (~0, @0), (~0, @0)];
         let mut i = 0;
         do map(v) |_elt| {
             if i == 2 {
@@ -3918,7 +3918,7 @@ mod tests {
     #[ignore(cfg(windows))]
     #[should_fail]
     fn test_as_mut_buf_fail() {
-        let mut v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)];
+        let v = [mut (~0, @0), (~0, @0), (~0, @0), (~0, @0)];
         do as_mut_buf(v) |_buf, _i| {
             fail
         }
@@ -3929,7 +3929,7 @@ mod tests {
     #[ignore(cfg(windows))]
     fn test_copy_memory_oob() {
         unsafe {
-            let mut a = [1, 2, 3, 4];
+            let a = [mut 1, 2, 3, 4];
             let b = [1, 2, 3, 4, 5];
             raw::copy_memory(a, b, 5);
         }