about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/bit.rs24
-rw-r--r--src/libcollections/btree/map.rs66
-rw-r--r--src/libcollections/btree/node.rs5
-rw-r--r--src/libcollections/btree/set.rs10
-rw-r--r--src/libcollections/dlist.rs10
-rw-r--r--src/libcollections/enum_set.rs10
-rw-r--r--src/libcollections/lib.rs36
-rw-r--r--src/libcollections/macros.rs14
-rw-r--r--src/libcollections/ring_buf.rs20
-rw-r--r--src/libcollections/slice.rs59
-rw-r--r--src/libcollections/str.rs106
-rw-r--r--src/libcollections/string.rs89
-rw-r--r--src/libcollections/vec.rs103
-rw-r--r--src/libcollections/vec_map.rs13
14 files changed, 302 insertions, 263 deletions
diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs
index c092e000215..2154d06377a 100644
--- a/src/libcollections/bit.rs
+++ b/src/libcollections/bit.rs
@@ -143,17 +143,17 @@ static FALSE: bool = false;
 /// bv.set(3, true);
 /// bv.set(5, true);
 /// bv.set(7, true);
-/// println!("{}", bv.to_string());
+/// println!("{:?}", bv);
 /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
 ///
 /// // flip all values in bitvector, producing non-primes less than 10
 /// bv.negate();
-/// println!("{}", bv.to_string());
+/// println!("{:?}", bv);
 /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
 ///
 /// // reset bitvector to empty
 /// bv.clear();
-/// println!("{}", bv.to_string());
+/// println!("{:?}", bv);
 /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
 /// ```
 #[stable]
