From 6abfac083feafc73e5d736177755cce3bfb7153f Mon Sep 17 00:00:00 2001
From: Aaron Turon <aturon@mozilla.com>
Date: Tue, 30 Dec 2014 10:51:18 -0800
Subject: [PATCH] Fallout from stabilization

---
 src/compiletest/runtest.rs                    |   6 +-
 src/liballoc/arc.rs                           |   2 +-
 src/libcollections/binary_heap.rs             |   2 +-
 src/libcollections/bit.rs                     |  10 +-
 src/libcollections/btree/node.rs              |  66 ++++-----
 src/libcollections/dlist.rs                   |   6 +-
 src/libcollections/lib.rs                     |   4 +-
 src/libcollections/ring_buf.rs                |   6 +-
 src/libcollections/slice.rs                   | 128 ++++++++++--------
 src/libcollections/str.rs                     |  88 ++++--------
 src/libcollections/string.rs                  |   2 +-
 src/libcollections/vec.rs                     |  61 ++++-----
 src/libcollections/vec_map.rs                 |   2 +-
 src/libcore/iter.rs                           |   2 +-
 src/libcore/slice.rs                          |   6 +-
 src/libcoretest/slice.rs                      |  22 +--
 src/libgetopts/lib.rs                         |   2 +-
 src/librand/isaac.rs                          |  18 +--
 src/librbml/io.rs                             |   3 +-
 src/libregex/compile.rs                       |   3 +-
 src/libregex/parse.rs                         |   7 +-
 src/libregex/vm.rs                            |  18 +--
 src/librustc/metadata/encoder.rs              |   2 +-
 src/librustc/middle/check_match.rs            |  16 +--
 src/librustc/middle/dataflow.rs               |   9 +-
 src/librustc/middle/infer/error_reporting.rs  |   2 +-
 src/librustc/middle/infer/mod.rs              |   2 +-
 .../middle/infer/region_inference/mod.rs      |   9 +-
 src/librustc/middle/liveness.rs               |  13 +-
 src/librustc/middle/privacy.rs                |   5 +-
 src/librustc/middle/resolve_lifetime.rs       |   2 +-
 src/librustc/middle/subst.rs                  |   6 +-
 src/librustc/util/lev_distance.rs             |   2 +-
 src/librustc_back/sha2.rs                     |   6 +-
 src/librustc_borrowck/borrowck/fragments.rs   |   7 +-
 src/librustc_borrowck/lib.rs                  |   1 -
 src/librustc_driver/lib.rs                    |   8 +-
 src/librustc_resolve/lib.rs                   |  18 +--
 src/librustc_trans/trans/_match.rs            |   4 +-
 src/librustc_trans/trans/cabi_x86_64.rs       |   3 +-
 src/librustc_trans/trans/consts.rs            |   3 +-
 src/librustc_trans/trans/debuginfo.rs         |   5 +-
 src/librustc_trans/trans/expr.rs              |   3 +-
 src/librustc_trans/trans/type_.rs             |   5 +-
 src/librustc_typeck/astconv.rs                |  39 +++---
 src/librustc_typeck/check/_match.rs           |   3 +-
 src/librustc_typeck/check/method/confirm.rs   |   3 +-
 src/librustc_typeck/check/mod.rs              |  22 +--
 src/librustc_typeck/check/regionmanip.rs      |   1 -
 src/librustc_typeck/rscope.rs                 |   5 +-
 src/librustc_typeck/variance.rs               |   3 +-
 src/librustdoc/html/format.rs                 |   2 +-
 src/librustdoc/html/render.rs                 |   8 +-
 src/libstd/c_str.rs                           |   2 +-
 src/libstd/comm/sync.rs                       |   2 +-
 src/libstd/io/buffered.rs                     |   7 +-
 src/libstd/os.rs                              |   9 +-
 src/libstd/path/posix.rs                      |   2 +-
 src/libstd/path/windows.rs                    |   4 +-
 src/libstd/rt/args.rs                         |   4 +-
 src/libstd/sys/unix/timer.rs                  |  10 +-
 src/libstd/sys/windows/os.rs                  |   3 +-
 src/libstd/sys/windows/tty.rs                 |   3 +-
 src/libsyntax/ast_map/mod.rs                  |   4 +-
 src/libsyntax/ext/expand.rs                   |   2 +-
 src/libsyntax/ext/format.rs                   |  16 +--
 src/libsyntax/ext/tt/macro_parser.rs          |   5 +-
 src/libsyntax/print/pp.rs                     |   7 +-
 src/libsyntax/std_inject.rs                   |   2 +-
 src/libterm/terminfo/parm.rs                  |   7 +-
 src/libtest/lib.rs                            |   4 +-
 src/libunicode/normalize.rs                   |  14 +-
 src/libunicode/tables.rs                      |  36 ++---
 src/rust-installer                            |   2 +-
 src/test/bench/core-std.rs                    |   2 +-
 src/test/bench/shootout-reverse-complement.rs |   2 +-
 src/test/compile-fail/issue-15756.rs          |   4 +-
 .../resolve-conflict-type-vs-import.rs        |   1 -
 78 files changed, 410 insertions(+), 425 deletions(-)

diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 1abcd8bd214..d52de12ff5b 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -32,6 +32,7 @@ use std::io::process;
 use std::io::timer;
 use std::io;
 use std::os;
+use std::iter::repeat;
 use std::str;
 use std::string::String;
 use std::thread::Thread;
