about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/compiletest/runtest.rs4
-rw-r--r--src/libcore/hash.rs4
-rw-r--r--src/libcore/io.rs8
-rw-r--r--src/libcore/os.rs6
-rw-r--r--src/libcore/rand.rs2
-rw-r--r--src/libcore/run.rs4
-rw-r--r--src/libcore/vec.rs60
-rw-r--r--src/librustc/middle/trans/_match.rs2
-rw-r--r--src/librustc/middle/trans/cabi_x86_64.rs17
-rw-r--r--src/librustc/middle/typeck/check/method.rs2
-rw-r--r--src/librustc/middle/typeck/check/mod.rs2
-rw-r--r--src/libstd/getopts.rs4
-rw-r--r--src/libstd/md4.rs2
-rw-r--r--src/libstd/rope.rs6
-rw-r--r--src/libstd/sha1.rs68
-rw-r--r--src/libstd/sort.rs4
-rw-r--r--src/libstd/workcache.rs4
-rw-r--r--src/test/bench/shootout-fannkuchredux.rs6
-rw-r--r--src/test/bench/shootout-k-nucleotide-pipes.rs2
-rw-r--r--src/test/bench/shootout-spectralnorm.rs6
-rw-r--r--src/test/compile-fail/issue-2548.rs4
-rw-r--r--src/test/run-pass/import-in-block.rs2
22 files changed, 96 insertions, 123 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 0f8c8761c42..83ab56309c1 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -322,8 +322,8 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
                          ProcRes: ProcRes) {
 
     // true if we found the error in question
-    let found_flags = vec::cast_to_mut(vec::from_elem(
-        vec::len(expected_errors), false));
+    let mut found_flags = vec::from_elem(
+        vec::len(expected_errors), false);
 
     if ProcRes.status == 0 {
         fatal(~"process did not return an error status");
diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs
index 692cfee5365..e53b7d29ebe 100644
--- a/src/libcore/hash.rs
+++ b/src/libcore/hash.rs
@@ -165,7 +165,7 @@ struct SipState {
     mut v1: u64,
     mut v2: u64,
     mut v3: u64,
-    tail: [mut u8 * 8], // unprocessed bytes
+    mut tail: [u8 * 8], // unprocessed bytes
     mut ntail: uint,  // how many bytes in tail are valid
 }
 
@@ -179,7 +179,7 @@ fn SipState(key0: u64, key1: u64) -> SipState {
         mut v1 : 0u64,
         mut v2 : 0u64,
         mut v3 : 0u64,
-        tail : [mut 0u8,0,0,0,0,0,0,0],
+        mut tail : [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 721a6584c65..c1e47439e92 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -56,7 +56,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;
@@ -416,7 +416,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;
@@ -461,7 +461,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() }
@@ -528,7 +528,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/os.rs b/src/libcore/os.rs
index 0efc17354dd..ce590092db8 100644
--- a/src/libcore/os.rs
+++ b/src/libcore/os.rs
@@ -79,7 +79,7 @@ pub fn as_c_charp<T>(s: &str, f: fn(*c_char) -> T) -> T {
 
 pub fn fill_charp_buf(f: fn(*mut c_char, size_t) -> bool)
     -> Option<~str> {
-    let buf = vec::cast_to_mut(vec::from_elem(TMPBUF_SZ, 0u8 as c_char));
+    let mut buf = vec::from_elem(TMPBUF_SZ, 0u8 as c_char);
     do vec::as_mut_buf(buf) |b, sz| {
         if f(b, sz as size_t) {
             unsafe {
@@ -108,7 +108,7 @@ pub mod win32 {
             let mut res = None;
             let mut done = false;
             while !done {
-                let buf = vec::cast_to_mut(vec::from_elem(n as uint, 0u16));
+                let mut buf = vec::from_elem(n as uint, 0u16);
                 do vec::as_mut_buf(buf) |b, _sz| {
                     let k : DWORD = f(b, TMPBUF_SZ as DWORD);
                     if k == (0 as DWORD) {
@@ -1325,7 +1325,7 @@ mod tests {
           };
           assert (ostream as uint != 0u);
           let s = ~"hello";
-          let mut buf = vec::cast_to_mut(str::to_bytes(s) + ~[0 as u8]);
+          let mut buf = str::to_bytes(s) + ~[0 as u8];
           do vec::as_mut_buf(buf) |b, _len| {
               assert (libc::fwrite(b as *c_void, 1u as size_t,
                                    (str::len(s) + 1u) as size_t, ostream)
diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs
index 452ab945251..1881bd784c4 100644
--- a/src/libcore/rand.rs
+++ b/src/libcore/rand.rs
@@ -350,7 +350,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 ae5c4d19b1c..0ef22cfc5ec 100644
--- a/src/libcore/run.rs
+++ b/src/libcore/run.rs
@@ -290,7 +290,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 = [mut 0, ..4096];
+        let mut bytes = [0, ..4096];
         while !rd.eof() {
             let nread = rd.read(bytes, bytes.len());
             wr.write(bytes.view(0, nread));
@@ -391,7 +391,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 = [mut 0, ..4096];
+            let mut bytes = [0, ..4096];
             while !reader.eof() {
                 let nread = reader.read(bytes, bytes.len());
                 writer.write(bytes.view(0, nread));
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 16cad87c060..7f02ad79583 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -558,10 +558,6 @@ pub fn consume<T>(mut 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)
-}
-
 /// Remove the last element from a vector and return it
 pub fn pop<T>(v: &mut ~[T]) -> T {
     let ln = v.len();
@@ -728,11 +724,6 @@ pub pure fn append_one<T>(lhs: ~[T], x: T) -> ~[T] {
     v
 }
 
-#[inline(always)]
-pub pure fn append_mut<T: Copy>(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] {
-    cast_to_mut(append(cast_from_mut(lhs), rhs))
-}
-
 /**
  * Expands a vector in place, initializing the new elements to a given value
  *
@@ -1285,12 +1276,12 @@ pub pure fn zip<T, U>(mut v: ~[T], mut 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; }
@@ -1371,7 +1362,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 {
@@ -1541,7 +1532,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 {
@@ -1653,7 +1644,7 @@ impl<T: Ord> @[T] : Ord {
 pub mod traits {
     use kinds::Copy;
     use ops::Add;
-    use vec::{append, append_mut};
+    use vec::append;
 
     impl<T: Copy> ~[T] : Add<&[const T],~[T]> {
         #[inline(always)]
@@ -1661,13 +1652,6 @@ pub mod traits {
             append(copy *self, (*rhs))
         }
     }
-
-    impl<T: Copy> ~[mut T] : Add<&[const T],~[mut T]> {
-        #[inline(always)]
-        pure fn add(&self, rhs: & &self/[const T]) -> ~[mut T] {
-            append_mut(copy *self, (*rhs))
-        }
-    }
 }
 
 impl<T> &[const T]: Container {
@@ -2088,7 +2072,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)));
     }
@@ -2121,7 +2105,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;
@@ -2155,7 +2139,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;
@@ -2222,7 +2206,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) }
     }
@@ -3220,7 +3204,7 @@ mod tests {
 
     #[test]
     fn reverse_and_reversed() {
-        let v: ~[mut int] = ~[mut 10, 20];
+        let mut v: ~[int] = ~[10, 20];
         assert (v[0] == 10);
         assert (v[1] == 20);
         reverse(v);
@@ -3235,13 +3219,13 @@ mod tests {
 
         let v4 = reversed::<int>(~[]);
         assert (v4 == ~[]);
-        let v3: ~[mut int] = ~[mut];
+        let mut v3: ~[int] = ~[];
         reverse::<int>(v3);
     }
 
     #[test]
     fn reversed_mut() {
-        let v2 = reversed::<int>(~[mut 10, 20]);
+        let mut v2 = reversed::<int>(~[10, 20]);
         assert (v2[0] == 20);
         assert (v2[1] == 10);
     }
@@ -3628,20 +3612,6 @@ mod tests {
     #[test]
     #[ignore(windows)]
     #[should_fail]
-    fn test_consume_mut_fail() {
-        let v = ~[mut (~0, @0), (~0, @0), (~0, @0), (~0, @0)];
-        let mut i = 0;
-        do consume_mut(v) |_i, _elt| {
-            if i == 2 {
-                die!()
-            }
-            i += 1;
-        };
-    }
-
-    #[test]
-    #[ignore(windows)]
-    #[should_fail]
     #[allow(non_implicitly_copyable_typarams)]
     fn test_grow_fn_fail() {
         let mut v = ~[];
@@ -3657,7 +3627,7 @@ mod tests {
     #[ignore(windows)]
     #[should_fail]
     fn test_map_fail() {
-        let v = [mut (~0, @0), (~0, @0), (~0, @0), (~0, @0)];
+        let mut v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)];
         let mut i = 0;
         do map(v) |_elt| {
             if i == 2 {
@@ -3983,7 +3953,7 @@ mod tests {
     #[ignore(cfg(windows))]
     #[should_fail]
     fn test_as_mut_buf_fail() {
-        let v = [mut (~0, @0), (~0, @0), (~0, @0), (~0, @0)];
+        let mut v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)];
         do as_mut_buf(v) |_buf, _i| {
             die!()
         }
@@ -3994,7 +3964,7 @@ mod tests {
     #[ignore(cfg(windows))]
     fn test_copy_memory_oob() {
         unsafe {
-            let a = [mut 1, 2, 3, 4];
+            let mut a = [1, 2, 3, 4];
             let b = [1, 2, 3, 4, 5];
             raw::copy_memory(a, b, 5);
         }
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index 2369a63e544..d9d3b63b6c9 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -1002,7 +1002,7 @@ pub fn pick_col(m: &[@Match]) -> uint {
           _ => 0u
         }
     }
-    let scores = vec::cast_to_mut(vec::from_elem(m[0].pats.len(), 0u));
+    let mut scores = vec::from_elem(m[0].pats.len(), 0u);
     for vec::each(m) |br| {
         let mut i = 0u;
         for vec::each(br.pats) |p| { scores[i] += score(*p); i += 1u; }
diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs
index d3eb2157ee3..00235c32d3c 100644
--- a/src/librustc/middle/trans/cabi_x86_64.rs
+++ b/src/librustc/middle/trans/cabi_x86_64.rs
@@ -127,13 +127,13 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
         }
     }
 
-    fn all_mem(cls: &[mut x86_64_reg_class]) {
+    fn all_mem(cls: &mut [x86_64_reg_class]) {
         for uint::range(0, cls.len()) |i| {
             cls[i] = memory_class;
         }
     }
 
-    fn unify(cls: &[mut x86_64_reg_class],
+    fn unify(cls: &mut [x86_64_reg_class],
              i: uint,
              newv: x86_64_reg_class) {
         if cls[i] == newv {
@@ -159,7 +159,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
     }
 
     fn classify_struct(tys: &[TypeRef],
-                       cls: &[mut x86_64_reg_class], i: uint,
+                       cls: &mut [x86_64_reg_class], i: uint,
                        off: uint) {
         let mut field_off = off;
         for vec::each(tys) |ty| {
@@ -170,7 +170,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
     }
 
     fn classify(ty: TypeRef,
-                cls: &[mut x86_64_reg_class], ix: uint,
+                cls: &mut [x86_64_reg_class], ix: uint,
                 off: uint) {
         unsafe {
             let t_align = ty_align(ty);
@@ -220,7 +220,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
         }
     }
 
-    fn fixup(ty: TypeRef, cls: &[mut x86_64_reg_class]) {
+    fn fixup(ty: TypeRef, cls: &mut [x86_64_reg_class]) {
         unsafe {
             let mut i = 0u;
             let llty = llvm::LLVMGetTypeKind(ty) as int;
@@ -270,14 +270,15 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
     }
 
     let words = (ty_size(ty) + 7) / 8;
-    let cls = vec::cast_to_mut(vec::from_elem(words, no_class));
+    let mut cls = vec::from_elem(words, no_class);
     if words > 4 {
         all_mem(cls);
-        return vec::cast_from_mut(move cls);
+        let cls = cls;
+        return move cls;
     }
     classify(ty, cls, 0, 0);
     fixup(ty, cls);
-    return vec::cast_from_mut(move cls);
+    return move cls;
 }
 
 fn llreg_ty(cls: &[x86_64_reg_class]) -> TypeRef {
diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs
index 463ae3201a4..45b0fa962ad 100644
--- a/src/librustc/middle/typeck/check/method.rs
+++ b/src/librustc/middle/typeck/check/method.rs
@@ -779,7 +779,7 @@ pub impl LookupContext {
         /*!
          *
          * In the event that we are invoking a method with a receiver
-         * of a linear borrowed type like `&mut T` or `&[mut T]`,
+         * of a linear borrowed type like `&mut T` or `&mut [T]`,
          * we will "reborrow" the receiver implicitly.  For example, if
          * you have a call `r.inc()` and where `r` has type `&mut T`,
          * then we treat that like `(&mut *r).inc()`.  This avoids
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index fda9702d582..d6bd9aa96dd 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -3131,7 +3131,7 @@ pub fn check_bounds_are_used(ccx: @mut CrateCtxt,
 
     // make a vector of booleans initially false, set to true when used
     if tps.len() == 0u { return; }
-    let tps_used = vec::cast_to_mut(vec::from_elem(tps.len(), false));
+    let mut tps_used = vec::from_elem(tps.len(), false);
 
     ty::walk_regions_and_ty(
         ccx.tcx, ty,
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs
index a778649f6f4..e3f8ef1b2b5 100644
--- a/src/libstd/getopts.rs
+++ b/src/libstd/getopts.rs
@@ -224,7 +224,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
     unsafe {
         let n_opts = opts.len();
         fn f(_x: uint) -> ~[Optval] { return ~[]; }
-        let vals = vec::cast_to_mut(vec::from_fn(n_opts, f));
+        let mut vals = vec::from_fn(n_opts, f);
         let mut free: ~[~str] = ~[];
         let l = args.len();
         let mut i = 0;
@@ -339,7 +339,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
             i += 1;
         }
         return Ok(Matches {opts: vec::from_slice(opts),
-                   vals: vec::cast_from_mut(move vals),
+                   vals: move vals,
                    free: free});
     }
 }
diff --git a/src/libstd/md4.rs b/src/libstd/md4.rs
index 1d831af0e29..6fe82d554de 100644
--- a/src/libstd/md4.rs
+++ b/src/libstd/md4.rs
@@ -52,7 +52,7 @@ pub pure fn md4(msg: &[u8]) -> Quad {
 
     let mut i = 0u;
     let e = vec::len(msg);
-    let x = vec::cast_to_mut(vec::from_elem(16u, 0u32));
+    let mut x = vec::from_elem(16u, 0u32);
     while i < e {
         let aa = a, bb = b, cc = c, dd = d;
 
diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs
index f8aef2c5f1e..dbfa771e0a2 100644
--- a/src/libstd/rope.rs
+++ b/src/libstd/rope.rs
@@ -174,7 +174,7 @@ pub fn concat(v: ~[Rope]) -> Rope {
     //Copy `v` into a mut vector
     let mut len = vec::len(v);
     if len == 0u { return node::Empty; }
-    let ropes = vec::cast_to_mut(vec::from_elem(len, v[0]));
+    let mut ropes = vec::from_elem(len, v[0]);
     for uint::range(1u, len) |i| {
        ropes[i] = v[i];
     }
@@ -719,7 +719,7 @@ pub mod node {
             //Firstly, split `str` in slices of hint_max_leaf_char_len
             let mut leaves = uint::div_ceil(char_len, hint_max_leaf_char_len);
             //Number of leaves
-            let nodes  = vec::cast_to_mut(vec::from_elem(leaves, candidate));
+            let mut nodes  = vec::from_elem(leaves, candidate);
 
             let mut i = 0u;
             let mut offset = byte_start;
@@ -832,7 +832,7 @@ pub mod node {
 
     pub fn serialize_node(node: @Node) -> ~str {
         unsafe {
-            let mut buf = vec::cast_to_mut(vec::from_elem(byte_len(node), 0));
+            let mut buf = vec::from_elem(byte_len(node), 0);
             let mut offset = 0u;//Current position in the buffer
             let it = leaf_iterator::start(node);
             loop {
diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs
index 6209170ac3d..788d1d1012d 100644
--- a/src/libstd/sha1.rs
+++ b/src/libstd/sha1.rs
@@ -35,21 +35,21 @@ use core::vec;
 /// The SHA-1 interface
 trait Sha1 {
     /// Provide message input as bytes
-    fn input(&[const u8]);
+    fn input(&mut self, &[const u8]);
     /// Provide message input as string
-    fn input_str(&str);
+    fn input_str(&mut self, &str);
     /**
      * Read the digest as a vector of 20 bytes. After calling this no further
      * input may be provided until reset is called.
      */
-    fn result() -> ~[u8];
+    fn result(&mut self) -> ~[u8];
     /**
      * Read the digest as a hex string. After calling this no further
      * input may be provided until reset is called.
      */
-    fn result_str() -> ~str;
+    fn result_str(&mut self) -> ~str;
     /// Reset the SHA-1 state for reuse
-    fn reset();
+    fn reset(&mut self);
 }
 
 // Some unexported constants
@@ -65,15 +65,15 @@ const k3: u32 = 0xCA62C1D6u32;
 /// Construct a `sha` object
 pub fn sha1() -> Sha1 {
     struct Sha1State
-        {h: ~[mut u32],
-         mut len_low: u32,
-         mut len_high: u32,
-         msg_block: ~[mut u8],
-         mut msg_block_idx: uint,
-         mut computed: bool,
-         work_buf: @~[mut u32]};
+        { h: ~[u32],
+          len_low: u32,
+          len_high: u32,
+          msg_block: ~[u8],
+          msg_block_idx: uint,
+          computed: bool,
+          work_buf: @mut ~[u32]};
 
-    fn add_input(st: &Sha1State, msg: &[const u8]) {
+    fn add_input(st: &mut Sha1State, msg: &[const u8]) {
         assert (!st.computed);
         for vec::each_const(msg) |element| {
             st.msg_block[st.msg_block_idx] = *element;
@@ -89,11 +89,11 @@ pub fn sha1() -> Sha1 {
             if st.msg_block_idx == msg_block_len { process_msg_block(st); }
         }
     }
-    fn process_msg_block(st: &Sha1State) {
+    fn process_msg_block(st: &mut Sha1State) {
         assert (vec::len(st.h) == digest_buf_len);
         assert (vec::len(*st.work_buf) == work_buf_len);
         let mut t: int; // Loop counter
-        let w = st.work_buf;
+        let mut w = st.work_buf;
 
         // Initialize the first 16 words of the vector w
         t = 0;
@@ -168,7 +168,7 @@ pub fn sha1() -> Sha1 {
     fn circular_shift(bits: u32, word: u32) -> u32 {
         return word << bits | word >> 32u32 - bits;
     }
-    fn mk_result(st: &Sha1State) -> ~[u8] {
+    fn mk_result(st: &mut Sha1State) -> ~[u8] {
         if !(*st).computed { pad_msg(st); (*st).computed = true; }
         let mut rs: ~[u8] = ~[];
         for vec::each_mut((*st).h) |ptr_hpart| {
@@ -191,7 +191,7 @@ pub fn sha1() -> Sha1 {
      * call process_msg_block() appropriately.  When it returns, it
      * can be assumed that the message digest has been computed.
      */
-    fn pad_msg(st: &Sha1State) {
+    fn pad_msg(st: &mut Sha1State) {
         assert (vec::len((*st).msg_block) == msg_block_len);
 
         /*
@@ -229,7 +229,7 @@ pub fn sha1() -> Sha1 {
     }
 
     impl Sha1State: Sha1 {
-        fn reset() {
+        fn reset(&mut self) {
             assert (vec::len(self.h) == digest_buf_len);
             self.len_low = 0u32;
             self.len_high = 0u32;
@@ -241,14 +241,14 @@ pub fn sha1() -> Sha1 {
             self.h[4] = 0xC3D2E1F0u32;
             self.computed = false;
         }
-        fn input(msg: &[const u8]) { add_input(&self, msg); }
-        fn input_str(msg: &str) {
+        fn input(&mut self, msg: &[const u8]) { add_input(self, msg); }
+        fn input_str(&mut self, msg: &str) {
             let bs = str::to_bytes(msg);
-            add_input(&self, bs);
+            add_input(self, bs);
         }
-        fn result() -> ~[u8] { return mk_result(&self); }
-        fn result_str() -> ~str {
-            let rr = mk_result(&self);
+        fn result(&mut self) -> ~[u8] { return mk_result(self); }
+        fn result_str(&mut self) -> ~str {
+            let rr = mk_result(self);
             let mut s = ~"";
             for vec::each(rr) |b| {
                 s += uint::to_str_radix(*b as uint, 16u);
@@ -256,16 +256,16 @@ pub fn sha1() -> Sha1 {
             return s;
         }
     }
-    let st = Sha1State {
-        h: vec::cast_to_mut(vec::from_elem(digest_buf_len, 0u32)),
-        mut len_low: 0u32,
-        mut len_high: 0u32,
-        msg_block: vec::cast_to_mut(vec::from_elem(msg_block_len, 0u8)),
-        mut msg_block_idx: 0u,
-        mut computed: false,
-        work_buf: @vec::cast_to_mut(vec::from_elem(work_buf_len, 0u32))
+    let mut st = Sha1State {
+         h: vec::from_elem(digest_buf_len, 0u32),
+         len_low: 0u32,
+         len_high: 0u32,
+         msg_block: vec::from_elem(msg_block_len, 0u8),
+         msg_block_idx: 0u,
+         computed: false,
+         work_buf: @mut vec::from_elem(work_buf_len, 0u32)
     };
-    let sh = (move st) as Sha1;
+    let mut sh = (move st) as Sha1;
     sh.reset();
     return sh;
 }
@@ -368,7 +368,7 @@ mod tests {
             }
             // Test that it works when accepting the message all at once
 
-            let sh = sha1::sha1();
+            let mut sh = sha1::sha1();
             for vec::each(tests) |t| {
                 sh.input_str(t.input);
                 let out = sh.result();
diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs
index 680a2b99c4a..9c7d31e15f3 100644
--- a/src/libstd/sort.rs
+++ b/src/libstd/sort.rs
@@ -455,7 +455,7 @@ impl<T: Copy Ord> MergeState<T> {
                 base2: uint, len2: uint) {
         assert len1 != 0 && len2 != 0 && base1+len1 == base2;
 
-        let tmp = vec::cast_to_mut(vec::slice(array, base1, base1+len1));
+        let mut tmp = vec::slice(array, base1, base1+len1);
 
         let mut c1 = 0;
         let mut c2 = base2;
@@ -558,7 +558,7 @@ impl<T: Copy Ord> MergeState<T> {
                 base2: uint, len2: uint) {
         assert len1 != 1 && len2 != 0 && base1 + len1 == base2;
 
-        let tmp = vec::cast_to_mut(vec::slice(array, base2, base2+len2));
+        let mut tmp = vec::slice(array, base2, base2+len2);
 
         let mut c1 = base1 + len1 - 1;
         let mut c2 = len2 - 1;
diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs
index 593d26d0124..69116ace9e8 100644
--- a/src/libstd/workcache.rs
+++ b/src/libstd/workcache.rs
@@ -242,13 +242,13 @@ fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T {
 }
 
 fn digest<T:Encodable<json::Encoder>>(t: &T) -> ~str {
-    let sha = sha1::sha1();
+    let mut sha = sha1::sha1();
     sha.input_str(json_encode(t));
     sha.result_str()
 }
 
 fn digest_file(path: &Path) -> ~str {
-    let sha = sha1::sha1();
+    let mut sha = sha1::sha1();
     let s = io::read_whole_file_str(path);
     sha.input_str(*s.get_ref());
     sha.result_str()
diff --git a/src/test/bench/shootout-fannkuchredux.rs b/src/test/bench/shootout-fannkuchredux.rs
index bb790a94ae4..675151cf6c9 100644
--- a/src/test/bench/shootout-fannkuchredux.rs
+++ b/src/test/bench/shootout-fannkuchredux.rs
@@ -14,9 +14,9 @@ extern mod std;
 fn fannkuch(n: int) -> int {
     fn perm1init(i: uint) -> int { return i as int; }
 
-    let perm = vec::cast_to_mut(vec::from_elem(n as uint, 0));
-    let perm1 = vec::cast_to_mut(vec::from_fn(n as uint, |i| perm1init(i)));
-    let count = vec::cast_to_mut(vec::from_elem(n as uint, 0));
+    let mut perm = vec::from_elem(n as uint, 0);
+    let mut perm1 = vec::from_fn(n as uint, |i| perm1init(i));
+    let mut count = vec::from_elem(n as uint, 0);
     let mut f = 0;
     let mut i = 0;
     let mut k = 0;
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index 62341f08ce3..3afb86210e1 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -149,7 +149,7 @@ fn main() {
    // initialize each sequence sorter
    let sizes = ~[1,2,3,4,6,12,18];
     let streams = vec::map(sizes, |_sz| Some(stream()));
-    let streams = vec::cast_to_mut(move streams);
+    let mut streams = move streams;
     let mut from_child = ~[];
     let to_child   = vec::mapi(sizes, |ii, sz| {
         let sz = *sz;
diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs
index b679b832285..2b9a030fdf4 100644
--- a/src/test/bench/shootout-spectralnorm.rs
+++ b/src/test/bench/shootout-spectralnorm.rs
@@ -45,7 +45,7 @@ fn eval_At_times_u(u: &[const float], Au: &mut [float]) {
 }
 
 fn eval_AtA_times_u(u: &[const float], AtAu: &mut [float]) {
-    let v = vec::cast_to_mut(vec::from_elem(vec::len(u), 0.0));
+    let mut v = vec::from_elem(vec::len(u), 0.0);
     eval_A_times_u(u, v);
     eval_At_times_u(v, AtAu);
 }
@@ -62,8 +62,8 @@ fn main() {
 
     let N = uint::from_str(args[1]).get();
 
-    let u = vec::cast_to_mut(vec::from_elem(N, 1.0));
-    let v = vec::cast_to_mut(vec::from_elem(N, 0.0));
+    let mut u = vec::from_elem(N, 1.0);
+    let mut v = vec::from_elem(N, 0.0);
     let mut i = 0u;
     while i < 10u {
         eval_AtA_times_u(u, v);
diff --git a/src/test/compile-fail/issue-2548.rs b/src/test/compile-fail/issue-2548.rs
index 402e8ee831f..1b85bd9646e 100644
--- a/src/test/compile-fail/issue-2548.rs
+++ b/src/test/compile-fail/issue-2548.rs
@@ -33,8 +33,8 @@ fn main() {
     {
         let mut res = foo(x);
 
-        let mut v = ~[mut];
-        v = move ~[mut (move res)] + v; //~ ERROR does not fulfill `Copy`
+        let mut v = ~[];
+        v = move ~[(move 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/run-pass/import-in-block.rs b/src/test/run-pass/import-in-block.rs
index a41633c0b82..6ad33445997 100644
--- a/src/test/run-pass/import-in-block.rs
+++ b/src/test/run-pass/import-in-block.rs
@@ -9,6 +9,8 @@
 // except according to those terms.
 
 pub fn main() {
+    // Once cast_to_mut is removed, pick a better function to import
+    // for this test!
     use vec::cast_to_mut;
     log(debug, vec::len(cast_to_mut(~[1, 2])));
     {