@@ -330,7 +330,7 @@ impl Bitv {
 
         if extra_bytes > 0 {
             let mut last_word = 0u32;
-            for (i, &byte) in bytes[complete_words*4..].iter().enumerate() {
+            for (i, &byte) in bytes.index(&((complete_words*4)..)).iter().enumerate() {
                 last_word |= (reverse_bits(byte) as u32) << (i * 8);
             }
             bitv.storage.push(last_word);
@@ -1729,13 +1729,13 @@ impl BitvSet {
 
 impl fmt::Show for BitvSet {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(fmt, "{{"));
+        try!(write!(fmt, "BitvSet {{"));
         let mut first = true;
         for n in self.iter() {
             if !first {
                 try!(write!(fmt, ", "));
             }
-            try!(write!(fmt, "{}", n));
+            try!(write!(fmt, "{:?}", n));
             first = false;
         }
         write!(fmt, "}}")
@@ -1881,10 +1881,10 @@ mod tests {
     #[test]
     fn test_to_str() {
         let zerolen = Bitv::new();
-        assert_eq!(zerolen.to_string(), "");
+        assert_eq!(format!("{:?}", zerolen), "");
 
         let eightbits = Bitv::from_elem(8u, false);
-        assert_eq!(eightbits.to_string(), "00000000")
+        assert_eq!(format!("{:?}", eightbits), "00000000")
     }
 
     #[test]
@@ -1910,7 +1910,7 @@ mod tests {
         let mut b = Bitv::from_elem(2, false);
         b.set(0, true);
         b.set(1, false);
-        assert_eq!(b.to_string(), "10");
+        assert_eq!(format!("{:?}", b), "10");
         assert!(!b.none() && !b.all());
     }
 
@@ -2245,7 +2245,7 @@ mod tests {
     fn test_from_bytes() {
         let bitv = Bitv::from_bytes(&[0b10110110, 0b00000000, 0b11111111]);
         let str = concat!("10110110", "00000000", "11111111");
-        assert_eq!(bitv.to_string(), str);
+        assert_eq!(format!("{:?}", bitv), str);
     }
 
     #[test]
@@ -2264,7 +2264,7 @@ mod tests {
     fn test_from_bools() {
         let bools = vec![true, false, true, true];
         let bitv: Bitv = bools.iter().map(|n| *n).collect();
-        assert_eq!(bitv.to_string(), "1011");
+        assert_eq!(format!("{:?}", bitv), "1011");
     }
 
     #[test]
@@ -2622,7 +2622,7 @@ mod bitv_set_test {
         s.insert(10);
         s.insert(50);
         s.insert(2);
-        assert_eq!("{1, 2, 10, 50}", s.to_string());
+        assert_eq!("BitvSet {1u, 2u, 10u, 50u}", format!("{:?}", s));
     }
 
     #[test]
diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs
index b85ea65f5ce..4e44779810b 100644
--- a/src/libcollections/btree/map.rs
+++ b/src/libcollections/btree/map.rs
@@ -19,7 +19,7 @@ pub use self::Entry::*;
 
 use core::prelude::*;
 
-use core::borrow::{BorrowFrom, ToOwned};
+use core::borrow::BorrowFrom;
 use core::cmp::Ordering;
 use core::default::Default;
 use core::fmt::Show;
@@ -128,24 +128,24 @@ pub struct Values<'a, K: 'a, V: 'a> {
     inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
 }
 
-#[stable]
 /// A view into a single entry in a map, which may either be vacant or occupied.
-pub enum Entry<'a, Q: ?Sized +'a, K:'a, V:'a> {
+#[unstable = "precise API still under development"]
+pub enum Entry<'a, K:'a, V:'a> {
     /// A vacant Entry
-    Vacant(VacantEntry<'a, Q, K, V>),
+    Vacant(VacantEntry<'a, K, V>),
     /// An occupied Entry
     Occupied(OccupiedEntry<'a, K, V>),
 }
 
-#[stable]
 /// A vacant Entry.
-pub struct VacantEntry<'a, Q: ?Sized +'a, K:'a, V:'a> {
-    key: &'a Q,
+#[unstable = "precise API still under development"]
+pub struct VacantEntry<'a, K:'a, V:'a> {
+    key: K,
     stack: stack::SearchStack<'a, K, V, node::handle::Edge, node::handle::Leaf>,
 }
 
-#[stable]
 /// An occupied Entry.
+#[unstable = "precise API still under development"]
 pub struct OccupiedEntry<'a, K:'a, V:'a> {
     stack: stack::SearchStack<'a, K, V, node::handle::KV, node::handle::LeafOrInternal>,
 }
@@ -480,7 +480,7 @@ enum Continuation<A, B> {
 /// boilerplate gets cut out.
 mod stack {
     use core::prelude::*;
-    use core::kinds::marker;
+    use core::marker;
     use core::mem;
     use core::ops::{Deref, DerefMut};
     use super::BTreeMap;
@@ -866,11 +866,11 @@ impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
 #[stable]
 impl<K: Show, V: Show> Show for BTreeMap<K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{{"));
+        try!(write!(f, "BTreeMap {{"));
 
         for (i, (k, v)) in self.iter().enumerate() {
             if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{}: {}", *k, *v));
+            try!(write!(f, "{:?}: {:?}", *k, *v));
         }
 
         write!(f, "}}")
@@ -933,7 +933,7 @@ enum StackOp<T> {
 }
 
 impl<K, V, E, T> Iterator for AbsIter<T> where
-    T: DoubleEndedIterator + Iterator<Item=TraversalItem<K, V, E>> + Traverse<E>,
+    T: DoubleEndedIterator<Item=TraversalItem<K, V, E>> + Traverse<E>,
 {
     type Item = (K, V);
 
@@ -1002,7 +1002,7 @@ impl<K, V, E, T> Iterator for AbsIter<T> where
 }
 
 impl<K, V, E, T> DoubleEndedIterator for AbsIter<T> where
-    T: DoubleEndedIterator + Iterator<Item=TraversalItem<K, V, E>> + Traverse<E>,
+    T: DoubleEndedIterator<Item=TraversalItem<K, V, E>> + Traverse<E>,
 {
     // next_back is totally symmetric to next
     fn next_back(&mut self) -> Option<(K, V)> {
@@ -1111,10 +1111,10 @@ impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
 #[stable]
 impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {}
 
-impl<'a, Q: ?Sized, K: Ord, V> Entry<'a, Q, K, V> {
+impl<'a, K: Ord, V> Entry<'a, K, V> {
     #[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
     /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
-    pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, Q, K, V>> {
+    pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> {
         match self {
             Occupied(entry) => Ok(entry.into_mut()),
             Vacant(entry) => Err(entry),
@@ -1122,44 +1122,44 @@ impl<'a, Q: ?Sized, K: Ord, V> Entry<'a, Q, K, V> {
     }
 }
 
-impl<'a, Q: ?Sized + ToOwned<K>, K: Ord, V> VacantEntry<'a, Q, K, V> {
-    #[stable]
+impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
     /// Sets the value of the entry with the VacantEntry's key,
     /// and returns a mutable reference to it.
+    #[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
     pub fn insert(self, value: V) -> &'a mut V {
-        self.stack.insert(self.key.to_owned(), value)
+        self.stack.insert(self.key, value)
     }
 }
 
 impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
-    #[stable]
     /// Gets a reference to the value in the entry.
+    #[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
     pub fn get(&self) -> &V {
         self.stack.peek()
     }
 
-    #[stable]
     /// Gets a mutable reference to the value in the entry.
+    #[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
     pub fn get_mut(&mut self) -> &mut V {
         self.stack.peek_mut()
     }
 
-    #[stable]
     /// Converts the entry into a mutable reference to its value.
+    #[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
     pub fn into_mut(self) -> &'a mut V {
         self.stack.into_top()
     }
 
-    #[stable]
     /// Sets the value of the entry with the OccupiedEntry's key,
     /// and returns the entry's old value.
+    #[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
     pub fn insert(&mut self, mut value: V) -> V {
         mem::swap(self.stack.peek_mut(), &mut value);
         value
     }
 
-    #[stable]
     /// Takes the value of the entry out of the map, and returns it.
+    #[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
     pub fn remove(self) -> V {
         self.stack.remove()
     }
@@ -1347,7 +1347,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
     ///
     /// // count the number of occurrences of letters in the vec
     /// for x in vec!["a","b","a","c","a","b"].iter() {
-    ///     match count.entry(x) {
+    ///     match count.entry(*x) {
     ///         Entry::Vacant(view) => {
     ///             view.insert(1);
     ///         },
@@ -1361,15 +1361,13 @@ impl<K: Ord, V> BTreeMap<K, V> {
     /// assert_eq!(count["a"], 3u);
     /// ```
     /// The key must have the same ordering before or after `.to_owned()` is called.
-    #[stable]
-    pub fn entry<'a, Q: ?Sized>(&'a mut self, mut key: &'a Q) -> Entry<'a, Q, K, V>
-        where Q: Ord + ToOwned<K>
-    {
+    #[unstable = "precise API still under development"]
+    pub fn entry<'a>(&'a mut self, mut key: K) -> Entry<'a, K, V> {
         // same basic logic of `swap` and `pop`, blended together
         let mut stack = stack::PartialSearchStack::new(self);
         loop {
             let result = stack.with(move |pusher, node| {
-                return match Node::search(node, key) {
+                return match Node::search(node, &key) {
                     Found(handle) => {
                         // Perfect match
                         Finished(Occupied(OccupiedEntry {
@@ -1412,7 +1410,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
 #[cfg(test)]
 mod test {
     use prelude::*;
-    use std::borrow::{ToOwned, BorrowFrom};
+    use std::borrow::BorrowFrom;
 
     use super::{BTreeMap, Occupied, Vacant};
 
@@ -1562,7 +1560,7 @@ mod test {
         let mut map: BTreeMap<int, int> = xs.iter().map(|&x| x).collect();
 
         // Existing key (insert)
-        match map.entry(&1) {
+        match map.entry(1) {
             Vacant(_) => unreachable!(),
             Occupied(mut view) => {
                 assert_eq!(view.get(), &10);
@@ -1574,7 +1572,7 @@ mod test {
 
 
         // Existing key (update)
-        match map.entry(&2) {
+        match map.entry(2) {
             Vacant(_) => unreachable!(),
             Occupied(mut view) => {
                 let v = view.get_mut();
@@ -1585,7 +1583,7 @@ mod test {
         assert_eq!(map.len(), 6);
 
         // Existing key (take)
-        match map.entry(&3) {
+        match map.entry(3) {
             Vacant(_) => unreachable!(),
             Occupied(view) => {
                 assert_eq!(view.remove(), 30);
@@ -1596,7 +1594,7 @@ mod test {
 
 
         // Inexistent key (insert)
-        match map.entry(&10) {
+        match map.entry(10) {
             Occupied(_) => unreachable!(),
             Vacant(view) => {
                 assert_eq!(*view.insert(1000), 1000);
diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs
index 0a93bbf89c9..82d8dc286ee 100644
--- a/src/libcollections/btree/node.rs
+++ b/src/libcollections/btree/node.rs
@@ -493,7 +493,7 @@ impl<K: Clone, V: Clone> Clone for Node<K, V> {
 ///     // Now the handle still points at index 75, but on the small node, which has no index 75.
 ///     flag.set(true);
 ///
-///     println!("Uninitialized memory: {}", handle.into_kv());
+///     println!("Uninitialized memory: {:?}", handle.into_kv());
 /// }
 /// ```
 #[derive(Copy)]
@@ -1417,7 +1417,7 @@ pub type MutTraversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Iter<'a,
 /// An owning traversal over a node's entries and edges
 pub type MoveTraversal<K, V> = AbsTraversal<MoveTraversalImpl<K, V>>;
 
-
+#[old_impl_check]
 impl<K, V, E, Impl: TraversalImpl<K, V, E>> Iterator for AbsTraversal<Impl> {
     type Item = TraversalItem<K, V, E>;
 
@@ -1433,6 +1433,7 @@ impl<K, V, E, Impl: TraversalImpl<K, V, E>> Iterator for AbsTraversal<Impl> {
     }
 }
 
+#[old_impl_check]
 impl<K, V, E, Impl: TraversalImpl<K, V, E>> DoubleEndedIterator for AbsTraversal<Impl> {
     fn next_back(&mut self) -> Option<TraversalItem<K, V, E>> {
         let tail_is_edge = self.tail_is_edge;
diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs
index 98f16332170..25df4a3cc2a 100644
--- a/src/libcollections/btree/set.rs
+++ b/src/libcollections/btree/set.rs
@@ -556,11 +556,11 @@ impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> {
 #[stable]
 impl<T: Show> Show for BTreeSet<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{{"));
+        try!(write!(f, "BTreeSet {{"));
 
         for (i, x) in self.iter().enumerate() {
             if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{}", *x));
+            try!(write!(f, "{:?}", *x));
         }
 
         write!(f, "}}")
@@ -842,9 +842,9 @@ mod test {
         set.insert(1);
         set.insert(2);
 
-        let set_str = format!("{}", set);
+        let set_str = format!("{:?}", set);
 
-        assert!(set_str == "{1, 2}");
-        assert_eq!(format!("{}", empty), "{}");
+        assert_eq!(set_str, "BTreeSet {1i, 2i}");
+        assert_eq!(format!("{:?}", empty), "BTreeSet {}");
     }
 }
diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs
index 5e08f90ce1c..63ea9f7cb43 100644
--- a/src/libcollections/dlist.rs
+++ b/src/libcollections/dlist.rs
@@ -663,11 +663,11 @@ impl<A: Clone> Clone for DList<A> {
 #[stable]
 impl<A: fmt::Show> fmt::Show for DList<A> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "["));
+        try!(write!(f, "DList ["));
 
         for (i, e) in self.iter().enumerate() {
             if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{}", *e));
+            try!(write!(f, "{:?}", *e));
         }
 
         write!(f, "]")
@@ -924,7 +924,7 @@ mod tests {
     #[test]
     fn test_send() {
         let n = list_from(&[1i,2,3]);
-        Thread::spawn(move || {
+        Thread::scoped(move || {
             check_links(&n);
             let a: &[_] = &[&1,&2,&3];
             assert_eq!(a, n.iter().collect::<Vec<&int>>());
@@ -1018,12 +1018,12 @@ mod tests {
     #[test]
     fn test_show() {
         let list: DList<int> = range(0i, 10).collect();
-        assert!(list.to_string() == "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
+        assert_eq!(format!("{:?}", list), "DList [0i, 1i, 2i, 3i, 4i, 5i, 6i, 7i, 8i, 9i]");
 
         let list: DList<&str> = vec!["just", "one", "test", "more"].iter()
                                                                    .map(|&s| s)
                                                                    .collect();
-        assert!(list.to_string() == "[just, one, test, more]");
+        assert_eq!(format!("{:?}", list), "DList [\"just\", \"one\", \"test\", \"more\"]");
     }
 
     #[cfg(test)]
diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs
index 4b94348e87a..1b852d0ba68 100644
--- a/src/libcollections/enum_set.rs
+++ b/src/libcollections/enum_set.rs
@@ -33,13 +33,13 @@ impl<E> Copy for EnumSet<E> {}
 
 impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(fmt, "{{"));
+        try!(write!(fmt, "EnumSet {{"));
         let mut first = true;
         for e in self.iter() {
             if !first {
                 try!(write!(fmt, ", "));
             }
-            try!(write!(fmt, "{}", e));
+            try!(write!(fmt, "{:?}", e));
             first = false;
         }
         write!(fmt, "}}")
@@ -287,11 +287,11 @@ mod test {
     #[test]
     fn test_show() {
         let mut e = EnumSet::new();
-        assert_eq!("{}", e.to_string());
+        assert!(format!("{:?}", e) == "EnumSet {}");
         e.insert(A);
-        assert_eq!("{A}", e.to_string());
+        assert!(format!("{:?}", e) == "EnumSet {A}");
         e.insert(C);
-        assert_eq!("{A, C}", e.to_string());
+        assert!(format!("{:?}", e) == "EnumSet {A, C}");
     }
 
     #[test]
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index 5bf5f78af94..6eab36d8844 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -22,18 +22,11 @@
        html_playground_url = "http://play.rust-lang.org/")]
 
 #![allow(unknown_features)]
-#![feature(macro_rules, default_type_params, phase, globs)]
 #![feature(unsafe_destructor, slicing_syntax)]
+#![feature(old_impl_check)]
 #![feature(unboxed_closures)]
-#![feature(old_orphan_check)]
-#![feature(associated_types)]
 #![no_std]
 
-#[cfg(stage0)]
-#[phase(plugin, link)]
-extern crate core;
-
-#[cfg(not(stage0))]
 #[macro_use]
 extern crate core;
 
@@ -41,22 +34,8 @@ extern crate unicode;
 extern crate alloc;
 
 #[cfg(test)] extern crate test;
-
-#[cfg(all(test, stage0))]
-#[phase(plugin, link)]
-extern crate std;
-
-#[cfg(all(test, not(stage0)))]
-#[macro_use]
-extern crate std;
-
-#[cfg(all(test, stage0))]
-#[phase(plugin, link)]
-extern crate log;
-
-#[cfg(all(test, not(stage0)))]
-#[macro_use]
-extern crate log;
+#[cfg(test)] #[macro_use] extern crate std;
+#[cfg(test)] #[macro_use] extern crate log;
 
 pub use binary_heap::BinaryHeap;
 pub use bitv::Bitv;
@@ -73,8 +52,7 @@ pub use vec_map::VecMap;
 // Needed for the vec! macro
 pub use alloc::boxed;
 
-#[cfg_attr(stage0, macro_escape)]
-#[cfg_attr(not(stage0), macro_use)]
+#[macro_use]
 mod macros;
 
 pub mod binary_heap;
@@ -123,7 +101,9 @@ mod std {
     pub use core::option;   // necessary for panic!()
     pub use core::clone;    // deriving(Clone)
     pub use core::cmp;      // deriving(Eq, Ord, etc.)
-    pub use core::kinds;    // deriving(Copy)
+    #[cfg(stage0)]
+    pub use core::marker as kinds;
+    pub use core::marker;  // deriving(Copy)
     pub use core::hash;     // deriving(Hash)
 }
 
@@ -138,7 +118,7 @@ mod prelude {
     pub use core::iter::{FromIterator, Extend, IteratorExt};
     pub use core::iter::{Iterator, DoubleEndedIterator, RandomAccessIterator};
     pub use core::iter::{ExactSizeIterator};
-    pub use core::kinds::{Copy, Send, Sized, Sync};
+    pub use core::marker::{Copy, Send, Sized, Sync};
     pub use core::mem::drop;
     pub use core::ops::{Drop, Fn, FnMut, FnOnce};
     pub use core::option::Option;
diff --git a/src/libcollections/macros.rs b/src/libcollections/macros.rs
index 0c5929e8661..68e2482964d 100644
--- a/src/libcollections/macros.rs
+++ b/src/libcollections/macros.rs
@@ -8,21 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-/// Creates a `std::vec::Vec` containing the arguments.
-// NOTE: remove after the next snapshot
-#[cfg(stage0)]
-macro_rules! vec {
-    ($($e:expr),*) => ({
-        // leading _ to allow empty construction without a warning.
-        let mut _temp = ::vec::Vec::new();
-        $(_temp.push($e);)*
-        _temp
-    });
-    ($($e:expr),+,) => (vec!($($e),+))
-}
-
 /// Creates a `Vec` containing the arguments.
-#[cfg(not(stage0))]
 #[macro_export]
 macro_rules! vec {
     ($($x:expr),*) => ({
diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs
index 11775f62b1c..42c17136a08 100644
--- a/src/libcollections/ring_buf.rs
+++ b/src/libcollections/ring_buf.rs
@@ -20,7 +20,7 @@ use core::cmp::Ordering;
 use core::default::Default;
 use core::fmt;
 use core::iter::{self, repeat, FromIterator, RandomAccessIterator};
-use core::kinds::marker;
+use core::marker;
 use core::mem;
 use core::num::{Int, UnsignedInt};
 use core::ops::{Index, IndexMut};
@@ -525,7 +525,7 @@ impl<T> RingBuf<T> {
     ///     *num = *num - 2;
     /// }
     /// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
-    /// assert_eq!(buf.iter_mut().collect::<Vec<&mut int>>()[], b);
+    /// assert_eq!(&buf.iter_mut().collect::<Vec<&mut int>>()[], b);
     /// ```
     #[stable]
     pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> {
@@ -556,7 +556,7 @@ impl<T> RingBuf<T> {
             let buf = self.buffer_as_slice();
             if contiguous {
                 let (empty, buf) = buf.split_at(0);
-                (buf[self.tail..self.head], empty)
+                (buf.index(&(self.tail..self.head)), empty)
             } else {
                 let (mid, right) = buf.split_at(self.tail);
                 let (left, _) = mid.split_at(self.head);
@@ -1613,11 +1613,11 @@ impl<A> Extend<A> for RingBuf<A> {
 #[stable]
 impl<T: fmt::Show> fmt::Show for RingBuf<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "["));
+        try!(write!(f, "RingBuf ["));
 
         for (i, e) in self.iter().enumerate() {
             if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{}", *e));
+            try!(write!(f, "{:?}", *e));
         }
 
         write!(f, "]")
@@ -1648,21 +1648,15 @@ mod tests {
         assert_eq!(d.len(), 3u);
         d.push_back(137);
         assert_eq!(d.len(), 4u);
-        debug!("{}", d.front());
         assert_eq!(*d.front().unwrap(), 42);
-        debug!("{}", d.back());
         assert_eq!(*d.back().unwrap(), 137);
         let mut i = d.pop_front();
-        debug!("{}", i);
         assert_eq!(i, Some(42));
         i = d.pop_back();
-        debug!("{}", i);
         assert_eq!(i, Some(137));
         i = d.pop_back();
-        debug!("{}", i);
         assert_eq!(i, Some(137));
         i = d.pop_back();
-        debug!("{}", i);
         assert_eq!(i, Some(17));
         assert_eq!(d.len(), 0u);
         d.push_back(3);
@@ -2308,12 +2302,12 @@ mod tests {
     #[test]
     fn test_show() {
         let ringbuf: RingBuf<int> = range(0i, 10).collect();
-        assert!(format!("{}", ringbuf) == "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
+        assert_eq!(format!("{:?}", ringbuf), "RingBuf [0i, 1i, 2i, 3i, 4i, 5i, 6i, 7i, 8i, 9i]");
 
         let ringbuf: RingBuf<&str> = vec!["just", "one", "test", "more"].iter()
                                                                         .map(|&s| s)
                                                                         .collect();
-        assert!(format!("{}", ringbuf) == "[just, one, test, more]");
+        assert_eq!(format!("{:?}", ringbuf), "RingBuf [\"just\", \"one\", \"test\", \"more\"]");
     }
 
     #[test]
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 9e5aa7d645b..582887ac38a 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -55,7 +55,7 @@
 //! #![feature(slicing_syntax)]
 //! fn main() {
 //!     let numbers = [0i, 1i, 2i];
-//!     let last_numbers = numbers[1..3];
+//!     let last_numbers = numbers.index(&(1..3));
 //!     // last_numbers is now &[1i, 2i]
 //! }
 //! ```
@@ -95,10 +95,10 @@ use core::cmp::Ordering::{self, Greater, Less};
 use core::cmp::{self, Ord, PartialEq};
 use core::iter::{Iterator, IteratorExt};
 use core::iter::{range, range_step, MultiplicativeIterator};
-use core::kinds::Sized;
+use core::marker::Sized;
 use core::mem::size_of;
 use core::mem;
-use core::ops::{FnMut, SliceMut};
+use core::ops::{FnMut, FullRange, Index, IndexMut};
 use core::option::Option::{self, Some, None};
 use core::ptr::PtrExt;
 use core::ptr;
@@ -1065,12 +1065,12 @@ impl ElementSwaps {
 
 #[unstable = "trait is unstable"]
 impl<T> BorrowFrom<Vec<T>> for [T] {
-    fn borrow_from(owned: &Vec<T>) -> &[T] { owned[] }
+    fn borrow_from(owned: &Vec<T>) -> &[T] { owned.index(&FullRange) }
 }
 
 #[unstable = "trait is unstable"]
 impl<T> BorrowFromMut<Vec<T>> for [T] {
-    fn borrow_from_mut(owned: &mut Vec<T>) -> &mut [T] { owned.as_mut_slice_() }
+    fn borrow_from_mut(owned: &mut Vec<T>) -> &mut [T] { owned.index_mut(&FullRange) }
 }
 
 #[unstable = "trait is unstable"]
@@ -1393,15 +1393,20 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
 
 #[cfg(test)]
 mod tests {
-    use prelude::{Some, None, range, Vec, ToString, Clone, Greater, Less, Equal};
-    use prelude::{SliceExt, Iterator, IteratorExt};
-    use prelude::AsSlice;
-    use prelude::{RandomAccessIterator, Ord, SliceConcatExt};
+    use core::cmp::Ordering::{Greater, Less, Equal};
+    use core::prelude::{Some, None, range, Clone};
+    use core::prelude::{Iterator, IteratorExt};
+    use core::prelude::{AsSlice};
+    use core::prelude::{Ord, FullRange};
     use core::default::Default;
     use core::mem;
+    use core::ops::Index;
+    use std::iter::RandomAccessIterator;
     use std::rand::{Rng, thread_rng};
     use std::rc::Rc;
-    use super::ElementSwaps;
+    use string::ToString;
+    use vec::Vec;
+    use super::{ElementSwaps, SliceConcatExt, SliceExt};
 
     fn square(n: uint) -> uint { n * n }
 
@@ -1606,7 +1611,7 @@ mod tests {
 
         // Test on stack.
         let vec_stack: &[_] = &[1i, 2, 3];
-        let v_b = vec_stack[1u..3u].to_vec();
+        let v_b = vec_stack.index(&(1u..3u)).to_vec();
         assert_eq!(v_b.len(), 2u);
         let v_b = v_b.as_slice();
         assert_eq!(v_b[0], 2);
@@ -1614,7 +1619,7 @@ mod tests {
 
         // Test `Box<[T]>`
         let vec_unique = vec![1i, 2, 3, 4, 5, 6];
-        let v_d = vec_unique[1u..6u].to_vec();
+        let v_d = vec_unique.index(&(1u..6u)).to_vec();
         assert_eq!(v_d.len(), 5u);
         let v_d = v_d.as_slice();
         assert_eq!(v_d[0], 2);
@@ -1627,21 +1632,21 @@ mod tests {
     #[test]
     fn test_slice_from() {
         let vec: &[int] = &[1, 2, 3, 4];
-        assert_eq!(vec[0..], vec);
+        assert_eq!(vec.index(&(0..)), vec);
         let b: &[int] = &[3, 4];
-        assert_eq!(vec[2..], b);
+        assert_eq!(vec.index(&(2..)), b);
         let b: &[int] = &[];
-        assert_eq!(vec[4..], b);
+        assert_eq!(vec.index(&(4..)), b);
     }
 
     #[test]
     fn test_slice_to() {
         let vec: &[int] = &[1, 2, 3, 4];
-        assert_eq!(vec[..4], vec);
+        assert_eq!(vec.index(&(0..4)), vec);
         let b: &[int] = &[1, 2];
-        assert_eq!(vec[..2], b);
+        assert_eq!(vec.index(&(0..2)), b);
         let b: &[int] = &[];
-        assert_eq!(vec[..0], b);
+        assert_eq!(vec.index(&(0..0)), b);
     }
 
 
@@ -2466,25 +2471,25 @@ mod tests {
         macro_rules! test_show_vec {
             ($x:expr, $x_str:expr) => ({
                 let (x, x_str) = ($x, $x_str);
-                assert_eq!(format!("{}", x), x_str);
-                assert_eq!(format!("{}", x.as_slice()), x_str);
+                assert_eq!(format!("{:?}", x), x_str);
+                assert_eq!(format!("{:?}", x.as_slice()), x_str);
             })
         }
         let empty: Vec<int> = vec![];
         test_show_vec!(empty, "[]");
-        test_show_vec!(vec![1i], "[1]");
-        test_show_vec!(vec![1i, 2, 3], "[1, 2, 3]");
+        test_show_vec!(vec![1i], "[1i]");
+        test_show_vec!(vec![1i, 2, 3], "[1i, 2i, 3i]");
         test_show_vec!(vec![vec![], vec![1u], vec![1u, 1u]],
-                       "[[], [1], [1, 1]]");
+                       "[[], [1u], [1u, 1u]]");
 
         let empty_mut: &mut [int] = &mut[];
         test_show_vec!(empty_mut, "[]");
         let v: &mut[int] = &mut[1];
-        test_show_vec!(v, "[1]");
+        test_show_vec!(v, "[1i]");
         let v: &mut[int] = &mut[1, 2, 3];
-        test_show_vec!(v, "[1, 2, 3]");
+        test_show_vec!(v, "[1i, 2i, 3i]");
         let v: &mut [&mut[uint]] = &mut[&mut[], &mut[1u], &mut[1u, 1u]];
-        test_show_vec!(v, "[[], [1], [1, 1]]");
+        test_show_vec!(v, "[[], [1u], [1u, 1u]]");
     }
 
     #[test]
@@ -2567,7 +2572,7 @@ mod tests {
         }
         assert_eq!(cnt, 3);
 
-        for f in v[1..3].iter() {
+        for f in v.index(&(1..3)).iter() {
             assert!(*f == Foo);
             cnt += 1;
         }
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index c0482702ccd..09d140067f4 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -60,7 +60,7 @@ use core::char::CharExt;
 use core::clone::Clone;
 use core::iter::AdditiveIterator;
 use core::iter::{range, Iterator, IteratorExt};
-use core::ops;
+use core::ops::{FullRange, Index};
 use core::option::Option::{self, Some, None};
 use core::slice::AsSlice;
 use core::str as core_str;
@@ -386,7 +386,7 @@ macro_rules! utf8_acc_cont_byte {
 
 #[unstable = "trait is unstable"]
 impl BorrowFrom<String> for str {
-    fn borrow_from(owned: &String) -> &str { owned[] }
+    fn borrow_from(owned: &String) -> &str { owned.index(&FullRange) }
 }
 
 #[unstable = "trait is unstable"]
@@ -408,7 +408,7 @@ Section: Trait implementations
 
 /// Any string that can be represented as a slice.
 #[stable]
-pub trait StrExt: ops::Slice<uint, str> {
+pub trait StrExt: Index<FullRange, Output = str> {
     /// Escapes each char in `s` with `char::escape_default`.
     #[unstable = "return type may change to be an iterator"]
     fn escape_default(&self) -> String {
@@ -464,7 +464,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     #[unstable = "this functionality may be moved to libunicode"]
     fn nfd_chars<'a>(&'a self) -> Decompositions<'a> {
         Decompositions {
-            iter: self[].chars(),
+            iter: self.index(&FullRange).chars(),
             buffer: Vec::new(),
             sorted: false,
             kind: Canonical
@@ -477,7 +477,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     #[unstable = "this functionality may be moved to libunicode"]
     fn nfkd_chars<'a>(&'a self) -> Decompositions<'a> {
         Decompositions {
-            iter: self[].chars(),
+            iter: self.index(&FullRange).chars(),
             buffer: Vec::new(),
             sorted: false,
             kind: Compatible
@@ -525,7 +525,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn contains(&self, pat: &str) -> bool {
-        core_str::StrExt::contains(self[], pat)
+        core_str::StrExt::contains(self.index(&FullRange), pat)
     }
 
     /// Returns true if a string contains a char pattern.
@@ -541,7 +541,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "might get removed in favour of a more generic contains()"]
     fn contains_char<P: CharEq>(&self, pat: P) -> bool {
-        core_str::StrExt::contains_char(self[], pat)
+        core_str::StrExt::contains_char(self.index(&FullRange), pat)
     }
 
     /// An iterator over the characters of `self`. Note, this iterates
@@ -555,7 +555,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn chars(&self) -> Chars {
-        core_str::StrExt::chars(self[])
+        core_str::StrExt::chars(self.index(&FullRange))
     }
 
     /// An iterator over the bytes of `self`
@@ -568,13 +568,13 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn bytes(&self) -> Bytes {
-        core_str::StrExt::bytes(self[])
+        core_str::StrExt::bytes(self.index(&FullRange))
     }
 
     /// An iterator over the characters of `self` and their byte offsets.
     #[stable]
     fn char_indices(&self) -> CharIndices {
-        core_str::StrExt::char_indices(self[])
+        core_str::StrExt::char_indices(self.index(&FullRange))
     }
 
     /// An iterator over substrings of `self`, separated by characters
@@ -597,7 +597,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn split<P: CharEq>(&self, pat: P) -> Split<P> {
-        core_str::StrExt::split(self[], pat)
+        core_str::StrExt::split(self.index(&FullRange), pat)
     }
 
     /// An iterator over substrings of `self`, separated by characters
@@ -624,7 +624,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn splitn<P: CharEq>(&self, count: uint, pat: P) -> SplitN<P> {
-        core_str::StrExt::splitn(self[], count, pat)
+        core_str::StrExt::splitn(self.index(&FullRange), count, pat)
     }
 
     /// An iterator over substrings of `self`, separated by characters
@@ -653,7 +653,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "might get removed"]
     fn split_terminator<P: CharEq>(&self, pat: P) -> SplitTerminator<P> {
-        core_str::StrExt::split_terminator(self[], pat)
+        core_str::StrExt::split_terminator(self.index(&FullRange), pat)
     }
 
     /// An iterator over substrings of `self`, separated by characters
@@ -674,7 +674,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn rsplitn<P: CharEq>(&self, count: uint, pat: P) -> RSplitN<P> {
-        core_str::StrExt::rsplitn(self[], count, pat)
+        core_str::StrExt::rsplitn(self.index(&FullRange), count, pat)
     }
 
     /// An iterator over the start and end indices of the disjoint
@@ -699,7 +699,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "might have its iterator type changed"]
     fn match_indices<'a>(&'a self, pat: &'a str) -> MatchIndices<'a> {
-        core_str::StrExt::match_indices(self[], pat)
+        core_str::StrExt::match_indices(self.index(&FullRange), pat)
     }
 
     /// An iterator over the substrings of `self` separated by the pattern `sep`.
@@ -715,7 +715,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "might get removed in the future in favor of a more generic split()"]
     fn split_str<'a>(&'a self, pat: &'a str) -> SplitStr<'a> {
-        core_str::StrExt::split_str(self[], pat)
+        core_str::StrExt::split_str(self.index(&FullRange), pat)
     }
 
     /// An iterator over the lines of a string (subsequences separated
@@ -731,7 +731,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn lines(&self) -> Lines {
-        core_str::StrExt::lines(self[])
+        core_str::StrExt::lines(self.index(&FullRange))
     }
 
     /// An iterator over the lines of a string, separated by either
@@ -747,7 +747,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn lines_any(&self) -> LinesAny {
-        core_str::StrExt::lines_any(self[])
+        core_str::StrExt::lines_any(self.index(&FullRange))
     }
 
     /// Returns a slice of the given string from the byte range
@@ -782,7 +782,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "use slice notation [a..b] instead"]
     fn slice(&self, begin: uint, end: uint) -> &str {
-        core_str::StrExt::slice(self[], begin, end)
+        core_str::StrExt::slice(self.index(&FullRange), begin, end)
     }
 
     /// Returns a slice of the string from `begin` to its end.
@@ -795,7 +795,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// See also `slice`, `slice_to` and `slice_chars`.
     #[unstable = "use slice notation [a..] instead"]
     fn slice_from(&self, begin: uint) -> &str {
-        core_str::StrExt::slice_from(self[], begin)
+        core_str::StrExt::slice_from(self.index(&FullRange), begin)
     }
 
     /// Returns a slice of the string from the beginning to byte
@@ -809,7 +809,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// See also `slice`, `slice_from` and `slice_chars`.
     #[unstable = "use slice notation [0..a] instead"]
     fn slice_to(&self, end: uint) -> &str {
-        core_str::StrExt::slice_to(self[], end)
+        core_str::StrExt::slice_to(self.index(&FullRange), end)
     }
 
     /// Returns a slice of the string from the character range
@@ -837,7 +837,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "may have yet to prove its worth"]
     fn slice_chars(&self, begin: uint, end: uint) -> &str {
-        core_str::StrExt::slice_chars(self[], begin, end)
+        core_str::StrExt::slice_chars(self.index(&FullRange), begin, end)
     }
 
     /// Takes a bytewise (not UTF-8) slice from a string.
@@ -848,7 +848,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// the entire slice as well.
     #[stable]
     unsafe fn slice_unchecked(&self, begin: uint, end: uint) -> &str {
-        core_str::StrExt::slice_unchecked(self[], begin, end)
+        core_str::StrExt::slice_unchecked(self.index(&FullRange), begin, end)
     }
 
     /// Returns true if the pattern `pat` is a prefix of the string.
@@ -860,7 +860,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn starts_with(&self, pat: &str) -> bool {
-        core_str::StrExt::starts_with(self[], pat)
+        core_str::StrExt::starts_with(self.index(&FullRange), pat)
     }
 
     /// Returns true if the pattern `pat` is a suffix of the string.
@@ -872,7 +872,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn ends_with(&self, pat: &str) -> bool {
-        core_str::StrExt::ends_with(self[], pat)
+        core_str::StrExt::ends_with(self.index(&FullRange), pat)
     }
 
     /// Returns a string with all pre- and suffixes that match
@@ -892,7 +892,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn trim_matches<P: CharEq>(&self, pat: P) -> &str {
-        core_str::StrExt::trim_matches(self[], pat)
+        core_str::StrExt::trim_matches(self.index(&FullRange), pat)
     }
 
     /// Returns a string with all prefixes that match
@@ -912,7 +912,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn trim_left_matches<P: CharEq>(&self, pat: P) -> &str {
-        core_str::StrExt::trim_left_matches(self[], pat)
+        core_str::StrExt::trim_left_matches(self.index(&FullRange), pat)
     }
 
     /// Returns a string with all suffixes that match
@@ -932,7 +932,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn trim_right_matches<P: CharEq>(&self, pat: P) -> &str {
-        core_str::StrExt::trim_right_matches(self[], pat)
+        core_str::StrExt::trim_right_matches(self.index(&FullRange), pat)
     }
 
     /// Check that `index`-th byte lies at the start and/or end of a
@@ -960,7 +960,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "naming is uncertain with container conventions"]
     fn is_char_boundary(&self, index: uint) -> bool {
-        core_str::StrExt::is_char_boundary(self[], index)
+        core_str::StrExt::is_char_boundary(self.index(&FullRange), index)
     }
 
     /// Pluck a character out of a string and return the index of the next
@@ -1018,7 +1018,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// If `i` is not the index of the beginning of a valid UTF-8 character.
     #[unstable = "naming is uncertain with container conventions"]
     fn char_range_at(&self, start: uint) -> CharRange {
-        core_str::StrExt::char_range_at(self[], start)
+        core_str::StrExt::char_range_at(self.index(&FullRange), start)
     }
 
     /// Given a byte position and a str, return the previous char and its position.
@@ -1033,7 +1033,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// If `i` is not an index following a valid UTF-8 character.
     #[unstable = "naming is uncertain with container conventions"]
     fn char_range_at_reverse(&self, start: uint) -> CharRange {
-        core_str::StrExt::char_range_at_reverse(self[], start)
+        core_str::StrExt::char_range_at_reverse(self.index(&FullRange), start)
     }
 
     /// Plucks the character starting at the `i`th byte of a string.
@@ -1053,7 +1053,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// If `i` is not the index of the beginning of a valid UTF-8 character.
     #[unstable = "naming is uncertain with container conventions"]
     fn char_at(&self, i: uint) -> char {
-        core_str::StrExt::char_at(self[], i)
+        core_str::StrExt::char_at(self.index(&FullRange), i)
     }
 
     /// Plucks the character ending at the `i`th byte of a string.
@@ -1064,7 +1064,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// If `i` is not an index following a valid UTF-8 character.
     #[unstable = "naming is uncertain with container conventions"]
     fn char_at_reverse(&self, i: uint) -> char {
-        core_str::StrExt::char_at_reverse(self[], i)
+        core_str::StrExt::char_at_reverse(self.index(&FullRange), i)
     }
 
     /// Work with the byte buffer of a string as a byte slice.
@@ -1076,7 +1076,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn as_bytes(&self) -> &[u8] {
-        core_str::StrExt::as_bytes(self[])
+        core_str::StrExt::as_bytes(self.index(&FullRange))
     }
 
     /// Returns the byte index of the first character of `self` that
@@ -1104,7 +1104,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn find<P: CharEq>(&self, pat: P) -> Option<uint> {
-        core_str::StrExt::find(self[], pat)
+        core_str::StrExt::find(self.index(&FullRange), pat)
     }
 
     /// Returns the byte index of the last character of `self` that
@@ -1132,7 +1132,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn rfind<P: CharEq>(&self, pat: P) -> Option<uint> {
-        core_str::StrExt::rfind(self[], pat)
+        core_str::StrExt::rfind(self.index(&FullRange), pat)
     }
 
     /// Returns the byte index of the first matching substring
@@ -1156,7 +1156,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "might get removed in favor of a more generic find in the future"]
     fn find_str(&self, needle: &str) -> Option<uint> {
-        core_str::StrExt::find_str(self[], needle)
+        core_str::StrExt::find_str(self.index(&FullRange), needle)
     }
 
     /// Retrieves the first character from a string slice and returns
@@ -1179,7 +1179,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "awaiting conventions about shifting and slices"]
     fn slice_shift_char(&self) -> Option<(char, &str)> {
-        core_str::StrExt::slice_shift_char(self[])
+        core_str::StrExt::slice_shift_char(self.index(&FullRange))
     }
 
     /// Returns the byte offset of an inner slice relative to an enclosing outer slice.
@@ -1198,7 +1198,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "awaiting convention about comparability of arbitrary slices"]
     fn subslice_offset(&self, inner: &str) -> uint {
-        core_str::StrExt::subslice_offset(self[], inner)
+        core_str::StrExt::subslice_offset(self.index(&FullRange), inner)
     }
 
     /// Return an unsafe pointer to the strings buffer.
@@ -1209,13 +1209,13 @@ pub trait StrExt: ops::Slice<uint, str> {
     #[stable]
     #[inline]
     fn as_ptr(&self) -> *const u8 {
-        core_str::StrExt::as_ptr(self[])
+        core_str::StrExt::as_ptr(self.index(&FullRange))
     }
 
     /// Return an iterator of `u16` over the string encoded as UTF-16.
     #[unstable = "this functionality may only be provided by libunicode"]
     fn utf16_units(&self) -> Utf16Units {
-        Utf16Units { encoder: Utf16Encoder::new(self[].chars()) }
+        Utf16Units { encoder: Utf16Encoder::new(self.index(&FullRange).chars()) }
     }
 
     /// Return the number of bytes in this string
@@ -1229,7 +1229,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     #[stable]
     #[inline]
     fn len(&self) -> uint {
-        core_str::StrExt::len(self[])
+        core_str::StrExt::len(self.index(&FullRange))
     }
 
     /// Returns true if this slice contains no bytes
@@ -1242,7 +1242,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     #[inline]
     #[stable]
     fn is_empty(&self) -> bool {
-        core_str::StrExt::is_empty(self[])
+        core_str::StrExt::is_empty(self.index(&FullRange))
     }
 
     /// Parse this string into the specified type.
@@ -1256,7 +1256,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     #[inline]
     #[unstable = "this method was just created"]
     fn parse<F: FromStr>(&self) -> Option<F> {
-        core_str::StrExt::parse(self[])
+        core_str::StrExt::parse(self.index(&FullRange))
     }
 
     /// Returns an iterator over the
@@ -1280,7 +1280,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "this functionality may only be provided by libunicode"]
     fn graphemes(&self, is_extended: bool) -> Graphemes {
-        UnicodeStr::graphemes(self[], is_extended)
+        UnicodeStr::graphemes(self.index(&FullRange), is_extended)
     }
 
     /// Returns an iterator over the grapheme clusters of self and their byte offsets.
@@ -1295,7 +1295,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[unstable = "this functionality may only be provided by libunicode"]
     fn grapheme_indices(&self, is_extended: bool) -> GraphemeIndices {
-        UnicodeStr::grapheme_indices(self[], is_extended)
+        UnicodeStr::grapheme_indices(self.index(&FullRange), is_extended)
     }
 
     /// An iterator over the words of a string (subsequences separated
@@ -1311,7 +1311,7 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// ```
     #[stable]
     fn words(&self) -> Words {
-        UnicodeStr::words(self[])
+        UnicodeStr::words(self.index(&FullRange))
     }
 
     /// Returns a string's displayed width in columns, treating control
@@ -1325,25 +1325,25 @@ pub trait StrExt: ops::Slice<uint, str> {
     /// `is_cjk` = `false`) if the locale is unknown.
     #[unstable = "this functionality may only be provided by libunicode"]
     fn width(&self, is_cjk: bool) -> uint {
-        UnicodeStr::width(self[], is_cjk)
+        UnicodeStr::width(self.index(&FullRange), is_cjk)
     }
 
     /// Returns a string with leading and trailing whitespace removed.
     #[stable]
     fn trim(&self) -> &str {
-        UnicodeStr::trim(self[])
+        UnicodeStr::trim(self.index(&FullRange))
     }
 
     /// Returns a string with leading whitespace removed.
     #[stable]
     fn trim_left(&self) -> &str {
-        UnicodeStr::trim_left(self[])
+        UnicodeStr::trim_left(self.index(&FullRange))
     }
 
     /// Returns a string with trailing whitespace removed.
     #[stable]
     fn trim_right(&self) -> &str {
-        UnicodeStr::trim_right(self[])
+        UnicodeStr::trim_right(self.index(&FullRange))
     }
 }
 
@@ -2133,7 +2133,7 @@ mod tests {
         let mut bytes = [0u8; 4];
         for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) {
             let len = c.encode_utf8(&mut bytes).unwrap_or(0);
-            let s = ::core::str::from_utf8(bytes[..len]).unwrap();
+            let s = ::core::str::from_utf8(&bytes[..len]).unwrap();
             if Some(c) != s.chars().next() {
                 panic!("character {:x}={} does not decode correctly", c as u32, c);
             }
@@ -2145,7 +2145,7 @@ mod tests {
         let mut bytes = [0u8; 4];
         for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) {
             let len = c.encode_utf8(&mut bytes).unwrap_or(0);
-            let s = ::core::str::from_utf8(bytes[..len]).unwrap();
+            let s = ::core::str::from_utf8(&bytes[..len]).unwrap();
             if Some(c) != s.chars().rev().next() {
                 panic!("character {:x}={} does not decode correctly", c as u32, c);
             }
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 0bf311e4d3f..59418f50e3c 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -22,7 +22,7 @@ use core::fmt;
 use core::hash;
 use core::iter::FromIterator;
 use core::mem;
-use core::ops::{self, Deref, Add};
+use core::ops::{self, Deref, Add, Index};
 use core::ptr;
 use core::raw::Slice as RawSlice;
 use unicode::str as unicode_str;
@@ -168,7 +168,7 @@ impl String {
 
         if i > 0 {
             unsafe {
-                res.as_mut_vec().push_all(v[..i])
+                res.as_mut_vec().push_all(v.index(&(0..i)))
             };
         }
 
@@ -185,7 +185,7 @@ impl String {
             macro_rules! error { () => ({
                 unsafe {
                     if subseqidx != i_ {
-                        res.as_mut_vec().push_all(v[subseqidx..i_]);
+                        res.as_mut_vec().push_all(v.index(&(subseqidx..i_)));
                     }
                     subseqidx = i;
                     res.as_mut_vec().push_all(REPLACEMENT);
@@ -254,7 +254,7 @@ impl String {
         }
         if subseqidx < total {
             unsafe {
-                res.as_mut_vec().push_all(v[subseqidx..total])
+                res.as_mut_vec().push_all(v.index(&(subseqidx..total)))
             };
         }
         Cow::Owned(res)
@@ -677,13 +677,25 @@ impl FromUtf8Error {
 
 impl fmt::Show for FromUtf8Error {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.error.fmt(f)
+        fmt::String::fmt(self, f)
+    }
+}
+
+impl fmt::String for FromUtf8Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::String::fmt(&self.error, f)
     }
 }
 
 impl fmt::Show for FromUtf16Error {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        "invalid utf-16: lone surrogate found".fmt(f)
+        fmt::String::fmt(self, f)
+    }
+}
+
+impl fmt::String for FromUtf16Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::String::fmt("invalid utf-16: lone surrogate found", f)
     }
 }
 
@@ -793,10 +805,17 @@ impl Default for String {
     }
 }
 
-#[experimental = "waiting on Show stabilization"]
+#[experimental = "waiting on fmt stabilization"]
+impl fmt::String for String {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::String::fmt(&**self, f)
+    }
+}
+
+#[experimental = "waiting on fmt stabilization"]
 impl fmt::Show for String {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        (**self).fmt(f)
+        fmt::Show::fmt(&**self, f)
     }
 }
 
@@ -818,25 +837,32 @@ impl<'a> Add<&'a str> for String {
     }
 }
 
-impl ops::Slice<uint, str> for String {
+impl ops::Index<ops::Range<uint>> for String {
+    type Output = str;
     #[inline]
-    fn as_slice_<'a>(&'a self) -> &'a str {
-        unsafe { mem::transmute(self.vec.as_slice()) }
+    fn index(&self, index: &ops::Range<uint>) -> &str {
+        &self.index(&FullRange)[*index]
     }
-
+}
+impl ops::Index<ops::RangeTo<uint>> for String {
+    type Output = str;
     #[inline]
-    fn slice_from_or_fail<'a>(&'a self, from: &uint) -> &'a str {
-        self[][*from..]
+    fn index(&self, index: &ops::RangeTo<uint>) -> &str {
+        &self.index(&FullRange)[*index]
     }
-
+}
+impl ops::Index<ops::RangeFrom<uint>> for String {
+    type Output = str;
     #[inline]
-    fn slice_to_or_fail<'a>(&'a self, to: &uint) -> &'a str {
-        self[][..*to]
+    fn index(&self, index: &ops::RangeFrom<uint>) -> &str {
+        &self.index(&FullRange)[*index]
     }
-
+}
+impl ops::Index<ops::FullRange> for String {
+    type Output = str;
     #[inline]
-    fn slice_or_fail<'a>(&'a self, from: &uint, to: &uint) -> &'a str {
-        self[][*from..*to]
+    fn index(&self, _index: &ops::FullRange) -> &str {
+        unsafe { mem::transmute(self.vec.as_slice()) }
     }
 }
 
@@ -845,7 +871,7 @@ impl ops::Deref for String {
     type Target = str;
 
     fn deref<'a>(&'a self) -> &'a str {
-        unsafe { mem::transmute(self.vec[]) }
+        unsafe { mem::transmute(self.vec.index(&FullRange)) }
     }
 }
 
@@ -895,6 +921,7 @@ pub trait ToString {
     fn to_string(&self) -> String;
 }
 
+#[cfg(stage0)]
 impl<T: fmt::Show> ToString for T {
     fn to_string(&self) -> String {
         use core::fmt::Writer;
@@ -905,6 +932,17 @@ impl<T: fmt::Show> ToString for T {
     }
 }
 
+#[cfg(not(stage0))]
+impl<T: fmt::String> ToString for T {
+    fn to_string(&self) -> String {
+        use core::fmt::Writer;
+        let mut buf = String::new();
+        let _ = buf.write_fmt(format_args!("{}", self));
+        buf.shrink_to_fit();
+        buf
+    }
+}
+
 impl IntoCow<'static, String, str> for String {
     fn into_cow(self) -> CowString<'static> {
         Cow::Owned(self)
@@ -943,6 +981,7 @@ mod tests {
     use str::Utf8Error;
     use core::iter::repeat;
     use super::{as_string, CowString};
+    use core::ops::FullRange;
 
     #[test]
     fn test_as_string() {
@@ -1224,10 +1263,10 @@ mod tests {
     #[test]
     fn test_slicing() {
         let s = "foobar".to_string();
-        assert_eq!("foobar", s[]);
-        assert_eq!("foo", s[..3]);
-        assert_eq!("bar", s[3..]);
-        assert_eq!("oob", s[1..4]);
+        assert_eq!("foobar", &s[]);
+        assert_eq!("foo", &s[..3]);
+        assert_eq!("bar", &s[3..]);
+        assert_eq!("oob", &s[1..4]);
     }
 
     #[test]
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 99231e7253c..5fc3fafac9e 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -55,7 +55,7 @@ use core::default::Default;
 use core::fmt;
 use core::hash::{self, Hash};
 use core::iter::{repeat, FromIterator};
-use core::kinds::marker::{ContravariantLifetime, InvariantType};
+use core::marker::{ContravariantLifetime, InvariantType};
 use core::mem;
 use core::nonzero::NonZero;
 use core::num::{Int, UnsignedInt};
@@ -1178,7 +1178,7 @@ impl<T:Clone> Clone for Vec<T> {
 
         // self.len <= other.len due to the truncate above, so the
         // slice here is always in-bounds.
-        let slice = other[self.len()..];
+        let slice = other.index(&(self.len()..));
         self.push_all(slice);
     }
 }
@@ -1209,48 +1209,66 @@ impl<T> IndexMut<uint> for Vec<T> {
     }
 }
 
-impl<T> ops::Slice<uint, [T]> for Vec<T> {
+
+impl<T> ops::Index<ops::Range<uint>> for Vec<T> {
+    type Output = [T];
     #[inline]
-    fn as_slice_<'a>(&'a self) -> &'a [T] {
-        self.as_slice()
+    fn index(&self, index: &ops::Range<uint>) -> &[T] {
+        self.as_slice().index(index)
     }
-
+}
+impl<T> ops::Index<ops::RangeTo<uint>> for Vec<T> {
+    type Output = [T];
     #[inline]
-    fn slice_from_or_fail<'a>(&'a self, start: &uint) -> &'a [T] {
-        self.as_slice().slice_from_or_fail(start)
+    fn index(&self, index: &ops::RangeTo<uint>) -> &[T] {
+        self.as_slice().index(index)
     }
-
+}
+impl<T> ops::Index<ops::RangeFrom<uint>> for Vec<T> {
+    type Output = [T];
     #[inline]
-    fn slice_to_or_fail<'a>(&'a self, end: &uint) -> &'a [T] {
-        self.as_slice().slice_to_or_fail(end)
+    fn index(&self, index: &ops::RangeFrom<uint>) -> &[T] {
+        self.as_slice().index(index)
     }
+}
+impl<T> ops::Index<ops::FullRange> for Vec<T> {
+    type Output = [T];
     #[inline]
-    fn slice_or_fail<'a>(&'a self, start: &uint, end: &uint) -> &'a [T] {
-        self.as_slice().slice_or_fail(start, end)
+    fn index(&self, _index: &ops::FullRange) -> &[T] {
+        self.as_slice()
     }
 }
 
-impl<T> ops::SliceMut<uint, [T]> for Vec<T> {
+impl<T> ops::IndexMut<ops::Range<uint>> for Vec<T> {
+    type Output = [T];
     #[inline]
-    fn as_mut_slice_<'a>(&'a mut self) -> &'a mut [T] {
-        self.as_mut_slice()
+    fn index_mut(&mut self, index: &ops::Range<uint>) -> &mut [T] {
+        self.as_mut_slice().index_mut(index)
     }
-
+}
+impl<T> ops::IndexMut<ops::RangeTo<uint>> for Vec<T> {
+    type Output = [T];
     #[inline]
-    fn slice_from_or_fail_mut<'a>(&'a mut self, start: &uint) -> &'a mut [T] {
-        self.as_mut_slice().slice_from_or_fail_mut(start)
+    fn index_mut(&mut self, index: &ops::RangeTo<uint>) -> &mut [T] {
+        self.as_mut_slice().index_mut(index)
     }
-
+}
+impl<T> ops::IndexMut<ops::RangeFrom<uint>> for Vec<T> {
+    type Output = [T];
     #[inline]
-    fn slice_to_or_fail_mut<'a>(&'a mut self, end: &uint) -> &'a mut [T] {
-        self.as_mut_slice().slice_to_or_fail_mut(end)
+    fn index_mut(&mut self, index: &ops::RangeFrom<uint>) -> &mut [T] {
+        self.as_mut_slice().index_mut(index)
     }
+}
+impl<T> ops::IndexMut<ops::FullRange> for Vec<T> {
+    type Output = [T];
     #[inline]
-    fn slice_or_fail_mut<'a>(&'a mut self, start: &uint, end: &uint) -> &'a mut [T] {
-        self.as_mut_slice().slice_or_fail_mut(start, end)
+    fn index_mut(&mut self, _index: &ops::FullRange) -> &mut [T] {
+        self.as_mut_slice()
     }
 }
 
+
 #[stable]
 impl<T> ops::Deref for Vec<T> {
     type Target = [T];
@@ -1430,9 +1448,25 @@ impl<T> Default for Vec<T> {
 }
 
 #[experimental = "waiting on Show stability"]
-impl<T:fmt::Show> fmt::Show for Vec<T> {
+impl<T: fmt::Show> fmt::Show for Vec<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Show::fmt(self.as_slice(), f)
+    }
+}
+
+#[cfg(stage0)]
+#[experimental = "waiting on Show stability"]
+impl<T: fmt::Show> fmt::String for Vec<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::String::fmt(self.as_slice(), f)
+    }
+}
+
+#[cfg(not(stage0))]
+#[experimental = "waiting on Show stability"]
+impl<T: fmt::String> fmt::String for Vec<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.as_slice().fmt(f)
+        fmt::String::fmt(self.as_slice(), f)
     }
 }
 
@@ -1781,6 +1815,7 @@ mod tests {
     use prelude::*;
     use core::mem::size_of;
     use core::iter::repeat;
+    use core::ops::FullRange;
     use test::Bencher;
     use super::as_vec;
 
@@ -1918,7 +1953,7 @@ mod tests {
             let (left, right) = values.split_at_mut(2);
             {
                 let left: &[_] = left;
-                assert!(left[0..left.len()] == [1, 2][]);
+                assert!(&left[..left.len()] == &[1, 2][]);
             }
             for p in left.iter_mut() {
                 *p += 1;
@@ -1926,7 +1961,7 @@ mod tests {
 
             {
                 let right: &[_] = right;
-                assert!(right[0..right.len()] == [3, 4, 5][]);
+                assert!(&right[..right.len()] == &[3, 4, 5][]);
             }
             for p in right.iter_mut() {
                 *p += 2;
@@ -2097,35 +2132,35 @@ mod tests {
     #[should_fail]
     fn test_slice_out_of_bounds_1() {
         let x: Vec<int> = vec![1, 2, 3, 4, 5];
-        x[-1..];
+        &x[(-1)..];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_2() {
         let x: Vec<int> = vec![1, 2, 3, 4, 5];
-        x[..6];
+        &x[..6];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_3() {
         let x: Vec<int> = vec![1, 2, 3, 4, 5];
-        x[-1..4];
+        &x[(-1)..4];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_4() {
         let x: Vec<int> = vec![1, 2, 3, 4, 5];
-        x[1..6];
+        &x[1..6];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_5() {
         let x: Vec<int> = vec![1, 2, 3, 4, 5];
-        x[3..2];
+        &x[3..2];
     }
 
     #[test]
@@ -2371,7 +2406,7 @@ mod tests {
         b.bytes = src_len as u64;
 
         b.iter(|| {
-            let dst = src.clone().as_slice().to_vec();
+            let dst = src.clone()[].to_vec();
             assert_eq!(dst.len(), src_len);
             assert!(dst.iter().enumerate().all(|(i, x)| i == *x));
         });
diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs
index cc757b65623..4399a6fec22 100644
--- a/src/libcollections/vec_map.rs
+++ b/src/libcollections/vec_map.rs
@@ -455,7 +455,8 @@ impl<V> VecMap<V> {
         if *key >= self.v.len() {
             return None;
         }
-        self.v[*key].take()
+        let result = &mut self.v[*key];
+        result.take()
     }
 }
 
@@ -488,11 +489,11 @@ impl<V: Ord> Ord for VecMap<V> {
 #[stable]
 impl<V: fmt::Show> fmt::Show for VecMap<V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{{"));
+        try!(write!(f, "VecMap {{"));
 
         for (i, (k, v)) in self.iter().enumerate() {
             if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{}: {}", k, *v));
+            try!(write!(f, "{}: {:?}", k, *v));
         }
 
         write!(f, "}}")
@@ -928,9 +929,9 @@ mod test_map {
         map.insert(1, 2i);
         map.insert(3, 4i);
 
-        let map_str = map.to_string();
-        assert!(map_str == "{1: 2, 3: 4}" || map_str == "{3: 4, 1: 2}");
-        assert_eq!(format!("{}", empty), "{}");
+        let map_str = format!("{:?}", map);
+        assert!(map_str == "VecMap {1: 2i, 3: 4i}" || map_str == "{3: 4i, 1: 2i}");
+        assert_eq!(format!("{:?}", empty), "VecMap {}");
     }
 
     #[test]