@@ -976,8 +977,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
                          proc_res: &ProcRes) {
 
     // true if we found the error in question
-    let mut found_flags = Vec::from_elem(
-        expected_errors.len(), false);
+    let mut found_flags: Vec<_> = repeat(false).take(expected_errors.len()).collect();
 
     if proc_res.status.success() {
         fatal("process did not return an error status");
@@ -1337,7 +1337,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) ->
     // Add the arguments in the run_flags directive
     args.extend(split_maybe_args(&props.run_flags).into_iter());
 
-    let prog = args.remove(0).unwrap();
+    let prog = args.remove(0);
     return ProcArgs {
         prog: prog,
         args: args,
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index 21c47cdf3d7..67058ea6a61 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -95,7 +95,7 @@ use heap::deallocate;
 /// use std::thread::Thread;
 ///
 /// fn main() {
-///     let numbers = Vec::from_fn(100, |i| i as f32);
+///     let numbers: Vec<_> = range(0, 100u32).map(|i| i as f32).collect();
 ///     let shared_numbers = Arc::new(numbers);
 ///
 ///     for _ in range(0u, 10) {
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs
index a2f38bb6674..0834eacabd0 100644
--- a/src/libcollections/binary_heap.rs
+++ b/src/libcollections/binary_heap.rs
@@ -66,7 +66,7 @@
 //! // for a simpler implementation.
 //! fn shortest_path(adj_list: &Vec<Vec<Edge>>, start: uint, goal: uint) -> uint {
 //!     // dist[node] = current shortest distance from `start` to `node`
-//!     let mut dist = Vec::from_elem(adj_list.len(), uint::MAX);
+//!     let mut dist: Vec<_> = range(0, adj_list.len()).map(|_| uint::MAX).collect();
 //!
 //!     let mut heap = BinaryHeap::new();
 //!
diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs
index 430d7210bf6..12faf3b5d5f 100644
--- a/src/libcollections/bit.rs
+++ b/src/libcollections/bit.rs
@@ -85,7 +85,7 @@ use core::prelude::*;
 use core::cmp;
 use core::default::Default;
 use core::fmt;
-use core::iter::{Cloned, Chain, Enumerate, Repeat, Skip, Take};
+use core::iter::{Cloned, Chain, Enumerate, Repeat, Skip, Take, repeat};
 use core::iter;
 use core::num::Int;
 use core::slice::{Iter, IterMut};
@@ -267,7 +267,7 @@ impl Bitv {
     pub fn from_elem(nbits: uint, bit: bool) -> Bitv {
         let nblocks = blocks_for_bits(nbits);
         let mut bitv = Bitv {
-            storage: Vec::from_elem(nblocks, if bit { !0u32 } else { 0u32 }),
+            storage: repeat(if bit { !0u32 } else { 0u32 }).take(nblocks).collect(),
             nbits: nbits
         };
         bitv.fix_last_block();
@@ -651,7 +651,7 @@ impl Bitv {
 
         let len = self.nbits/8 +
                   if self.nbits % 8 == 0 { 0 } else { 1 };
-        Vec::from_fn(len, |i|
+        range(0, len).map(|i|
             bit(self, i, 0) |
             bit(self, i, 1) |
             bit(self, i, 2) |
@@ -660,7 +660,7 @@ impl Bitv {
             bit(self, i, 5) |
             bit(self, i, 6) |
             bit(self, i, 7)
-        )
+        ).collect()
     }
 
     /// Deprecated: Use `iter().collect()`.
@@ -834,7 +834,7 @@ impl Bitv {
         // Allocate new words, if needed
         if new_nblocks > self.storage.len() {
             let to_add = new_nblocks - self.storage.len();
-            self.storage.grow(to_add, full_value);
+            self.storage.extend(repeat(full_value).take(to_add));
         }
 
         // Adjust internal bit count
diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs
index 2c3c546fdb7..9ed7cb18bc8 100644
--- a/src/libcollections/btree/node.rs
+++ b/src/libcollections/btree/node.rs
@@ -554,10 +554,10 @@ impl <K, V> Node<K, V> {
         let node = mem::replace(left_and_out, unsafe { Node::new_internal(capacity_from_b(b)) });
         left_and_out._len = 1;
         unsafe {
-            ptr::write(left_and_out.keys_mut().unsafe_mut(0), key);
-            ptr::write(left_and_out.vals_mut().unsafe_mut(0), value);
-            ptr::write(left_and_out.edges_mut().unsafe_mut(0), node);
-            ptr::write(left_and_out.edges_mut().unsafe_mut(1), right);
+            ptr::write(left_and_out.keys_mut().get_unchecked_mut(0), key);
+            ptr::write(left_and_out.vals_mut().get_unchecked_mut(0), value);
+            ptr::write(left_and_out.edges_mut().get_unchecked_mut(0), node);
+            ptr::write(left_and_out.edges_mut().get_unchecked_mut(1), right);
         }
     }
 
@@ -636,7 +636,7 @@ impl<'a, K: 'a, V: 'a> Handle<&'a Node<K, V>, handle::Edge, handle::Internal> {
     /// making it more suitable for moving down a chain of nodes.
     pub fn into_edge(self) -> &'a Node<K, V> {
         unsafe {
-            self.node.edges().unsafe_get(self.index)
+            self.node.edges().get_unchecked(self.index)
         }
     }
 }
@@ -647,7 +647,7 @@ impl<'a, K: 'a, V: 'a> Handle<&'a mut Node<K, V>, handle::Edge, handle::Internal
     /// `edge_mut`, making it more suitable for moving down a chain of nodes.
     pub fn into_edge_mut(self) -> &'a mut Node<K, V> {
         unsafe {
-            self.node.edges_mut().unsafe_mut(self.index)
+            self.node.edges_mut().get_unchecked_mut(self.index)
         }
     }
 }
@@ -721,7 +721,7 @@ impl<K, V, NodeRef: DerefMut<Node<K, V>>> Handle<NodeRef, handle::Edge, handle::
     /// confused with `node`, which references the parent node of what is returned here.
     pub fn edge_mut(&mut self) -> &mut Node<K, V> {
         unsafe {
-            self.node.edges_mut().unsafe_mut(self.index)
+            self.node.edges_mut().get_unchecked_mut(self.index)
         }
     }
 
@@ -829,8 +829,8 @@ impl<'a, K: 'a, V: 'a, NodeType> Handle<&'a Node<K, V>, handle::KV, NodeType> {
         let (keys, vals) = self.node.as_slices();
         unsafe {
             (
-                keys.unsafe_get(self.index),
-                vals.unsafe_get(self.index)
+                keys.get_unchecked(self.index),
+                vals.get_unchecked(self.index)
             )
         }
     }
@@ -844,8 +844,8 @@ impl<'a, K: 'a, V: 'a, NodeType> Handle<&'a mut Node<K, V>, handle::KV, NodeType
         let (keys, vals) = self.node.as_slices_mut();
         unsafe {
             (
-                keys.unsafe_mut(self.index),
-                vals.unsafe_mut(self.index)
+                keys.get_unchecked_mut(self.index),
+                vals.get_unchecked_mut(self.index)
             )
         }
     }
@@ -869,14 +869,14 @@ impl<'a, K: 'a, V: 'a, NodeRef: Deref<Node<K, V>> + 'a, NodeType> Handle<NodeRef
     // /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
     // /// handle.
     // pub fn key(&'a self) -> &'a K {
-    //     unsafe { self.node.keys().unsafe_get(self.index) }
+    //     unsafe { self.node.keys().get_unchecked(self.index) }
     // }
     //
     // /// Returns a reference to the value pointed-to by this handle. This doesn't return a
     // /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
     // /// handle.
     // pub fn val(&'a self) -> &'a V {
-    //     unsafe { self.node.vals().unsafe_get(self.index) }
+    //     unsafe { self.node.vals().get_unchecked(self.index) }
     // }
 }
 
@@ -886,14 +886,14 @@ impl<'a, K: 'a, V: 'a, NodeRef: DerefMut<Node<K, V>> + 'a, NodeType> Handle<Node
     /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
     /// handle.
     pub fn key_mut(&'a mut self) -> &'a mut K {
-        unsafe { self.node.keys_mut().unsafe_mut(self.index) }
+        unsafe { self.node.keys_mut().get_unchecked_mut(self.index) }
     }
 
     /// Returns a mutable reference to the value pointed-to by this handle. This doesn't return a
     /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
     /// handle.
     pub fn val_mut(&'a mut self) -> &'a mut V {
-        unsafe { self.node.vals_mut().unsafe_mut(self.index) }
+        unsafe { self.node.vals_mut().get_unchecked_mut(self.index) }
     }
 }
 
@@ -1077,7 +1077,7 @@ impl<K, V> Node<K, V> {
         debug_assert!(!self.is_leaf());
 
         unsafe {
-            let ret = ptr::read(self.edges().unsafe_get(0));
+            let ret = ptr::read(self.edges().get_unchecked(0));
             self.destroy();
             ptr::write(self, ret);
         }
@@ -1091,8 +1091,8 @@ impl<K, V> Node<K, V> {
     unsafe fn push_kv(&mut self, key: K, val: V) {
         let len = self.len();
 
-        ptr::write(self.keys_mut().unsafe_mut(len), key);
-        ptr::write(self.vals_mut().unsafe_mut(len), val);
+        ptr::write(self.keys_mut().get_unchecked_mut(len), key);
+        ptr::write(self.vals_mut().get_unchecked_mut(len), val);
 
         self._len += 1;
     }
@@ -1102,7 +1102,7 @@ impl<K, V> Node<K, V> {
     unsafe fn push_edge(&mut self, edge: Node<K, V>) {
         let len = self.len();
 
-        ptr::write(self.edges_mut().unsafe_mut(len), edge);
+        ptr::write(self.edges_mut().get_unchecked_mut(len), edge);
     }
 
     // This must be followed by insert_edge on an internal node.
@@ -1119,12 +1119,12 @@ impl<K, V> Node<K, V> {
             self.len() - index
         );
 
-        ptr::write(self.keys_mut().unsafe_mut(index), key);
-        ptr::write(self.vals_mut().unsafe_mut(index), val);
+        ptr::write(self.keys_mut().get_unchecked_mut(index), key);
+        ptr::write(self.vals_mut().get_unchecked_mut(index), val);
 
         self._len += 1;
 
-        self.vals_mut().unsafe_mut(index)
+        self.vals_mut().get_unchecked_mut(index)
     }
 
     // This can only be called immediately after a call to insert_kv.
@@ -1135,14 +1135,14 @@ impl<K, V> Node<K, V> {
             self.edges().as_ptr().offset(index as int),
             self.len() - index
         );
-        ptr::write(self.edges_mut().unsafe_mut(index), edge);
+        ptr::write(self.edges_mut().get_unchecked_mut(index), edge);
     }
 
     // This must be followed by pop_edge on an internal node.
     #[inline]
     unsafe fn pop_kv(&mut self) -> (K, V) {
-        let key = ptr::read(self.keys().unsafe_get(self.len() - 1));
-        let val = ptr::read(self.vals().unsafe_get(self.len() - 1));
+        let key = ptr::read(self.keys().get_unchecked(self.len() - 1));
+        let val = ptr::read(self.vals().get_unchecked(self.len() - 1));
 
         self._len -= 1;
 
@@ -1152,7 +1152,7 @@ impl<K, V> Node<K, V> {
     // This can only be called immediately after a call to pop_kv.
     #[inline]
     unsafe fn pop_edge(&mut self) -> Node<K, V> {
-        let edge = ptr::read(self.edges().unsafe_get(self.len() + 1));
+        let edge = ptr::read(self.edges().get_unchecked(self.len() + 1));
 
         edge
     }
@@ -1160,8 +1160,8 @@ impl<K, V> Node<K, V> {
     // This must be followed by remove_edge on an internal node.
     #[inline]
     unsafe fn remove_kv(&mut self, index: uint) -> (K, V) {
-        let key = ptr::read(self.keys().unsafe_get(index));
-        let val = ptr::read(self.vals().unsafe_get(index));
+        let key = ptr::read(self.keys().get_unchecked(index));
+        let val = ptr::read(self.vals().get_unchecked(index));
 
         ptr::copy_memory(
             self.keys_mut().as_mut_ptr().offset(index as int),
@@ -1182,7 +1182,7 @@ impl<K, V> Node<K, V> {
     // This can only be called immediately after a call to remove_kv.
     #[inline]
     unsafe fn remove_edge(&mut self, index: uint) -> Node<K, V> {
-        let edge = ptr::read(self.edges().unsafe_get(index));
+        let edge = ptr::read(self.edges().get_unchecked(index));
 
         ptr::copy_memory(
             self.edges_mut().as_mut_ptr().offset(index as int),
@@ -1229,8 +1229,8 @@ impl<K, V> Node<K, V> {
                 );
             }
 
-            let key = ptr::read(self.keys().unsafe_get(right_offset - 1));
-            let val = ptr::read(self.vals().unsafe_get(right_offset - 1));
+            let key = ptr::read(self.keys().get_unchecked(right_offset - 1));
+            let val = ptr::read(self.vals().get_unchecked(right_offset - 1));
 
             self._len = right_offset - 1;
 
@@ -1249,8 +1249,8 @@ impl<K, V> Node<K, V> {
             let old_len = self.len();
             self._len += right.len() + 1;
 
-            ptr::write(self.keys_mut().unsafe_mut(old_len), key);
-            ptr::write(self.vals_mut().unsafe_mut(old_len), val);
+            ptr::write(self.keys_mut().get_unchecked_mut(old_len), key);
+            ptr::write(self.vals_mut().get_unchecked_mut(old_len), val);
 
             ptr::copy_nonoverlapping_memory(
                 self.keys_mut().as_mut_ptr().offset(old_len as int + 1),
diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs
index d8ce79f4fe9..4eaaad07c99 100644
--- a/src/libcollections/dlist.rs
+++ b/src/libcollections/dlist.rs
@@ -1290,8 +1290,10 @@ mod tests {
                     v.pop();
                 }
                 1 => {
-                    m.pop_front();
-                    v.remove(0);
+                    if !v.is_empty() {
+                        m.pop_front();
+                        v.remove(0);
+                    }
                 }
                 2 | 4 =>  {
                     m.push_front(-i);
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index fe9d8de440a..688214140c1 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -128,8 +128,8 @@ mod prelude {
     pub use unicode::char::UnicodeChar;
 
     // from collections.
-    pub use slice::{CloneSliceExt, VectorVector};
-    pub use str::{IntoMaybeOwned, StrVector};
+    pub use slice::{CloneSliceExt, SliceConcatExt};
+    pub use str::IntoMaybeOwned;
     pub use string::{String, ToString};
     pub use vec::Vec;
 }
diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs
index df8e08f07a3..82b24e627d9 100644
--- a/src/libcollections/ring_buf.rs
+++ b/src/libcollections/ring_buf.rs
@@ -1137,7 +1137,7 @@ impl<'a, T> Iterator<&'a T> for Iter<'a, T> {
         }
         let tail = self.tail;
         self.tail = wrap_index(self.tail + 1, self.ring.len());
-        unsafe { Some(self.ring.unsafe_get(tail)) }
+        unsafe { Some(self.ring.get_unchecked(tail)) }
     }
 
     #[inline]
@@ -1154,7 +1154,7 @@ impl<'a, T> DoubleEndedIterator<&'a T> for Iter<'a, T> {
             return None;
         }
         self.head = wrap_index(self.head - 1, self.ring.len());
-        unsafe { Some(self.ring.unsafe_get(self.head)) }
+        unsafe { Some(self.ring.get_unchecked(self.head)) }
     }
 }
 
@@ -1173,7 +1173,7 @@ impl<'a, T> RandomAccessIterator<&'a T> for Iter<'a, T> {
             None
         } else {
             let idx = wrap_index(self.tail + j, self.ring.len());
-            unsafe { Some(self.ring.unsafe_get(idx)) }
+            unsafe { Some(self.ring.get_unchecked(idx)) }
         }
     }
 }
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 375ba38f29a..385380bb797 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -96,20 +96,26 @@ use core::mem::size_of;
 use core::mem;
 use core::ops::{FnMut,SliceMut};
 use core::prelude::{Clone, Greater, Iterator, IteratorExt, Less, None, Option};
-use core::prelude::{Ord, Ordering, RawPtr, Some, range, IteratorCloneExt, Result};
+use core::prelude::{Ord, Ordering, PtrExt, Some, range, IteratorCloneExt, Result};
 use core::ptr;
 use core::slice as core_slice;
 use self::Direction::*;
 
 use vec::Vec;
 
-pub use core::slice::{Chunks, AsSlice, SplitN, Windows};
+pub use core::slice::{Chunks, AsSlice, Windows};
 pub use core::slice::{Iter, IterMut, PartialEqSliceExt};
 pub use core::slice::{IntSliceExt, SplitMut, ChunksMut, Split};
 pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
 pub use core::slice::{bytes, mut_ref_slice, ref_slice};
 pub use core::slice::{from_raw_buf, from_raw_mut_buf};
 
+#[deprecated = "use Iter instead"]
+pub type Items<'a, T:'a> = Iter<'a, T>;
+
+#[deprecated = "use IterMut instead"]
+pub type MutItems<'a, T:'a> = IterMut<'a, T>;
+
 ////////////////////////////////////////////////////////////////////////////////
 // Basic slice extension methods
 ////////////////////////////////////////////////////////////////////////////////
@@ -1412,7 +1418,7 @@ mod tests {
     use prelude::{Some, None, range, Vec, ToString, Clone, Greater, Less, Equal};
     use prelude::{SliceExt, Iterator, IteratorExt, DoubleEndedIteratorExt};
     use prelude::{OrdSliceExt, CloneSliceExt, PartialEqSliceExt, AsSlice};
-    use prelude::{RandomAccessIterator, Ord, VectorVector};
+    use prelude::{RandomAccessIterator, Ord, SliceConcatExt};
     use core::cell::Cell;
     use core::default::Default;
     use core::mem;
@@ -1678,15 +1684,19 @@ mod tests {
     fn test_swap_remove() {
         let mut v = vec![1i, 2, 3, 4, 5];
         let mut e = v.swap_remove(0);
-        assert_eq!(e, Some(1));
+        assert_eq!(e, 1);
         assert_eq!(v, vec![5i, 2, 3, 4]);
         e = v.swap_remove(3);
-        assert_eq!(e, Some(4));
+        assert_eq!(e, 4);
         assert_eq!(v, vec![5i, 2, 3]);
+    }
 
-        e = v.swap_remove(3);
-        assert_eq!(e, None);
-        assert_eq!(v, vec![5i, 2, 3]);
+    #[test]
+    #[should_fail]
+    fn test_swap_remove_fail() {
+        let mut v = vec![1i];
+        let _ = v.swap_remove(0);
+        let _ = v.swap_remove(0);
     }
 
     #[test]
@@ -1970,48 +1980,48 @@ mod tests {
     }
 
     #[test]
-    fn test_binary_search_elem() {
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&5).found(), Some(4));
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&4).found(), Some(3));
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&3).found(), Some(2));
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&2).found(), Some(1));
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&1).found(), Some(0));
+    fn test_binary_search() {
+        assert_eq!([1i,2,3,4,5].binary_search(&5).ok(), Some(4));
+        assert_eq!([1i,2,3,4,5].binary_search(&4).ok(), Some(3));
+        assert_eq!([1i,2,3,4,5].binary_search(&3).ok(), Some(2));
+        assert_eq!([1i,2,3,4,5].binary_search(&2).ok(), Some(1));
+        assert_eq!([1i,2,3,4,5].binary_search(&1).ok(), Some(0));
 
-        assert_eq!([2i,4,6,8,10].binary_search_elem(&1).found(), None);
-        assert_eq!([2i,4,6,8,10].binary_search_elem(&5).found(), None);
-        assert_eq!([2i,4,6,8,10].binary_search_elem(&4).found(), Some(1));
-        assert_eq!([2i,4,6,8,10].binary_search_elem(&10).found(), Some(4));
+        assert_eq!([2i,4,6,8,10].binary_search(&1).ok(), None);
+        assert_eq!([2i,4,6,8,10].binary_search(&5).ok(), None);
+        assert_eq!([2i,4,6,8,10].binary_search(&4).ok(), Some(1));
+        assert_eq!([2i,4,6,8,10].binary_search(&10).ok(), Some(4));
 
-        assert_eq!([2i,4,6,8].binary_search_elem(&1).found(), None);
-        assert_eq!([2i,4,6,8].binary_search_elem(&5).found(), None);
-        assert_eq!([2i,4,6,8].binary_search_elem(&4).found(), Some(1));
-        assert_eq!([2i,4,6,8].binary_search_elem(&8).found(), Some(3));
+        assert_eq!([2i,4,6,8].binary_search(&1).ok(), None);
+        assert_eq!([2i,4,6,8].binary_search(&5).ok(), None);
+        assert_eq!([2i,4,6,8].binary_search(&4).ok(), Some(1));
+        assert_eq!([2i,4,6,8].binary_search(&8).ok(), Some(3));
 
-        assert_eq!([2i,4,6].binary_search_elem(&1).found(), None);
-        assert_eq!([2i,4,6].binary_search_elem(&5).found(), None);
-        assert_eq!([2i,4,6].binary_search_elem(&4).found(), Some(1));
-        assert_eq!([2i,4,6].binary_search_elem(&6).found(), Some(2));
+        assert_eq!([2i,4,6].binary_search(&1).ok(), None);
+        assert_eq!([2i,4,6].binary_search(&5).ok(), None);
+        assert_eq!([2i,4,6].binary_search(&4).ok(), Some(1));
+        assert_eq!([2i,4,6].binary_search(&6).ok(), Some(2));
 
-        assert_eq!([2i,4].binary_search_elem(&1).found(), None);
-        assert_eq!([2i,4].binary_search_elem(&5).found(), None);
-        assert_eq!([2i,4].binary_search_elem(&2).found(), Some(0));
-        assert_eq!([2i,4].binary_search_elem(&4).found(), Some(1));
+        assert_eq!([2i,4].binary_search(&1).ok(), None);
+        assert_eq!([2i,4].binary_search(&5).ok(), None);
+        assert_eq!([2i,4].binary_search(&2).ok(), Some(0));
+        assert_eq!([2i,4].binary_search(&4).ok(), Some(1));
 
-        assert_eq!([2i].binary_search_elem(&1).found(), None);
-        assert_eq!([2i].binary_search_elem(&5).found(), None);
-        assert_eq!([2i].binary_search_elem(&2).found(), Some(0));
+        assert_eq!([2i].binary_search(&1).ok(), None);
+        assert_eq!([2i].binary_search(&5).ok(), None);
+        assert_eq!([2i].binary_search(&2).ok(), Some(0));
 
-        assert_eq!([].binary_search_elem(&1i).found(), None);
-        assert_eq!([].binary_search_elem(&5i).found(), None);
+        assert_eq!([].binary_search(&1i).ok(), None);
+        assert_eq!([].binary_search(&5i).ok(), None);
 
-        assert!([1i,1,1,1,1].binary_search_elem(&1).found() != None);
-        assert!([1i,1,1,1,2].binary_search_elem(&1).found() != None);
-        assert!([1i,1,1,2,2].binary_search_elem(&1).found() != None);
-        assert!([1i,1,2,2,2].binary_search_elem(&1).found() != None);
-        assert_eq!([1i,2,2,2,2].binary_search_elem(&1).found(), Some(0));
+        assert!([1i,1,1,1,1].binary_search(&1).ok() != None);
+        assert!([1i,1,1,1,2].binary_search(&1).ok() != None);
+        assert!([1i,1,1,2,2].binary_search(&1).ok() != None);
+        assert!([1i,1,2,2,2].binary_search(&1).ok() != None);
+        assert_eq!([1i,2,2,2,2].binary_search(&1).ok(), Some(0));
 
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&6).found(), None);
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&0).found(), None);
+        assert_eq!([1i,2,3,4,5].binary_search(&6).ok(), None);
+        assert_eq!([1i,2,3,4,5].binary_search(&0).ok(), None);
     }
 
     #[test]
@@ -2106,13 +2116,15 @@ mod tests {
     #[test]
     fn test_concat() {
         let v: [Vec<int>, ..0] = [];
-        assert_eq!(v.concat_vec(), vec![]);
-        assert_eq!([vec![1i], vec![2i,3i]].concat_vec(), vec![1, 2, 3]);
+        let c: Vec<int> = v.concat();
+        assert_eq!(c, []);
+        let d: Vec<int> = [vec![1i], vec![2i,3i]].concat();
+        assert_eq!(d, vec![1i, 2, 3]);
 
         let v: [&[int], ..2] = [&[1], &[2, 3]];
-        assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 3]);
-        let v: [&[int], ..3] = [&[1], &[2], &[3]];
-        assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 0, 3]);
+        assert_eq!(v.connect(&0), vec![1i, 0, 2, 3]);
+        let v: [&[int], ..3] = [&[1i], &[2], &[3]];
+        assert_eq!(v.connect(&0), vec![1i, 0, 2, 0, 3]);
     }
 
     #[test]
@@ -2158,23 +2170,25 @@ mod tests {
     fn test_remove() {
         let mut a = vec![1i,2,3,4];
 
-        assert_eq!(a.remove(2), Some(3));
+        assert_eq!(a.remove(2), 3);
         assert_eq!(a, vec![1i,2,4]);
 
-        assert_eq!(a.remove(2), Some(4));
+        assert_eq!(a.remove(2), 4);
         assert_eq!(a, vec![1i,2]);
 
-        assert_eq!(a.remove(2), None);
-        assert_eq!(a, vec![1i,2]);
-
-        assert_eq!(a.remove(0), Some(1));
+        assert_eq!(a.remove(0), 1);
         assert_eq!(a, vec![2i]);
 
-        assert_eq!(a.remove(0), Some(2));
+        assert_eq!(a.remove(0), 2);
         assert_eq!(a, vec![]);
+    }
 
-        assert_eq!(a.remove(0), None);
-        assert_eq!(a.remove(10), None);
+    #[test]
+    #[should_fail]
+    fn test_remove_fail() {
+        let mut a = vec![1i];
+        let _ = a.remove(0);
+        let _ = a.remove(0);
     }
 
     #[test]
@@ -2870,7 +2884,7 @@ mod bench {
         let xss: Vec<Vec<uint>> =
             Vec::from_fn(100, |i| range(0u, i).collect());
         b.iter(|| {
-            xss.as_slice().concat_vec()
+            xss.as_slice().concat();
         });
     }
 
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 60449c817cb..8d5d76f9598 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -96,40 +96,43 @@ Section: Creating a string
 
 impl<S: Str> SliceConcatExt<str, String> for [S] {
     fn concat(&self) -> String {
-        if self.is_empty() {
+        let s = self.as_slice();
+
+        if s.is_empty() {
             return String::new();
         }
 
         // `len` calculation may overflow but push_str will check boundaries
-        let len = self.iter().map(|s| s.as_slice().len()).sum();
-
+        let len = s.iter().map(|s| s.as_slice().len()).sum();
         let mut result = String::with_capacity(len);
 
-        for s in self.iter() {
-            result.push_str(s.as_slice());
+        for s in s.iter() {
+            result.push_str(s.as_slice())
         }
 
         result
     }
 
     fn connect(&self, sep: &str) -> String {
-        if self.is_empty() {
+        let s = self.as_slice();
+
+        if s.is_empty() {
             return String::new();
         }
 
         // concat is faster
         if sep.is_empty() {
-            return self.concat();
+            return s.concat();
         }
 
         // this is wrong without the guarantee that `self` is non-empty
         // `len` calculation may overflow but push_str but will check boundaries
-        let len = sep.len() * (self.len() - 1)
-            + self.iter().map(|s| s.as_slice().len()).sum();
+        let len = sep.len() * (s.len() - 1)
+            + s.iter().map(|s| s.as_slice().len()).sum();
         let mut result = String::with_capacity(len);
         let mut first = true;
 
-        for s in self.iter() {
+        for s in s.iter() {
             if first {
                 first = false;
             } else {
@@ -141,11 +144,6 @@ impl<S: Str> SliceConcatExt<str, String> for [S] {
     }
 }
 
-impl<S: Str> SliceConcatExt<str, String> for Vec<S> {
-    fn concat(&self) -> String { self[].concat() }
-    fn connect(&self, sep: &str) -> String { self[].connect(sep) }
-}
-
 /*
 Section: Iterators
 */
@@ -186,7 +184,7 @@ pub struct Decompositions<'a> {
 impl<'a> Iterator<char> for Decompositions<'a> {
     #[inline]
     fn next(&mut self) -> Option<char> {
-        match self.buffer.head() {
+        match self.buffer.first() {
             Some(&(c, 0)) => {
                 self.sorted = false;
                 self.buffer.remove(0);
@@ -233,13 +231,16 @@ impl<'a> Iterator<char> for Decompositions<'a> {
             self.sorted = true;
         }
 
-        match self.buffer.remove(0) {
-            Some((c, 0)) => {
-                self.sorted = false;
-                Some(c)
+        if self.buffer.is_empty() {
+            None
+        } else {
+            match self.buffer.remove(0) {
+                (c, 0) => {
+                    self.sorted = false;
+                    Some(c)
+                }
+                (c, _) => Some(c),
             }
-            Some((c, _)) => Some(c),
-            None => None
         }
     }
 
@@ -712,7 +713,7 @@ pub trait StrExt for Sized?: ops::Slice<uint, str> {
         if me.is_empty() { return t.chars().count(); }
         if t.is_empty() { return me.chars().count(); }
 
-        let mut dcol = Vec::from_fn(t.len() + 1, |x| x);
+        let mut dcol: Vec<_> = range(0, t.len() + 1).collect();
         let mut t_last = 0;
 
         for (i, sc) in me.chars().enumerate() {
@@ -1857,22 +1858,12 @@ mod tests {
         assert_eq!("ะเทศไท", "ประเทศไทย中华Việt Nam".slice_chars(2, 8));
     }
 
-    struct S {
-        x: [String, .. 2]
-    }
-
-    impl AsSlice<String> for S {
-        fn as_slice<'a> (&'a self) -> &'a [String] {
-            &self.x
-        }
-    }
-
     fn s(x: &str) -> String { x.into_string() }
 
     macro_rules! test_concat {
         ($expected: expr, $string: expr) => {
             {
-                let s = $string.concat();
+                let s: String = $string.concat();
                 assert_eq!($expected, s);
             }
         }
@@ -1880,22 +1871,10 @@ mod tests {
 
     #[test]
     fn test_concat_for_different_types() {
-        test_concat!("ab", ["a", "b"]);
-        test_concat!("ab", [s("a"), s("b")]);
+        test_concat!("ab", vec![s("a"), s("b")]);
         test_concat!("ab", vec!["a", "b"]);
         test_concat!("ab", vec!["a", "b"].as_slice());
         test_concat!("ab", vec![s("a"), s("b")]);
-
-        let mut v0 = ["a", "b"];
-        let mut v1 = [s("a"), s("b")];
-        unsafe {
-            use std::c_vec::CVec;
-
-            test_concat!("ab", CVec::new(v0.as_mut_ptr(), v0.len()));
-            test_concat!("ab", CVec::new(v1.as_mut_ptr(), v1.len()));
-        }
-
-        test_concat!("ab", S { x: [s("a"), s("b")] });
     }
 
     #[test]
@@ -1924,17 +1903,6 @@ mod tests {
         test_connect!("a-b", vec!["a", "b"], hyphen.as_slice());
         test_connect!("a-b", vec!["a", "b"].as_slice(), "-");
         test_connect!("a-b", vec![s("a"), s("b")], "-");
-
-        let mut v0 = ["a", "b"];
-        let mut v1 = [s("a"), s("b")];
-        unsafe {
-            use std::c_vec::CVec;
-
-            test_connect!("a-b", CVec::new(v0.as_mut_ptr(), v0.len()), "-");
-            test_connect!("a-b", CVec::new(v1.as_mut_ptr(), v1.len()), hyphen.as_slice());
-        }
-
-        test_connect!("a-b", S { x: [s("a"), s("b")] }, "-");
     }
 
     #[test]
@@ -3304,7 +3272,7 @@ mod tests {
 #[cfg(test)]
 mod bench {
     use super::*;
-    use prelude::{SliceExt, IteratorExt, DoubleEndedIteratorExt};
+    use prelude::{SliceExt, IteratorExt, DoubleEndedIteratorExt, SliceConcatExt};
     use test::Bencher;
     use test::black_box;
 
@@ -3467,7 +3435,7 @@ mod bench {
     fn bench_connect(b: &mut Bencher) {
         let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
         let sep = "→";
-        let v = [s, s, s, s, s, s, s, s, s, s];
+        let v = vec![s, s, s, s, s, s, s, s, s, s];
         b.iter(|| {
             assert_eq!(v.connect(sep).len(), s.len() * 10 + sep.len() * 9);
         })
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index c6c19cae75f..433384b625f 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -151,7 +151,7 @@ impl String {
         let mut i = 0;
         let total = v.len();
         fn unsafe_get(xs: &[u8], i: uint) -> u8 {
-            unsafe { *xs.unsafe_get(i) }
+            unsafe { *xs.get_unchecked(i) }
         }
         fn safe_get(xs: &[u8], i: uint, total: uint) -> u8 {
             if i >= total {
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 2d71705d80d..a694242d1cc 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -173,8 +173,7 @@ impl<T> Vec<T> {
     ///
     /// It is important to note that this function does not specify the *length* of the returned
     /// vector, but only the *capacity*. (For an explanation of the difference between length and
-    /// capacity, see the main `Vec<T>` docs above, 'Capacity and reallocation'.) To create a
-    /// vector of a given length, use `Vec::from_elem` or `Vec::from_fn`.
+    /// capacity, see the main `Vec<T>` docs above, 'Capacity and reallocation'.)
     ///
     /// # Examples
     ///
@@ -272,7 +271,7 @@ impl<T> Vec<T> {
     /// Deprecated: use `into_iter().partition(f)` instead.
     #[inline]
     #[deprecated = "use into_iter().partition(f) instead"]
-    pub fn partition<F>(self, mut f: F) -> (Vec<T>, Vec<T>) where F: FnMut(&T) -> bool {
+    pub fn partition<F>(self, f: F) -> (Vec<T>, Vec<T>) where F: FnMut(&T) -> bool {
         self.into_iter().partition(f)
     }
 
@@ -298,7 +297,7 @@ impl<T> Vec<T> {
     }
 
     /// Reserves capacity for at least `additional` more elements to be inserted in the given
-    /// `Vec`. The collection may reserve more space to avoid frequent reallocations.
+    /// `Vec<T>`. The collection may reserve more space to avoid frequent reallocations.
     ///
     /// # Panics
     ///
@@ -322,7 +321,7 @@ impl<T> Vec<T> {
     }
 
     /// Reserves the minimum capacity for exactly `additional` more elements to
-    /// be inserted in the given `Vec`. Does nothing if the capacity is already
+    /// be inserted in the given `Vec<T>`. Does nothing if the capacity is already
     /// sufficient.
     ///
     /// Note that the allocator may give the collection more space than it
@@ -350,9 +349,10 @@ impl<T> Vec<T> {
         }
     }
 
-    /// Shrinks the capacity of the vector as much as possible. It will drop
-    /// down as close as possible to the length but the allocator may still
-    /// inform the vector that there is space for a few more elements.
+    /// Shrinks the capacity of the vector as much as possible.
+    ///
+    /// It will drop down as close as possible to the length but the allocator
+    /// may still inform the vector that there is space for a few more elements.
     ///
     /// # Examples
     ///
@@ -370,7 +370,7 @@ impl<T> Vec<T> {
         if self.len == 0 {
             if self.cap != 0 {
                 unsafe {
-                    dealloc(self.ptr, self.cap)
+                    dealloc(*self.ptr, self.cap)
                 }
                 self.cap = 0;
             }
@@ -378,11 +378,12 @@ impl<T> Vec<T> {
             unsafe {
                 // Overflow check is unnecessary as the vector is already at
                 // least this large.
-                self.ptr = reallocate(self.ptr as *mut u8,
-                                      self.cap * mem::size_of::<T>(),
-                                      self.len * mem::size_of::<T>(),
-                                      mem::min_align_of::<T>()) as *mut T;
-                if self.ptr.is_null() { ::alloc::oom() }
+                let ptr = reallocate(*self.ptr as *mut u8,
+                                     self.cap * mem::size_of::<T>(),
+                                     self.len * mem::size_of::<T>(),
+                                     mem::min_align_of::<T>()) as *mut T;
+                if ptr.is_null() { ::alloc::oom() }
+                self.ptr = NonZero::new(ptr);
             }
             self.cap = self.len;
         }
@@ -443,15 +444,15 @@ impl<T> Vec<T> {
     pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
         unsafe {
             mem::transmute(RawSlice {
-                data: self.ptr as *const T,
+                data: *self.ptr as *const T,
                 len: self.len,
             })
         }
     }
 
-    /// Creates a consuming iterator, that is, one that moves each
-    /// value out of the vector (from start to end). The vector cannot
-    /// be used after calling this.
+    /// Creates a consuming iterator, that is, one that moves each value out of
+    /// the vector (from start to end). The vector cannot be used after calling
+    /// this.
     ///
     /// # Examples
     ///
@@ -466,9 +467,9 @@ impl<T> Vec<T> {
     #[stable]
     pub fn into_iter(self) -> IntoIter<T> {
         unsafe {
-            let ptr = self.ptr;
+            let ptr = *self.ptr;
             let cap = self.cap;
-            let begin = self.ptr as *const T;
+            let begin = ptr as *const T;
             let end = if mem::size_of::<T>() == 0 {
                 (ptr as uint + self.len()) as *const T
             } else {
@@ -512,13 +513,11 @@ impl<T> Vec<T> {
     /// ```
     /// let mut v = vec!["foo", "bar", "baz", "qux"];
     ///
-    /// assert_eq!(v.swap_remove(1), Some("bar"));
+    /// assert_eq!(v.swap_remove(1), "bar");
     /// assert_eq!(v, vec!["foo", "qux", "baz"]);
     ///
-    /// assert_eq!(v.swap_remove(0), Some("foo"));
+    /// assert_eq!(v.swap_remove(0), "foo");
     /// assert_eq!(v, vec!["baz", "qux"]);
-    ///
-    /// assert_eq!(v.swap_remove(2), None);
     /// ```
     #[inline]
     #[stable]
@@ -577,11 +576,7 @@ impl<T> Vec<T> {
     ///
     /// ```
     /// let mut v = vec![1i, 2, 3];
-    /// assert_eq!(v.remove(1), Some(2));
-    /// assert_eq!(v, vec![1, 3]);
-    ///
-    /// assert_eq!(v.remove(4), None);
-    /// // v is unchanged:
+    /// assert_eq!(v.remove(1), 2);
     /// assert_eq!(v, vec![1, 3]);
     /// ```
     #[stable]
@@ -1185,8 +1180,9 @@ impl<T> Vec<T> {
             let size = capacity.checked_mul(mem::size_of::<T>())
                                .expect("capacity overflow");
             unsafe {
-                self.ptr = alloc_or_realloc(self.ptr, self.cap * mem::size_of::<T>(), size);
-                if self.ptr.is_null() { ::alloc::oom() }
+                let ptr = alloc_or_realloc(*self.ptr, self.cap * mem::size_of::<T>(), size);
+                if ptr.is_null() { ::alloc::oom() }
+                self.ptr = NonZero::new(ptr);
             }
             self.cap = capacity;
         }
@@ -2207,9 +2203,10 @@ mod tests {
     }
 
     #[test]
+    #[should_fail]
     fn test_swap_remove_empty() {
         let mut vec: Vec<uint> = vec!();
-        assert_eq!(vec.swap_remove(0), None);
+        vec.swap_remove(0);
     }
 
     #[test]
diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs
index 5ebcc736624..42d4a28405c 100644
--- a/src/libcollections/vec_map.rs
+++ b/src/libcollections/vec_map.rs
@@ -448,7 +448,7 @@ impl<V> VecMap<V> {
     pub fn insert(&mut self, key: uint, value: V) -> Option<V> {
         let len = self.v.len();
         if len <= key {
-            self.v.grow_fn(key - len + 1, |_| None);
+            self.v.extend(range(0, key - len + 1).map(|_| None));
         }
         replace(&mut self.v[key], Some(value))
     }
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index a185ec56a00..b0fd52896fe 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -478,7 +478,7 @@ pub trait IteratorExt<A>: Iterator<A> {
     ///
     /// ```
     /// let vec = vec![1i, 2i, 3i, 4i];
-    /// let (even, odd): (Vec<int>, Vec<Int>) = vec.into_iter().partition(|&n| n % 2 == 0);
+    /// let (even, odd): (Vec<int>, Vec<int>) = vec.into_iter().partition(|&n| n % 2 == 0);
     /// assert_eq!(even, vec![2, 4]);
     /// assert_eq!(odd, vec![1, 3]);
     /// ```
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 38d8977c0aa..1bf05247a67 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -46,6 +46,8 @@ use num::Int;
 use ops::{FnMut, mod};
 use option::Option;
 use option::Option::{None, Some};
+use result::Result;
+use result::Result::{Ok, Err};
 use ptr;
 use ptr::PtrExt;
 use mem;
@@ -237,7 +239,7 @@ impl<T> SliceExt<T> for [T] {
     }
 
     #[unstable]
-    fn binary_search_by<F>(&self, mut f: F) -> Result where
+    fn binary_search_by<F>(&self, mut f: F) -> Result<uint, uint> where
         F: FnMut(&T) -> Ordering
     {
         let mut base : uint = 0;
@@ -255,7 +257,7 @@ impl<T> SliceExt<T> for [T] {
             }
             lim >>= 1;
         }
-        Err(base);
+        Err(base)
     }
 
     #[inline]
diff --git a/src/libcoretest/slice.rs b/src/libcoretest/slice.rs
index 987da903211..9ef7d603059 100644
--- a/src/libcoretest/slice.rs
+++ b/src/libcoretest/slice.rs
@@ -8,30 +8,30 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::slice::BinarySearchResult::{Found, NotFound};
+use core::result::Result::{Ok, Err};
 
 #[test]
 fn binary_search_not_found() {
     let b = [1i, 2, 4, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&6)) == Found(3));
+    assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3));
     let b = [1i, 2, 4, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&5)) == NotFound(3));
+    assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3));
     let b = [1i, 2, 4, 6, 7, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&6)) == Found(3));
+    assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3));
     let b = [1i, 2, 4, 6, 7, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&5)) == NotFound(3));
+    assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3));
     let b = [1i, 2, 4, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&8)) == Found(4));
+    assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(4));
     let b = [1i, 2, 4, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&7)) == NotFound(4));
+    assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(4));
     let b = [1i, 2, 4, 6, 7, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&8)) == Found(5));
+    assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(5));
     let b = [1i, 2, 4, 5, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&7)) == NotFound(5));
+    assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(5));
     let b = [1i, 2, 4, 5, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&0)) == NotFound(0));
+    assert!(b.binary_search_by(|v| v.cmp(&0)) == Err(0));
     let b = [1i, 2, 4, 5, 6, 8];
-    assert!(b.binary_search(|v| v.cmp(&9)) == NotFound(6));
+    assert!(b.binary_search_by(|v| v.cmp(&9)) == Err(6));
 }
 
 #[test]
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs
index 0426f269376..0184222b9e0 100644
--- a/src/libgetopts/lib.rs
+++ b/src/libgetopts/lib.rs
@@ -578,7 +578,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
 
     fn f(_x: uint) -> Vec<Optval> { return Vec::new(); }
 
-    let mut vals = Vec::from_fn(n_opts, f);
+    let mut vals: Vec<_> = range(0, n_opts).map(f).collect();
     let mut free: Vec<String> = Vec::new();
     let l = args.len();
     let mut i = 0;
diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs
index 3cb1f51a6a8..a76e5ebd08a 100644
--- a/src/librand/isaac.rs
+++ b/src/librand/isaac.rs
@@ -361,7 +361,7 @@ impl Isaac64Rng {
         const MP_VEC: [(uint, uint), .. 2] = [(0,MIDPOINT), (MIDPOINT, 0)];
         macro_rules! ind (
             ($x:expr) => {
-                *self.mem.unsafe_get(($x as uint >> 3) & (RAND_SIZE_64 - 1))
+                *self.mem.get_unchecked(($x as uint >> 3) & (RAND_SIZE_64 - 1))
             }
         );
 
@@ -375,13 +375,13 @@ impl Isaac64Rng {
                             let mix = if $j == 0 {!mix} else {mix};
 
                             unsafe {
-                                let x = *self.mem.unsafe_get(base + mr_offset);
-                                a = mix + *self.mem.unsafe_get(base + m2_offset);
+                                let x = *self.mem.get_unchecked(base + mr_offset);
+                                a = mix + *self.mem.get_unchecked(base + m2_offset);
                                 let y = ind!(x) + a + b;
-                                *self.mem.unsafe_mut(base + mr_offset) = y;
+                                *self.mem.get_unchecked_mut(base + mr_offset) = y;
 
                                 b = ind!(y >> RAND_SIZE_64_LEN) + x;
-                                *self.rsl.unsafe_mut(base + mr_offset) = b;
+                                *self.rsl.get_unchecked_mut(base + mr_offset) = b;
                             }
                         }}
                     );
@@ -392,13 +392,13 @@ impl Isaac64Rng {
                             let mix = if $j == 0 {!mix} else {mix};
 
                             unsafe {
-                                let x = *self.mem.unsafe_get(base + mr_offset);
-                                a = mix + *self.mem.unsafe_get(base + m2_offset);
+                                let x = *self.mem.get_unchecked(base + mr_offset);
+                                a = mix + *self.mem.get_unchecked(base + m2_offset);
                                 let y = ind!(x) + a + b;
-                                *self.mem.unsafe_mut(base + mr_offset) = y;
+                                *self.mem.get_unchecked_mut(base + mr_offset) = y;
 
                                 b = ind!(y >> RAND_SIZE_64_LEN) + x;
-                                *self.rsl.unsafe_mut(base + mr_offset) = b;
+                                *self.rsl.get_unchecked_mut(base + mr_offset) = b;
                             }
                         }}
                     );
diff --git a/src/librbml/io.rs b/src/librbml/io.rs
index cbe69295050..fd0c54e8ed3 100644
--- a/src/librbml/io.rs
+++ b/src/librbml/io.rs
@@ -11,6 +11,7 @@
 use std::io::{IoError, IoResult, SeekStyle};
 use std::io;
 use std::slice;
+use std::iter::repeat;
 
 static BUF_CAPACITY: uint = 128;
 
@@ -87,7 +88,7 @@ impl Writer for SeekableMemWriter {
             // currently are
             let difference = self.pos as i64 - self.buf.len() as i64;
             if difference > 0 {
-                self.buf.grow(difference as uint, 0);
+                self.buf.extend(repeat(0).take(difference as uint));
             }
 
             // Figure out what bytes will be used to overwrite what's currently
diff --git a/src/libregex/compile.rs b/src/libregex/compile.rs
index c361a25bf52..1476e6ab8a7 100644
--- a/src/libregex/compile.rs
+++ b/src/libregex/compile.rs
@@ -14,6 +14,7 @@
 pub use self::Inst::*;
 
 use std::cmp;
+use std::iter::repeat;
 use parse;
 use parse::{
     Flags, FLAG_EMPTY,
@@ -157,7 +158,7 @@ impl<'r> Compiler<'r> {
             Capture(cap, name, x) => {
                 let len = self.names.len();
                 if cap >= len {
-                    self.names.grow(10 + cap - len, None)
+                    self.names.extend(repeat(None).take(10 + cap - len))
                 }
                 self.names[cap] = name;
 
diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs
index 86c02de76dc..692a065299c 100644
--- a/src/libregex/parse.rs
+++ b/src/libregex/parse.rs
@@ -18,7 +18,6 @@ use std::cmp;
 use std::fmt;
 use std::iter;
 use std::num;
-use std::slice::BinarySearchResult;
 
 /// Static data containing Unicode ranges for general categories and scripts.
 use unicode::regex::{UNICODE_CLASSES, PERLD, PERLS, PERLW};
@@ -1028,9 +1027,9 @@ fn is_valid_cap(c: char) -> bool {
 }
 
 fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> {
-    match classes.binary_search(|&(s, _)| s.cmp(name)) {
-        BinarySearchResult::Found(i) => Some(classes[i].1.to_vec()),
-        BinarySearchResult::NotFound(_) => None,
+    match classes.binary_search_by(|&(s, _)| s.cmp(name)) {
+        Ok(i) => Some(classes[i].1.to_vec()),
+        Err(_) => None,
     }
 }
 
diff --git a/src/libregex/vm.rs b/src/libregex/vm.rs
index 990d5a159f6..72e0e559c80 100644
--- a/src/libregex/vm.rs
+++ b/src/libregex/vm.rs
@@ -38,6 +38,7 @@ pub use self::StepState::*;
 
 use std::cmp;
 use std::mem;
+use std::iter::repeat;
 use std::slice::SliceExt;
 use compile::{
     Program,
@@ -121,7 +122,7 @@ impl<'r, 't> Nfa<'r, 't> {
         let mut clist = &mut Threads::new(self.which, ninsts, ncaps);
         let mut nlist = &mut Threads::new(self.which, ninsts, ncaps);
 
-        let mut groups = Vec::from_elem(ncaps * 2, None);
+        let mut groups: Vec<_> = repeat(None).take(ncaps * 2).collect();
 
         // Determine if the expression starts with a '^' so we can avoid
         // simulating .*?
@@ -227,8 +228,7 @@ impl<'r, 't> Nfa<'r, 't> {
                     let negate = flags & FLAG_NEGATED > 0;
                     let casei = flags & FLAG_NOCASE > 0;
                     let found = ranges.as_slice();
-                    let found = found.binary_search(|&rc| class_cmp(casei, c, rc))
-                        .found().is_some();
+                    let found = found.binary_search_by(|&rc| class_cmp(casei, c, rc)).is_ok();
                     if found ^ negate {
                         self.add(nlist, pc+1, caps);
                     }
@@ -457,10 +457,10 @@ impl Threads {
     fn new(which: MatchKind, num_insts: uint, ncaps: uint) -> Threads {
         Threads {
             which: which,
-            queue: Vec::from_fn(num_insts, |_| {
-                Thread { pc: 0, groups: Vec::from_elem(ncaps * 2, None) }
-            }),
-            sparse: Vec::from_elem(num_insts, 0u),
+            queue: range(0, num_insts).map(|_| {
+                Thread { pc: 0, groups: repeat(None).take(ncaps * 2).collect() }
+            }).collect(),
+            sparse: repeat(0u).take(num_insts).collect(),
             size: 0,
         }
     }
@@ -518,7 +518,7 @@ pub fn is_word(c: Option<char>) -> bool {
     // Try the common ASCII case before invoking binary search.
     match c {
         '_' | '0' ... '9' | 'a' ... 'z' | 'A' ... 'Z' => true,
-        _ => PERLW.binary_search(|&(start, end)| {
+        _ => PERLW.binary_search_by(|&(start, end)| {
             if c >= start && c <= end {
                 Equal
             } else if start > c {
@@ -526,7 +526,7 @@ pub fn is_word(c: Option<char>) -> bool {
             } else {
                 Less
             }
-        }).found().is_some()
+        }).is_ok()
     }
 }
 
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index db29d0111f4..5d0532a6210 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1599,7 +1599,7 @@ fn encode_index<T, F>(rbml_w: &mut Encoder, index: Vec<entry<T>>, mut write_fn:
     F: FnMut(&mut SeekableMemWriter, &T),
     T: Hash,
 {
-    let mut buckets: Vec<Vec<entry<T>>> = Vec::from_fn(256, |_| Vec::new());
+    let mut buckets: Vec<Vec<entry<T>>> = range(0, 256u16).map(|_| Vec::new()).collect();
     for elt in index.into_iter() {
         let h = hash::hash(&elt.val) as uint;
         buckets[h % 256].push(elt);
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index b7e67ea4690..522e1d4d3b2 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -611,9 +611,9 @@ fn is_useful(cx: &MatchCheckCtxt,
                             let arity = constructor_arity(cx, &c, left_ty);
                             let mut result = {
                                 let pat_slice = pats[];
-                                let subpats = Vec::from_fn(arity, |i| {
+                                let subpats: Vec<_> = range(0, arity).map(|i| {
                                     pat_slice.get(i).map_or(DUMMY_WILD_PAT, |p| &**p)
-                                });
+                                }).collect();
                                 vec![construct_witness(cx, &c, subpats, left_ty)]
                             };
                             result.extend(pats.into_iter().skip(arity));
@@ -635,7 +635,7 @@ fn is_useful(cx: &MatchCheckCtxt,
                 match is_useful(cx, &matrix, v.tail(), witness) {
                     UsefulWithWitness(pats) => {
                         let arity = constructor_arity(cx, &constructor, left_ty);
-                        let wild_pats = Vec::from_elem(arity, DUMMY_WILD_PAT);
+                        let wild_pats: Vec<_> = repeat(DUMMY_WILD_PAT).take(arity).collect();
                         let enum_pat = construct_witness(cx, &constructor, wild_pats, left_ty);
                         let mut new_pats = vec![enum_pat];
                         new_pats.extend(pats.into_iter());
@@ -788,7 +788,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
     } = raw_pat(r[col]);
     let head: Option<Vec<&Pat>> = match *node {
         ast::PatWild(_) =>
-            Some(Vec::from_elem(arity, DUMMY_WILD_PAT)),
+            Some(repeat(DUMMY_WILD_PAT).take(arity).collect()),
 
         ast::PatIdent(_, _, _) => {
             let opt_def = cx.tcx.def_map.borrow().get(&pat_id).cloned();
@@ -801,7 +801,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
                 } else {
                     None
                 },
-                _ => Some(Vec::from_elem(arity, DUMMY_WILD_PAT))
+                _ => Some(repeat(DUMMY_WILD_PAT).take(arity).collect())
             }
         }
 
@@ -815,7 +815,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
                 DefVariant(..) | DefStruct(..) => {
                     Some(match args {
                         &Some(ref args) => args.iter().map(|p| &**p).collect(),
-                        &None => Vec::from_elem(arity, DUMMY_WILD_PAT)
+                        &None => repeat(DUMMY_WILD_PAT).take(arity).collect(),
                     })
                 }
                 _ => None
@@ -894,13 +894,13 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
                 // Fixed-length vectors.
                 Single => {
                     let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
-                    pats.grow_fn(arity - before.len() - after.len(), |_| DUMMY_WILD_PAT);
+                    pats.extend(repeat(DUMMY_WILD_PAT).take(arity - before.len() - after.len()));
                     pats.extend(after.iter().map(|p| &**p));
                     Some(pats)
                 },
                 Slice(length) if before.len() + after.len() <= length && slice.is_some() => {
                     let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
-                    pats.grow_fn(arity - before.len() - after.len(), |_| DUMMY_WILD_PAT);
+                    pats.extend(repeat(DUMMY_WILD_PAT).take(arity - before.len() - after.len()));
                     pats.extend(after.iter().map(|p| &**p));
                     Some(pats)
                 },
diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs
index a2d417ca345..6cf6065de19 100644
--- a/src/librustc/middle/dataflow.rs
+++ b/src/librustc/middle/dataflow.rs
@@ -21,6 +21,7 @@ use middle::cfg::CFGIndex;
 use middle::ty;
 use std::io;
 use std::uint;
+use std::iter::repeat;
 use syntax::ast;
 use syntax::ast_util::IdRange;
 use syntax::visit;
@@ -203,9 +204,9 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
 
         let entry = if oper.initial_value() { uint::MAX } else {0};
 
-        let gens = Vec::from_elem(num_nodes * words_per_id, 0);
-        let kills = Vec::from_elem(num_nodes * words_per_id, 0);
-        let on_entry = Vec::from_elem(num_nodes * words_per_id, entry);
+        let gens: Vec<_> = repeat(0).take(num_nodes * words_per_id).collect();
+        let kills: Vec<_> = repeat(0).take(num_nodes * words_per_id).collect();
+        let on_entry: Vec<_> = repeat(entry).take(num_nodes * words_per_id).collect();
 
         let nodeid_to_index = build_nodeid_to_index(decl, cfg);
 
@@ -446,7 +447,7 @@ impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
                 changed: true
             };
 
-            let mut temp = Vec::from_elem(words_per_id, 0u);
+            let mut temp: Vec<_> = repeat(0u).take(words_per_id).collect();
             while propcx.changed {
                 propcx.changed = false;
                 propcx.reset(temp.as_mut_slice());
diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs
index e38b721ce2d..6f1c7af5b86 100644
--- a/src/librustc/middle/infer/error_reporting.rs
+++ b/src/librustc/middle/infer/error_reporting.rs
@@ -1187,7 +1187,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
         let mut new_ty = P(ty.clone());
         let mut ty_queue = vec!(ty);
         while !ty_queue.is_empty() {
-            let cur_ty = ty_queue.remove(0).unwrap();
+            let cur_ty = ty_queue.remove(0);
             match cur_ty.node {
                 ast::TyRptr(lt_opt, ref mut_ty) => {
                     let rebuild = match lt_opt {
diff --git a/src/librustc/middle/infer/mod.rs b/src/librustc/middle/infer/mod.rs
index 386768bd9d6..91fbaca26d1 100644
--- a/src/librustc/middle/infer/mod.rs
+++ b/src/librustc/middle/infer/mod.rs
@@ -799,7 +799,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
     }
 
     pub fn next_ty_vars(&self, n: uint) -> Vec<Ty<'tcx>> {
-        Vec::from_fn(n, |_i| self.next_ty_var())
+        range(0, n).map(|_i| self.next_ty_var()).collect()
     }
 
     pub fn next_int_var_id(&self) -> IntVid {
diff --git a/src/librustc/middle/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs
index 97fab3bc939..7372bb267b0 100644
--- a/src/librustc/middle/infer/region_inference/mod.rs
+++ b/src/librustc/middle/infer/region_inference/mod.rs
@@ -34,6 +34,7 @@ use util::ppaux::Repr;
 
 use std::cell::{Cell, RefCell};
 use std::u32;
+use std::iter::repeat;
 use syntax::ast;
 
 mod doc;
@@ -975,7 +976,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
     }
 
     fn construct_var_data(&self) -> Vec<VarData> {
-        Vec::from_fn(self.num_vars() as uint, |_| {
+        range(0, self.num_vars() as uint).map(|_| {
             VarData {
                 // All nodes are initially classified as contracting; during
                 // the expansion phase, we will shift the classification for
@@ -984,7 +985,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
                 classification: Contracting,
                 value: NoValue,
             }
-        })
+        }).collect()
     }
 
     fn dump_constraints(&self) {
@@ -1247,7 +1248,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
         // idea is to report errors that derive from independent
         // regions of the graph, but not those that derive from
         // overlapping locations.
-        let mut dup_vec = Vec::from_elem(self.num_vars() as uint, u32::MAX);
+        let mut dup_vec: Vec<_> = repeat(u32::MAX).take(self.num_vars() as uint).collect();
 
         let mut opt_graph = None;
 
@@ -1308,7 +1309,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
             }
         }
 
-        Vec::from_fn(self.num_vars() as uint, |idx| var_data[idx].value)
+        range(0, self.num_vars() as uint).map(|idx| var_data[idx].value).collect()
     }
 
     fn construct_graph(&self) -> RegionGraph {
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index d3859ca12a9..5be8d03e743 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -117,6 +117,7 @@ use util::nodemap::NodeMap;
 
 use std::{fmt, io, uint};
 use std::rc::Rc;
+use std::iter::repeat;
 use syntax::ast::{mod, NodeId, Expr};
 use syntax::codemap::{BytePos, original_sp, Span};
 use syntax::parse::token::{mod, special_idents};
@@ -575,8 +576,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
         Liveness {
             ir: ir,
             s: specials,
-            successors: Vec::from_elem(num_live_nodes, invalid_node()),
-            users: Vec::from_elem(num_live_nodes * num_vars, invalid_users()),
+            successors: repeat(invalid_node()).take(num_live_nodes).collect(),
+            users: repeat(invalid_users()).take(num_live_nodes * num_vars).collect(),
             loop_scope: Vec::new(),
             break_ln: NodeMap::new(),
             cont_ln: NodeMap::new(),
@@ -1068,7 +1069,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
                 // the same bindings, and we also consider the first pattern to be
                 // the "authoritative" set of ids
                 let arm_succ =
-                    self.define_bindings_in_arm_pats(arm.pats.head().map(|p| &**p),
+                    self.define_bindings_in_arm_pats(arm.pats.first().map(|p| &**p),
                                                      guard_succ);
                 self.merge_from_succ(ln, arm_succ, first_merge);
                 first_merge = false;
@@ -1436,7 +1437,7 @@ fn check_arm(this: &mut Liveness, arm: &ast::Arm) {
     // only consider the first pattern; any later patterns must have
     // the same bindings, and we also consider the first pattern to be
     // the "authoritative" set of ids
-    this.arm_pats_bindings(arm.pats.head().map(|p| &**p), |this, ln, var, sp, id| {
+    this.arm_pats_bindings(arm.pats.first().map(|p| &**p), |this, ln, var, sp, id| {
         this.warn_about_unused(sp, id, ln, var);
     });
     visit::walk_arm(this, arm);
@@ -1542,7 +1543,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
                 } else {
                     let ends_with_stmt = match body.expr {
                         None if body.stmts.len() > 0 =>
-                            match body.stmts.last().unwrap().node {
+                            match body.stmts.first().unwrap().node {
                                 ast::StmtSemi(ref e, _) => {
                                     ty::expr_ty(self.ir.tcx, &**e) == t_ret
                                 },
@@ -1553,7 +1554,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
                     self.ir.tcx.sess.span_err(
                         sp, "not all control paths return a value");
                     if ends_with_stmt {
-                        let last_stmt = body.stmts.last().unwrap();
+                        let last_stmt = body.stmts.first().unwrap();
                         let original_span = original_sp(self.ir.tcx.sess.codemap(),
                                                         last_stmt.span, sp);
                         let span_semicolon = Span {
diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs
index 730da26eda3..edba2839f37 100644
--- a/src/librustc/middle/privacy.rs
+++ b/src/librustc/middle/privacy.rs
@@ -751,10 +751,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
         let orig_def = self.tcx.def_map.borrow()[path_id].clone();
         let ck = |tyname: &str| {
             let ck_public = |def: ast::DefId| {
-                let name = token::get_ident(path.segments
-                                                .last()
-                                                .unwrap()
-                                                .identifier);
+                let name = token::get_ident(path.segments.last().unwrap().identifier);
                 let origdid = orig_def.def_id();
                 self.ensure_public(span,
                                    def,
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index 4feafff3b92..e9504a92f7b 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -296,7 +296,7 @@ impl<'a> LifetimeContext<'a> {
         debug!("visit_early_late: referenced_idents={}",
                referenced_idents);
 
-        let (early, late) = generics.lifetimes.clone().partition(
+        let (early, late): (Vec<_>, _) = generics.lifetimes.iter().cloned().partition(
             |l| referenced_idents.iter().any(|&i| i == l.lifetime.name));
 
         self.with(EarlyScope(early_space, &early, self.scope), move |old_scope, this| {
diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs
index 3066ae5b479..07da9853e55 100644
--- a/src/librustc/middle/subst.rs
+++ b/src/librustc/middle/subst.rs
@@ -323,7 +323,11 @@ impl<T> VecPerParamSpace<T> {
                 SelfSpace => { self.self_limit -= 1; }
                 FnSpace => {}
             }
-            self.content.remove(limit - 1)
+            if self.content.is_empty() {
+                None
+            } else {
+                Some(self.content.remove(limit - 1))
+            }
         }
     }
 
diff --git a/src/librustc/util/lev_distance.rs b/src/librustc/util/lev_distance.rs
index 24e98837444..e7c77b12499 100644
--- a/src/librustc/util/lev_distance.rs
+++ b/src/librustc/util/lev_distance.rs
@@ -14,7 +14,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint {
     if me.is_empty() { return t.chars().count(); }
     if t.is_empty() { return me.chars().count(); }
 
-    let mut dcol = Vec::from_fn(t.len() + 1, |x| x);
+    let mut dcol: Vec<_> = range(0, t.len() + 1).collect();
     let mut t_last = 0;
 
     for (i, sc) in me.chars().enumerate() {
diff --git a/src/librustc_back/sha2.rs b/src/librustc_back/sha2.rs
index e1f0168d86b..a7d1d3a23bd 100644
--- a/src/librustc_back/sha2.rs
+++ b/src/librustc_back/sha2.rs
@@ -14,7 +14,7 @@
 
 #![allow(deprecated)] // to_be32
 
-use std::iter::range_step;
+use std::iter::{range_step, repeat};
 use std::num::Int;
 use std::slice::bytes::{MutableByteVector, copy_memory};
 use serialize::hex::ToHex;
@@ -258,7 +258,7 @@ pub trait Digest {
     /// Convenience function that retrieves the result of a digest as a
     /// newly allocated vec of bytes.
     fn result_bytes(&mut self) -> Vec<u8> {
-        let mut buf = Vec::from_elem((self.output_bits()+7)/8, 0u8);
+        let mut buf: Vec<u8> = repeat(0u8).take((self.output_bits()+7)/8).collect();
         self.result(buf.as_mut_slice());
         buf
     }
@@ -612,7 +612,7 @@ mod tests {
     /// correct.
     fn test_digest_1million_random<D: Digest>(digest: &mut D, blocksize: uint, expected: &str) {
         let total_size = 1000000;
-        let buffer = Vec::from_elem(blocksize * 2, 'a' as u8);
+        let buffer: Vec<u8> = repeat('a' as u8).take(blocksize * 2).collect();
         let mut rng = IsaacRng::new_unseeded();
         let mut count = 0;
 
diff --git a/src/librustc_borrowck/borrowck/fragments.rs b/src/librustc_borrowck/borrowck/fragments.rs
index 7609554033c..070ae1151aa 100644
--- a/src/librustc_borrowck/borrowck/fragments.rs
+++ b/src/librustc_borrowck/borrowck/fragments.rs
@@ -25,7 +25,6 @@ use rustc::middle::mem_categorization as mc;
 use rustc::util::ppaux::{Repr, UserString};
 use std::mem;
 use std::rc::Rc;
-use std::slice;
 use syntax::ast;
 use syntax::ast_map;
 use syntax::attr::AttrMetaMethods;
@@ -268,9 +267,9 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
     return;
 
     fn non_member(elem: MovePathIndex, set: &[MovePathIndex]) -> bool {
-        match set.binary_search_elem(&elem) {
-            slice::BinarySearchResult::Found(_) => false,
-            slice::BinarySearchResult::NotFound(_) => true,
+        match set.binary_search(&elem) {
+            Ok(_) => false,
+            Err(_) => true,
         }
     }
 }
diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs
index e71e9e5dfea..664d470b11b 100644
--- a/src/librustc_borrowck/lib.rs
+++ b/src/librustc_borrowck/lib.rs
@@ -37,4 +37,3 @@ pub use borrowck::FnPartsWithCFG;
 mod borrowck;
 
 pub mod graphviz;
-
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index e20404bf638..0d98434d042 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -265,11 +265,13 @@ Available lint options:
         lints
     }
 
-    let (plugin, builtin) = lint_store.get_lints().partitioned(|&(_, p)| p);
+    let (plugin, builtin): (Vec<_>, _) = lint_store.get_lints()
+        .iter().cloned().partition(|&(_, p)| p);
     let plugin = sort_lints(plugin);
     let builtin = sort_lints(builtin);
 
-    let (plugin_groups, builtin_groups) = lint_store.get_lint_groups().partitioned(|&(_, _, p)| p);
+    let (plugin_groups, builtin_groups): (Vec<_>, _) = lint_store.get_lint_groups()
+        .iter().cloned().partition(|&(_, _, p)| p);
     let plugin_groups = sort_lint_groups(plugin_groups);
     let builtin_groups = sort_lint_groups(builtin_groups);
 
@@ -377,7 +379,7 @@ fn describe_codegen_flags() {
 /// returns None.
 pub fn handle_options(mut args: Vec<String>) -> Option<getopts::Matches> {
     // Throw away the first argument, the name of the binary
-    let _binary = args.remove(0).unwrap();
+    let _binary = args.remove(0);
 
     if args.is_empty() {
         // user did not write `-v` nor `-Z unstable-options`, so do not
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 52bd096eb83..cc240915e9d 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -4828,9 +4828,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                             Some(def) => {
                                 debug!("(resolving type) resolved `{}` to \
                                         type {}",
-                                       token::get_ident(path.segments
-                                                            .last().unwrap()
-                                                            .identifier),
+                                       token::get_ident(path.segments.last().unwrap() .identifier),
                                        def);
                                 result_def = Some(def);
                             }
@@ -5021,19 +5019,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                             self.resolve_error(path.span,
                                 format!("`{}` is not an enum variant, struct or const",
                                     token::get_ident(
-                                        path.segments
-                                            .last()
-                                            .unwrap()
-                                            .identifier))[]);
+                                        path.segments.last().unwrap().identifier))[]);
                         }
                         None => {
                             self.resolve_error(path.span,
                                 format!("unresolved enum variant, struct or const `{}`",
                                     token::get_ident(
-                                        path.segments
-                                            .last()
-                                            .unwrap()
-                                            .identifier))[]);
+                                        path.segments.last().unwrap().identifier))[]);
                         }
                     }
 
@@ -5187,9 +5179,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
 
         // Try to find a path to an item in a module.
         let unqualified_def =
-                self.resolve_identifier(path.segments
-                                            .last().unwrap()
-                                            .identifier,
+                self.resolve_identifier(path.segments.last().unwrap().identifier,
                                         namespace,
                                         check_ribs,
                                         path.span);
diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs
index 0e37cd0f3b8..c6e4ce9457b 100644
--- a/src/librustc_trans/trans/_match.rs
+++ b/src/librustc_trans/trans/_match.rs
@@ -606,9 +606,9 @@ fn extract_variant_args<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                     val: ValueRef)
                                     -> ExtractedBlock<'blk, 'tcx> {
     let _icx = push_ctxt("match::extract_variant_args");
-    let args = Vec::from_fn(adt::num_args(repr, disr_val), |i| {
+    let args = range(0, adt::num_args(repr, disr_val)).map(|i| {
         adt::trans_field_ptr(bcx, repr, val, disr_val, i)
-    });
+    }).collect();
 
     ExtractedBlock { vals: args, bcx: bcx }
 }
diff --git a/src/librustc_trans/trans/cabi_x86_64.rs b/src/librustc_trans/trans/cabi_x86_64.rs
index 9b678a4f3ae..fffdc9c97ab 100644
--- a/src/librustc_trans/trans/cabi_x86_64.rs
+++ b/src/librustc_trans/trans/cabi_x86_64.rs
@@ -23,6 +23,7 @@ use trans::context::CrateContext;
 use trans::type_::Type;
 
 use std::cmp;
+use std::iter::repeat;
 
 #[deriving(Clone, Copy, PartialEq)]
 enum RegClass {
@@ -286,7 +287,7 @@ fn classify_ty(ty: Type) -> Vec<RegClass> {
     }
 
     let words = (ty_size(ty) + 7) / 8;
-    let mut cls = Vec::from_elem(words, NoClass);
+    let mut cls: Vec<_> = repeat(NoClass).take(words).collect();
     if words > 4 {
         all_mem(cls.as_mut_slice());
         return cls;
diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs
index 0fd6d286e8b..1f01da8a124 100644
--- a/src/librustc_trans/trans/consts.rs
+++ b/src/librustc_trans/trans/consts.rs
@@ -25,6 +25,7 @@ use middle::ty::{mod, Ty};
 use util::ppaux::{Repr, ty_to_string};
 
 use std::c_str::ToCStr;
+use std::iter::repeat;
 use libc::c_uint;
 use syntax::{ast, ast_util};
 use syntax::ptr::P;
@@ -608,7 +609,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
                 const_eval::const_uint(i) => i as uint,
                 _ => cx.sess().span_bug(count.span, "count must be integral const expression.")
             };
-            let vs = Vec::from_elem(n, const_expr(cx, &**elem).0);
+            let vs: Vec<_> = repeat(const_expr(cx, &**elem).0).take(n).collect();
             if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
                 C_struct(cx, vs[], false)
             } else {
diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs
index b5b1c6ff864..f191976e23c 100644
--- a/src/librustc_trans/trans/debuginfo.rs
+++ b/src/librustc_trans/trans/debuginfo.rs
@@ -3396,10 +3396,7 @@ fn create_scope_map(cx: &CrateContext,
                     if need_new_scope {
                         // Create a new lexical scope and push it onto the stack
                         let loc = cx.sess().codemap().lookup_char_pos(pat.span.lo);
-                        let file_metadata = file_metadata(cx,
-                                                          loc.file
-                                                             .name
-                                                             []);
+                        let file_metadata = file_metadata(cx, loc.file.name[]);
                         let parent_scope = scope_stack.last().unwrap().scope_metadata;
 
                         let scope_metadata = unsafe {
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index 5a20a297fdb..7587adae5b7 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -68,6 +68,7 @@ use syntax::print::pprust::{expr_to_string};
 use syntax::ptr::P;
 use syntax::parse::token;
 use std::rc::Rc;
+use std::iter::repeat;
 
 // Destinations
 
@@ -1413,7 +1414,7 @@ fn trans_struct<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     let tcx = bcx.tcx();
     with_field_tys(tcx, ty, Some(expr_id), |discr, field_tys| {
-        let mut need_base = Vec::from_elem(field_tys.len(), true);
+        let mut need_base: Vec<_> = repeat(true).take(field_tys.len()).collect();
 
         let numbered_fields = fields.iter().map(|field| {
             let opt_pos =
diff --git a/src/librustc_trans/trans/type_.rs b/src/librustc_trans/trans/type_.rs
index 45a2a343066..2cc40a61795 100644
--- a/src/librustc_trans/trans/type_.rs
+++ b/src/librustc_trans/trans/type_.rs
@@ -22,6 +22,7 @@ use syntax::ast;
 use std::c_str::ToCStr;
 use std::mem;
 use std::cell::RefCell;
+use std::iter::repeat;
 
 use libc::c_uint;
 
@@ -282,7 +283,7 @@ impl Type {
             if n_elts == 0 {
                 return Vec::new();
             }
-            let mut elts = Vec::from_elem(n_elts, Type { rf: 0 as TypeRef });
+            let mut elts: Vec<_> = repeat(Type { rf: 0 as TypeRef }).take(n_elts).collect();
             llvm::LLVMGetStructElementTypes(self.to_ref(),
                                             elts.as_mut_ptr() as *mut TypeRef);
             elts
@@ -296,7 +297,7 @@ impl Type {
     pub fn func_params(&self) -> Vec<Type> {
         unsafe {
             let n_args = llvm::LLVMCountParamTypes(self.to_ref()) as uint;
-            let mut args = Vec::from_elem(n_args, Type { rf: 0 as TypeRef });
+            let mut args: Vec<_> = repeat(Type { rf: 0 as TypeRef }).take(n_args).collect();
             llvm::LLVMGetParamTypes(self.to_ref(),
                                     args.as_mut_ptr() as *mut TypeRef);
             args
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 587a85cfcba..dee9aafd06d 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -62,7 +62,7 @@ use util::nodemap::DefIdMap;
 use util::ppaux::{mod, Repr, UserString};
 
 use std::rc::Rc;
-use std::iter::AdditiveIterator;
+use std::iter::{repeat, AdditiveIterator};
 use syntax::{abi, ast, ast_util};
 use syntax::codemap::Span;
 use syntax::parse::token;
@@ -317,8 +317,8 @@ fn create_substs_for_ast_path<'tcx,AC,RS>(
 
         match anon_regions {
             Ok(v) => v.into_iter().collect(),
-            Err(_) => Vec::from_fn(expected_num_region_params,
-                                   |_| ty::ReStatic) // hokey
+            Err(_) => range(0, expected_num_region_params)
+                          .map(|_| ty::ReStatic).collect() // hokey
         }
     };
 
@@ -500,7 +500,7 @@ fn convert_parenthesized_parameters<'tcx,AC>(this: &AC,
                             .map(|a_t| ast_ty_to_ty(this, &binding_rscope, &**a_t))
                             .collect::<Vec<Ty<'tcx>>>();
 
-    let input_params = Vec::from_elem(inputs.len(), String::new());
+    let input_params: Vec<_> = repeat(String::new()).take(inputs.len()).collect();
     let (implied_output_region,
          params_lifetimes) = find_implied_output_region(&*inputs, input_params);
 
@@ -734,8 +734,8 @@ pub fn ast_path_to_ty_relaxed<'tcx,AC,RS>(
         path.segments.iter().all(|s| s.parameters.is_empty());
 
     let substs = if needs_defaults {
-        let type_params = Vec::from_fn(generics.types.len(TypeSpace),
-                                       |_| this.ty_infer(path.span));
+        let type_params: Vec<_> = range(0, generics.types.len(TypeSpace))
+                                      .map(|_| this.ty_infer(path.span)).collect();
         let region_params =
             rscope.anon_regions(path.span, generics.regions.len(TypeSpace))
                   .unwrap();
@@ -1528,21 +1528,18 @@ fn conv_ty_poly_trait_ref<'tcx, AC, RS>(
     let mut partitioned_bounds = partition_bounds(this.tcx(), span, ast_bounds[]);
 
     let mut projection_bounds = Vec::new();
-    let main_trait_bound = match partitioned_bounds.trait_bounds.remove(0) {
-        Some(trait_bound) => {
-            let ptr = instantiate_poly_trait_ref(this,
-                                                 rscope,
-                                                 trait_bound,
-                                                 None,
-                                                 &mut projection_bounds);
-            Some(ptr)
-        }
-        None => {
-            this.tcx().sess.span_err(
-                span,
-                "at least one non-builtin trait is required for an object type");
-            None
-        }
+    let main_trait_bound = if !partitioned_bounds.trait_bounds.is_empty() {
+        let trait_bound = partitioned_bounds.trait_bounds.remove(0);
+        Some(instantiate_poly_trait_ref(this,
+                                        rscope,
+                                        trait_bound,
+                                        None,
+                                        &mut projection_bounds))
+    } else {
+        this.tcx().sess.span_err(
+            span,
+            "at least one non-builtin trait is required for an object type");
+        None
     };
 
     let bounds =
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index 0e8b5b373f1..7c431b4fc0b 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -124,7 +124,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
             check_pat_struct(pcx, pat, path, fields.as_slice(), etc, expected);
         }
         ast::PatTup(ref elements) => {
-            let element_tys = Vec::from_fn(elements.len(), |_| fcx.infcx().next_ty_var());
+            let element_tys: Vec<_> = range(0, elements.len()).map(|_| fcx.infcx()
+                .next_ty_var()).collect();
             let pat_ty = ty::mk_tup(tcx, element_tys.clone());
             fcx.write_ty(pat.id, pat_ty);
             demand::eqtype(fcx, pat.span, expected, pat_ty);
diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs
index a189f780b0c..a751b65a0f8 100644
--- a/src/librustc_typeck/check/method/confirm.rs
+++ b/src/librustc_typeck/check/method/confirm.rs
@@ -24,6 +24,7 @@ use syntax::ast;
 use syntax::codemap::Span;
 use std::rc::Rc;
 use std::mem;
+use std::iter::repeat;
 use util::ppaux::Repr;
 
 struct ConfirmContext<'a, 'tcx:'a> {
@@ -339,7 +340,7 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
             } else if num_supplied_types != num_method_types {
                 span_err!(self.tcx().sess, self.span, E0036,
                     "incorrect number of type parameters given for this method");
-                Vec::from_elem(num_method_types, self.tcx().types.err)
+                repeat(self.tcx().types.err).take(num_method_types).collect()
             } else {
                 supplied_method_types
             }
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 8069d00dda8..f3a4a8d177e 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -110,6 +110,7 @@ use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
 use std::cell::{Cell, Ref, RefCell};
 use std::mem::replace;
 use std::rc::Rc;
+use std::iter::repeat;
 use syntax::{mod, abi, attr};
 use syntax::ast::{mod, ProvidedMethod, RequiredMethod, TypeTraitItem, DefId};
 use syntax::ast_util::{mod, local_def, PostExpansionMethod};
@@ -2130,9 +2131,9 @@ impl<'a, 'tcx> RegionScope for FnCtxt<'a, 'tcx> {
 
     fn anon_regions(&self, span: Span, count: uint)
                     -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>> {
-        Ok(Vec::from_fn(count, |_| {
+        Ok(range(0, count).map(|_| {
             self.infcx().next_region_var(infer::MiscVariable(span))
-        }))
+        }).collect())
     }
 }
 
@@ -2810,7 +2811,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
 // FIXME(#17596) Ty<'tcx> is incorrectly invariant w.r.t 'tcx.
 fn err_args<'tcx>(tcx: &ty::ctxt<'tcx>, len: uint) -> Vec<Ty<'tcx>> {
-    Vec::from_fn(len, |_| tcx.types.err)
+    range(0, len).map(|_| tcx.types.err).collect()
 }
 
 fn write_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
@@ -5166,7 +5167,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     // The first step then is to categorize the segments appropriately.
 
     assert!(path.segments.len() >= 1);
-    let mut segment_spaces;
+    let mut segment_spaces: Vec<_>;
     match def {
         // Case 1 and 1b. Reference to a *type* or *enum variant*.
         def::DefSelfTy(..) |
@@ -5181,7 +5182,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         def::DefTyParam(..) => {
             // Everything but the final segment should have no
             // parameters at all.
-            segment_spaces = Vec::from_elem(path.segments.len() - 1, None);
+            segment_spaces = repeat(None).take(path.segments.len() - 1).collect();
             segment_spaces.push(Some(subst::TypeSpace));
         }
 
@@ -5189,7 +5190,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         def::DefFn(..) |
         def::DefConst(..) |
         def::DefStatic(..) => {
-            segment_spaces = Vec::from_elem(path.segments.len() - 1, None);
+            segment_spaces = repeat(None).take(path.segments.len() - 1).collect();
             segment_spaces.push(Some(subst::FnSpace));
         }
 
@@ -5205,7 +5206,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 def::FromImpl(_) => {}
             }
 
-            segment_spaces = Vec::from_elem(path.segments.len() - 2, None);
+            segment_spaces = repeat(None).take(path.segments.len() - 2).collect();
             segment_spaces.push(Some(subst::TypeSpace));
             segment_spaces.push(Some(subst::FnSpace));
         }
@@ -5220,7 +5221,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         def::DefRegion(..) |
         def::DefLabel(..) |
         def::DefUpvar(..) => {
-            segment_spaces = Vec::from_elem(path.segments.len(), None);
+            segment_spaces = repeat(None).take(path.segments.len()).collect();
         }
     }
     assert_eq!(segment_spaces.len(), path.segments.len());
@@ -5489,8 +5490,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 "too few type parameters provided: expected {}{} parameter(s) \
                 , found {} parameter(s)",
                 qualifier, required_len, provided_len);
-            substs.types.replace(space,
-                                 Vec::from_elem(desired.len(), fcx.tcx().types.err));
+            substs.types.replace(space, repeat(fcx.tcx().types.err).take(desired.len()).collect());
             return;
         }
 
@@ -5614,7 +5614,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 
     // make a vector of booleans initially false, set to true when used
     if tps.len() == 0u { return; }
-    let mut tps_used = Vec::from_elem(tps.len(), false);
+    let mut tps_used: Vec<_> = repeat(false).take(tps.len()).collect();
 
     ty::walk_ty(ty, |t| {
             match t.sty {
diff --git a/src/librustc_typeck/check/regionmanip.rs b/src/librustc_typeck/check/regionmanip.rs
index bb051ab1525..42ffe2d5327 100644
--- a/src/librustc_typeck/check/regionmanip.rs
+++ b/src/librustc_typeck/check/regionmanip.rs
@@ -409,4 +409,3 @@ impl<'tcx> Repr<'tcx> for WfConstraint<'tcx> {
         }
     }
 }
-
diff --git a/src/librustc_typeck/rscope.rs b/src/librustc_typeck/rscope.rs
index a97dce88a57..c62218313f4 100644
--- a/src/librustc_typeck/rscope.rs
+++ b/src/librustc_typeck/rscope.rs
@@ -13,6 +13,7 @@ use middle::ty;
 use middle::ty_fold;
 
 use std::cell::Cell;
+use std::iter::repeat;
 use syntax::codemap::Span;
 
 /// Defines strategies for handling regions that are omitted.  For
@@ -99,7 +100,7 @@ impl RegionScope for SpecificRscope {
                     count: uint)
                     -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>
     {
-        Ok(Vec::from_elem(count, self.default))
+        Ok(repeat(self.default).take(count).collect())
     }
 }
 
@@ -134,7 +135,7 @@ impl RegionScope for BindingRscope {
                     count: uint)
                     -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>
     {
-        Ok(Vec::from_fn(count, |_| self.next_region()))
+        Ok(range(0, count).map(|_| self.next_region()).collect())
     }
 }
 
diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs
index c4c33f24f87..de0b0a7ad35 100644
--- a/src/librustc_typeck/variance.rs
+++ b/src/librustc_typeck/variance.rs
@@ -199,6 +199,7 @@ use middle::subst::{ParamSpace, FnSpace, TypeSpace, SelfSpace, VecPerParamSpace}
 use middle::ty::{mod, Ty};
 use std::fmt;
 use std::rc::Rc;
+use std::iter::repeat;
 use syntax::ast;
 use syntax::ast_map;
 use syntax::ast_util;
@@ -971,7 +972,7 @@ struct SolveContext<'a, 'tcx: 'a> {
 
 fn solve_constraints(constraints_cx: ConstraintContext) {
     let ConstraintContext { terms_cx, constraints, .. } = constraints_cx;
-    let solutions = Vec::from_elem(terms_cx.num_inferred(), ty::Bivariant);
+    let solutions: Vec<_> = repeat(ty::Bivariant).take(terms_cx.num_inferred()).collect();
     let mut solutions_cx = SolveContext {
         terms_cx: terms_cx,
         constraints: constraints,
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index dc264a5b5aa..3c09a10f3d9 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -398,7 +398,7 @@ fn primitive_link(f: &mut fmt::Formatter,
                 Some(root) => {
                     try!(write!(f, "<a href='{}{}/primitive.{}.html'>",
                                 root,
-                                path.0.head().unwrap(),
+                                path.0.first().unwrap(),
                                 prim.to_url_str()));
                     needs_termination = true;
                 }
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index bfb03cb2589..f8a0b88b408 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1799,7 +1799,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
     try!(write!(w, r#"<script type="text/javascript" async
                               src="{root_path}/implementors/{path}/{ty}.{name}.js">
                       </script>"#,
-                root_path = Vec::from_elem(cx.current.len(), "..").connect("/"),
+                root_path = repeat("..").take(cx.current.len()).collect::<Vec<_>>().connect("/"),
                 path = if ast_util::is_local(it.def_id) {
                     cx.current.connect("/")
                 } else {
@@ -2055,7 +2055,8 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
 fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
     match cache().impls.get(&it.def_id) {
         Some(v) => {
-            let (non_trait, traits) = v.partitioned(|i| i.impl_.trait_.is_none());
+            let (non_trait, traits): (Vec<_>, _) = v.iter().cloned()
+                .partition(|i| i.impl_.trait_.is_none());
             if non_trait.len() > 0 {
                 try!(write!(w, "<h2 id='methods'>Methods</h2>"));
                 for i in non_trait.iter() {
@@ -2065,7 +2066,8 @@ fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
             if traits.len() > 0 {
                 try!(write!(w, "<h2 id='implementations'>Trait \
                                   Implementations</h2>"));
-                let (derived, manual) = traits.partition(|i| i.impl_.derived);
+                let (derived, manual): (Vec<_>, _) = traits.into_iter()
+                    .partition(|i| i.impl_.derived);
                 for i in manual.iter() {
                     try!(render_impl(w, i));
                 }
diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs
index f28abcc10cf..7c6cfb337dc 100644
--- a/src/libstd/c_str.rs
+++ b/src/libstd/c_str.rs
@@ -74,7 +74,7 @@ use fmt;
 use hash;
 use mem;
 use ptr;
-use slice::{mod, ImmutableIntSlice};
+use slice::{mod, IntSliceExt};
 use str;
 use string::String;
 use core::kinds::marker;
diff --git a/src/libstd/comm/sync.rs b/src/libstd/comm/sync.rs
index 82ec1814ebd..a8004155af0 100644
--- a/src/libstd/comm/sync.rs
+++ b/src/libstd/comm/sync.rs
@@ -148,7 +148,7 @@ impl<T: Send> Packet<T> {
                     tail: 0 as *mut Node,
                 },
                 buf: Buffer {
-                    buf: Vec::from_fn(cap + if cap == 0 {1} else {0}, |_| None),
+                    buf: range(0, cap + if cap == 0 {1} else {0}).map(|_| None).collect(),
                     start: 0,
                     size: 0,
                 },
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index fdbce101c1d..0fba0f6704b 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -439,9 +439,10 @@ mod test {
 
     impl Reader for ShortReader {
         fn read(&mut self, _: &mut [u8]) -> io::IoResult<uint> {
-            match self.lengths.remove(0) {
-                Some(i) => Ok(i),
-                None => Err(io::standard_error(io::EndOfFile))
+            if self.lengths.is_empty() {
+                Err(io::standard_error(io::EndOfFile))
+            } else {
+                Ok(self.lengths.remove(0))
             }
         }
     }
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 989f44f7b8e..a9d9607395c 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -620,10 +620,11 @@ pub fn get_exit_status() -> int {
 unsafe fn load_argc_and_argv(argc: int,
                              argv: *const *const c_char) -> Vec<Vec<u8>> {
     use c_str::CString;
+    use iter::range;
 
-    Vec::from_fn(argc as uint, |i| {
+    range(0, argc as uint).map(|i| {
         CString::new(*argv.offset(i as int), false).as_bytes_no_nul().to_vec()
-    })
+    }).collect()
 }
 
 /// Returns the command line arguments
@@ -721,7 +722,7 @@ fn real_args() -> Vec<String> {
     let lpCmdLine = unsafe { GetCommandLineW() };
     let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) };
 
-    let args = Vec::from_fn(nArgs as uint, |i| unsafe {
+    let args: Vec<_> = range(0, nArgs as uint).map(|i| unsafe {
         // Determine the length of this argument.
         let ptr = *szArgList.offset(i as int);
         let mut len = 0;
@@ -732,7 +733,7 @@ fn real_args() -> Vec<String> {
         let buf = slice::from_raw_buf(&ptr, len);
         let opt_s = String::from_utf16(sys::os::truncate_utf16_at_nul(buf));
         opt_s.ok().expect("CommandLineToArgvW returned invalid UTF-16")
-    });
+    }).collect();
 
     unsafe {
         LocalFree(szArgList as *mut c_void);
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index 41cbaa2b807..bd4031e6230 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -29,7 +29,7 @@ use vec::Vec;
 use super::{BytesContainer, GenericPath, GenericPathUnsafe};
 
 /// Iterator that yields successive components of a Path as &[u8]
-pub type Components<'a> = Splits<'a, u8, fn(&u8) -> bool>;
+pub type Components<'a> = Split<'a, u8, fn(&u8) -> bool>;
 
 /// Iterator that yields successive components of a Path as Option<&str>
 pub type StrComponents<'a> =
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs
index 165d2c32416..751ed4b70fb 100644
--- a/src/libstd/path/windows.rs
+++ b/src/libstd/path/windows.rs
@@ -25,8 +25,8 @@ use iter::{Iterator, IteratorExt, Map, repeat};
 use mem;
 use option::Option;
 use option::Option::{Some, None};
-use slice::{AsSlice, SliceExt, SliceConcatExt};
-use str::{CharSplits, FromStr, Str, StrAllocating, StrPrelude};
+use slice::{SliceExt, SliceConcatExt};
+use str::{SplitTerminator, FromStr, StrExt};
 use string::{String, ToString};
 use unicode::char::UnicodeChar;
 use vec::Vec;
diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs
index b1f268597c7..98eff621ce0 100644
--- a/src/libstd/rt/args.rs
+++ b/src/libstd/rt/args.rs
@@ -95,14 +95,14 @@ mod imp {
     }
 
     unsafe fn load_argc_and_argv(argc: int, argv: *const *const u8) -> Vec<Vec<u8>> {
-        Vec::from_fn(argc as uint, |i| {
+        range(0, argc as uint).map(|i| {
             let arg = *argv.offset(i as int);
             let mut len = 0u;
             while *arg.offset(len as int) != 0 {
                 len += 1u;
             }
             slice::from_raw_buf(&arg, len).to_vec()
-        })
+        }).collect()
     }
 
     #[cfg(test)]
diff --git a/src/libstd/sys/unix/timer.rs b/src/libstd/sys/unix/timer.rs
index fe393b81e3d..c0ef89666c0 100644
--- a/src/libstd/sys/unix/timer.rs
+++ b/src/libstd/sys/unix/timer.rs
@@ -120,9 +120,9 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) {
     // signals the first requests in the queue, possible re-enqueueing it.
     fn signal(active: &mut Vec<Box<Inner>>,
               dead: &mut Vec<(uint, Box<Inner>)>) {
-        let mut timer = match active.remove(0) {
-            Some(timer) => timer, None => return
-        };
+        if active.is_empty() { return }
+
+        let mut timer = active.remove(0);
         let mut cb = timer.cb.take().unwrap();
         cb.call();
         if timer.repeat {
@@ -178,7 +178,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) {
                         Ok(RemoveTimer(id, ack)) => {
                             match dead.iter().position(|&(i, _)| id == i) {
                                 Some(i) => {
-                                    let (_, i) = dead.remove(i).unwrap();
+                                    let (_, i) = dead.remove(i);
                                     ack.send(i);
                                     continue
                                 }
@@ -186,7 +186,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) {
                             }
                             let i = active.iter().position(|i| i.id == id);
                             let i = i.expect("no timer found");
-                            let t = active.remove(i).unwrap();
+                            let t = active.remove(i);
                             ack.send(t);
                         }
                         Err(..) => break
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index fa08290a888..210feb9aee7 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -17,6 +17,7 @@ use prelude::*;
 
 use fmt;
 use io::{IoResult, IoError};
+use iter::repeat;
 use libc::{c_int, c_char, c_void};
 use libc;
 use os;
@@ -130,7 +131,7 @@ pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD) -> Option<String
         let mut res = None;
         let mut done = false;
         while !done {
-            let mut buf = Vec::from_elem(n as uint, 0u16);
+            let mut buf: Vec<u16> = repeat(0u16).take(n).collect();
             let k = f(buf.as_mut_ptr(), n);
             if k == (0 as DWORD) {
                 done = true;
diff --git a/src/libstd/sys/windows/tty.rs b/src/libstd/sys/windows/tty.rs
index 99292b3b44b..a88d11eed22 100644
--- a/src/libstd/sys/windows/tty.rs
+++ b/src/libstd/sys/windows/tty.rs
@@ -34,6 +34,7 @@ use libc::{c_int, HANDLE, LPDWORD, DWORD, LPVOID};
 use libc::{get_osfhandle, CloseHandle};
 use libc::types::os::arch::extra::LPCVOID;
 use io::{mod, IoError, IoResult, MemReader};
+use iter::repeat;
 use prelude::*;
 use ptr;
 use str::from_utf8;
@@ -89,7 +90,7 @@ impl TTY {
     pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
         // Read more if the buffer is empty
         if self.utf8.eof() {
-            let mut utf16 = Vec::from_elem(0x1000, 0u16);
+            let mut utf16: Vec<u16> = repeat(0u16).take(0x1000).collect();
             let mut num: DWORD = 0;
             match unsafe { ReadConsoleW(self.handle,
                                          utf16.as_mut_ptr() as LPVOID,
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs
index 5a4f5731be5..b5395d09ca7 100644
--- a/src/libsyntax/ast_map/mod.rs
+++ b/src/libsyntax/ast_map/mod.rs
@@ -26,7 +26,7 @@ use arena::TypedArena;
 use std::cell::RefCell;
 use std::fmt;
 use std::io::IoResult;
-use std::iter;
+use std::iter::{mod, repeat};
 use std::mem;
 use std::slice;
 
@@ -726,7 +726,7 @@ impl<'ast> NodeCollector<'ast> {
         debug!("ast_map: {} => {}", id, entry);
         let len = self.map.len();
         if id as uint >= len {
-            self.map.grow(id as uint - len + 1, NotPresent);
+            self.map.extend(repeat(NotPresent).take(id as uint - len + 1));
         }
         self.map[id as uint] = entry;
     }
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index d2d624fa05e..9fcaf2210c1 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -470,7 +470,7 @@ pub fn expand_item(it: P<ast::Item>, fld: &mut MacroExpander)
 fn expand_item_modifiers(mut it: P<ast::Item>, fld: &mut MacroExpander)
                          -> P<ast::Item> {
     // partition the attributes into ItemModifiers and others
-    let (modifiers, other_attrs) = it.attrs.partitioned(|attr| {
+    let (modifiers, other_attrs): (Vec<_>, _) = it.attrs.iter().cloned().partition(|attr| {
         match fld.cx.syntax_env.find(&intern(attr.name().get())) {
             Some(rc) => match *rc { Modifier(_) => true, _ => false },
             _ => false
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index 6474d92953f..500070a14d2 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -22,6 +22,7 @@ use parse::token;
 use ptr::P;
 
 use std::collections::HashMap;
+use std::iter::repeat;
 
 #[deriving(PartialEq)]
 enum ArgumentType {
@@ -477,7 +478,7 @@ impl<'a, 'b> Context<'a, 'b> {
     /// to
     fn into_expr(mut self) -> P<ast::Expr> {
         let mut locals = Vec::new();
-        let mut names = Vec::from_fn(self.name_positions.len(), |_| None);
+        let mut names: Vec<_> = repeat(None).take(self.name_positions.len()).collect();
         let mut pats = Vec::new();
         let mut heads = Vec::new();
 
@@ -664,7 +665,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
                                     name_ordering: Vec<String>,
                                     names: HashMap<String, P<ast::Expr>>)
                                     -> P<ast::Expr> {
-    let arg_types = Vec::from_fn(args.len(), |_| None);
+    let arg_types: Vec<_> = range(0, args.len()).map(|_| None).collect();
     let mut cx = Context {
         ecx: ecx,
         args: args,
@@ -707,13 +708,10 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
             None => break
         }
     }
-    match parser.errors.remove(0) {
-        Some(error) => {
-            cx.ecx.span_err(cx.fmtsp,
-                            format!("invalid format string: {}", error)[]);
-            return DummyResult::raw_expr(sp);
-        }
-        None => {}
+    if !parser.errors.is_empty() {
+        cx.ecx.span_err(cx.fmtsp, format!("invalid format string: {}",
+                                          parser.errors.remove(0))[]);
+        return DummyResult::raw_expr(sp);
     }
     if !cx.literal.is_empty() {
         let s = cx.trans_literal_string();
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 73ef18b8449..65ecf701e8d 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -166,7 +166,7 @@ pub fn count_names(ms: &[TokenTree]) -> uint {
 pub fn initial_matcher_pos(ms: Rc<Vec<TokenTree>>, sep: Option<Token>, lo: BytePos)
                            -> Box<MatcherPos> {
     let match_idx_hi = count_names(ms[]);
-    let matches = Vec::from_fn(match_idx_hi, |_i| Vec::new());
+    let matches: Vec<_> = range(0, match_idx_hi).map(|_| Vec::new()).collect();
     box MatcherPos {
         stack: vec![],
         top_elts: TtSeq(ms),
@@ -392,7 +392,8 @@ pub fn parse(sess: &ParseSess,
                             cur_eis.push(new_ei);
                         }
 
-                        let matches = Vec::from_elem(ei.matches.len(), Vec::new());
+                        let matches: Vec<_> = range(0, ei.matches.len())
+                            .map(|_| Vec::new()).collect();
                         let ei_t = ei;
                         cur_eis.push(box MatcherPos {
                             stack: vec![],
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index ab0e0f9585c..a15f1ca354b 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -65,6 +65,7 @@ pub use self::Token::*;
 
 use std::io;
 use std::string;
+use std::iter::repeat;
 
 #[deriving(Clone, Copy, PartialEq)]
 pub enum Breaks {
@@ -166,9 +167,9 @@ pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: uint) -> Printer {
     // fall behind.
     let n: uint = 3 * linewidth;
     debug!("mk_printer {}", linewidth);
-    let token: Vec<Token> = Vec::from_elem(n, Eof);
-    let size: Vec<int> = Vec::from_elem(n, 0i);
-    let scan_stack: Vec<uint> = Vec::from_elem(n, 0u);
+    let token: Vec<Token> = repeat(Eof).take(n).collect();
+    let size: Vec<int> = repeat(0i).take(n).collect();
+    let scan_stack: Vec<uint> = repeat(0u).take(n).collect();
     Printer {
         out: out,
         buf_len: n,
diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs
index e1c8ff5011b..c1823231e24 100644
--- a/src/libsyntax/std_inject.rs
+++ b/src/libsyntax/std_inject.rs
@@ -163,7 +163,7 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
                 }),
         };
 
-        let (crates, uses) = view_items.partitioned(|x| {
+        let (crates, uses): (Vec<_>, _) = view_items.iter().cloned().partition(|x| {
             match x.node {
                 ast::ViewItemExternCrate(..) => true,
                 _ => false,
diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs
index bac2452524e..680ed55cd98 100644
--- a/src/libterm/terminfo/parm.rs
+++ b/src/libterm/terminfo/parm.rs
@@ -16,6 +16,7 @@ use self::FormatState::*;
 use self::FormatOp::*;
 use std::ascii::OwnedAsciiExt;
 use std::mem::replace;
+use std::iter::repeat;
 
 #[deriving(Copy, PartialEq)]
 enum States {
@@ -508,7 +509,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> {
             if flags.precision > s.len() {
                 let mut s_ = Vec::with_capacity(flags.precision);
                 let n = flags.precision - s.len();
-                s_.grow(n, b'0');
+                s_.extend(repeat(b'0').take(n));
                 s_.extend(s.into_iter());
                 s = s_;
             }
@@ -560,10 +561,10 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> {
     if flags.width > s.len() {
         let n = flags.width - s.len();
         if flags.left {
-            s.grow(n, b' ');
+            s.extend(repeat(b' ').take(n));
         } else {
             let mut s_ = Vec::with_capacity(flags.width);
-            s_.grow(n, b' ');
+            s_.extend(repeat(b' ').take(n));
             s_.extend(s.into_iter());
             s = s_;
         }
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 88dd6fce88f..c097e933790 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -990,8 +990,8 @@ fn run_tests<F>(opts: &TestOpts,
 
     try!(callback(TeFiltered(filtered_descs)));
 
-    let (filtered_tests, filtered_benchs_and_metrics) =
-        filtered_tests.partition(|e| {
+    let (filtered_tests, filtered_benchs_and_metrics): (Vec<_>, _) =
+        filtered_tests.into_iter().partition(|e| {
             match e.testfn {
                 StaticTestFn(_) | DynTestFn(_) => true,
                 _ => false
diff --git a/src/libunicode/normalize.rs b/src/libunicode/normalize.rs
index d239cb82896..9e4aa071247 100644
--- a/src/libunicode/normalize.rs
+++ b/src/libunicode/normalize.rs
@@ -13,21 +13,21 @@
 use core::cmp::Ordering::{Equal, Less, Greater};
 use core::option::Option;
 use core::option::Option::{Some, None};
-use core::slice;
 use core::slice::SliceExt;
+use core::result::Result::{Ok, Err};
 use tables::normalization::{canonical_table, compatibility_table, composition_table};
 
 fn bsearch_table<T>(c: char, r: &'static [(char, &'static [T])]) -> Option<&'static [T]> {
-    match r.binary_search(|&(val, _)| {
+    match r.binary_search_by(|&(val, _)| {
         if c == val { Equal }
         else if val < c { Less }
         else { Greater }
     }) {
-        slice::BinarySearchResult::Found(idx) => {
+        Ok(idx) => {
             let (_, result) = r[idx];
             Some(result)
         }
-        slice::BinarySearchResult::NotFound(_) => None
+        Err(_) => None
     }
 }
 
@@ -81,16 +81,16 @@ pub fn compose(a: char, b: char) -> Option<char> {
         match bsearch_table(a, composition_table) {
             None => None,
             Some(candidates) => {
-                match candidates.binary_search(|&(val, _)| {
+                match candidates.binary_search_by(|&(val, _)| {
                     if b == val { Equal }
                     else if val < b { Less }
                     else { Greater }
                 }) {
-                    slice::BinarySearchResult::Found(idx) => {
+                    Ok(idx) => {
                         let (_, result) = candidates[idx];
                         Some(result)
                     }
-                    slice::BinarySearchResult::NotFound(_) => None
+                    Err(_) => None
                 }
             }
         }
diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs
index a219aefad19..5a8f63f207e 100644
--- a/src/libunicode/tables.rs
+++ b/src/libunicode/tables.rs
@@ -19,11 +19,11 @@ pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0);
 fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
     use core::cmp::Ordering::{Equal, Less, Greater};
     use core::slice::SliceExt;
-    r.binary_search(|&(lo,hi)| {
+    r.binary_search_by(|&(lo,hi)| {
         if lo <= c && c <= hi { Equal }
         else if hi < c { Less }
         else { Greater }
-    }).found().is_some()
+    }).is_ok()
 }
 
 pub mod general_category {
@@ -6826,17 +6826,17 @@ pub mod normalization {
     fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
         use core::cmp::Ordering::{Equal, Less, Greater};
         use core::slice::SliceExt;
-        use core::slice;
-        match r.binary_search(|&(lo, hi, _)| {
+        use core::result::Result::{Ok, Err};
+        match r.binary_search_by(|&(lo, hi, _)| {
             if lo <= c && c <= hi { Equal }
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::BinarySearchResult::Found(idx) => {
+            Ok(idx) => {
                 let (_, _, result) = r[idx];
                 result
             }
-            slice::BinarySearchResult::NotFound(_) => 0
+            Err(_) => 0
         }
     }
 
@@ -6961,7 +6961,7 @@ pub mod conversions {
     use core::slice::SliceExt;
     use core::option::Option;
     use core::option::Option::{Some, None};
-    use core::slice;
+    use core::result::Result::{Ok, Err};
 
     pub fn to_lower(c: char) -> char {
         match bsearch_case_table(c, LuLl_table) {
@@ -6978,13 +6978,13 @@ pub mod conversions {
     }
 
     fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> {
-        match table.binary_search(|&(key, _)| {
+        match table.binary_search_by(|&(key, _)| {
             if c == key { Equal }
             else if key < c { Less }
             else { Greater }
         }) {
-            slice::BinarySearchResult::Found(i) => Some(i),
-            slice::BinarySearchResult::NotFound(_) => None,
+            Ok(i) => Some(i),
+            Err(_) => None,
         }
     }
 
@@ -7596,20 +7596,20 @@ pub mod charwidth {
     use core::option::Option;
     use core::option::Option::{Some, None};
     use core::slice::SliceExt;
-    use core::slice;
+    use core::result::Result::{Ok, Err};
 
     fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
         use core::cmp::Ordering::{Equal, Less, Greater};
-        match r.binary_search(|&(lo, hi, _, _)| {
+        match r.binary_search_by(|&(lo, hi, _, _)| {
             if lo <= c && c <= hi { Equal }
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::BinarySearchResult::Found(idx) => {
+            Ok(idx) => {
                 let (_, _, r_ncjk, r_cjk) = r[idx];
                 if is_cjk { r_cjk } else { r_ncjk }
             }
-            slice::BinarySearchResult::NotFound(_) => 1
+            Err(_) => 1
         }
     }
 
@@ -7804,7 +7804,7 @@ pub mod grapheme {
     use core::kinds::Copy;
     use core::slice::SliceExt;
     pub use self::GraphemeCat::*;
-    use core::slice;
+    use core::result::Result::{Ok, Err};
 
     #[allow(non_camel_case_types)]
     #[deriving(Clone)]
@@ -7825,16 +7825,16 @@ pub mod grapheme {
 
     fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
         use core::cmp::Ordering::{Equal, Less, Greater};
-        match r.binary_search(|&(lo, hi, _)| {
+        match r.binary_search_by(|&(lo, hi, _)| {
             if lo <= c && c <= hi { Equal }
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::BinarySearchResult::Found(idx) => {
+            Ok(idx) => {
                 let (_, _, cat) = r[idx];
                 cat
             }
-            slice::BinarySearchResult::NotFound(_) => GC_Any
+            Err(_) => GC_Any
         }
     }
 
diff --git a/src/rust-installer b/src/rust-installer
index aed73472416..3a37981744a 160000
--- a/src/rust-installer
+++ b/src/rust-installer
@@ -1 +1 @@
-Subproject commit aed73472416064642911af790b25d57c9390b6c7
+Subproject commit 3a37981744a5af2433fed551f742465c78c9af7f
diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs
index d9a4aede7d7..26d4ec25c64 100644
--- a/src/test/bench/core-std.rs
+++ b/src/test/bench/core-std.rs
@@ -65,7 +65,7 @@ fn shift_push() {
     let mut v2 = Vec::new();
 
     while v1.len() > 0 {
-        v2.push(v1.remove(0).unwrap());
+        v2.push(v1.remove(0));
     }
 }
 
diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs
index 6ee2233f168..909f8afc34a 100644
--- a/src/test/bench/shootout-reverse-complement.rs
+++ b/src/test/bench/shootout-reverse-complement.rs
@@ -181,7 +181,7 @@ fn reverse_complement(seq: &mut [u8], tables: &Tables) {
         unsafe {
             copy_memory(seq.as_mut_ptr().offset((i - off + 1) as int),
                         seq.as_ptr().offset((i - off) as int), off);
-            *seq.unsafe_mut(i - off) = b'\n';
+            *seq.get_unchecked_mut(i - off) = b'\n';
         }
         i += LINE_LEN + 1;
     }
diff --git a/src/test/compile-fail/issue-15756.rs b/src/test/compile-fail/issue-15756.rs
index df19de7731a..5be3b960ec6 100644
--- a/src/test/compile-fail/issue-15756.rs
+++ b/src/test/compile-fail/issue-15756.rs
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 use std::slice::Chunks;
-use std::slice::MutChunks;
+use std::slice::ChunksMut;
 
-fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: MutChunks<'a,T>)
+fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
 {
     for
     &something
diff --git a/src/test/compile-fail/resolve-conflict-type-vs-import.rs b/src/test/compile-fail/resolve-conflict-type-vs-import.rs
index de934286a7c..45b0314d2c0 100644
--- a/src/test/compile-fail/resolve-conflict-type-vs-import.rs
+++ b/src/test/compile-fail/resolve-conflict-type-vs-import.rs
@@ -15,4 +15,3 @@ struct Iter;
 
 fn main() {
 }
-