]> git.lizzy.rs Git - rust.git/commitdiff
misc collections code cleanup
authorAlexis <a.beingessner@gmail.com>
Thu, 5 Feb 2015 02:17:19 +0000 (21:17 -0500)
committerAlexis <a.beingessner@gmail.com>
Thu, 5 Feb 2015 23:22:03 +0000 (18:22 -0500)
20 files changed:
src/libcollections/bench.rs
src/libcollections/binary_heap.rs
src/libcollections/bit.rs
src/libcollections/btree/map.rs
src/libcollections/btree/node.rs
src/libcollections/btree/set.rs
src/libcollections/dlist.rs
src/libcollections/enum_set.rs
src/libcollections/ring_buf.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcollections/vec.rs
src/libcollections/vec_map.rs
src/librustc/middle/ty.rs
src/libserialize/collection_impls.rs
src/libstd/collections/hash/bench.rs
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/set.rs
src/libstd/collections/hash/table.rs

index c5c19ee56bf0cec2bb9b69894fffa66e1f1aa370..b0a5911720a40aa384c75374604c84b7c0d42967 100644 (file)
 use std::rand::Rng;
 use test::{Bencher, black_box};
 
-pub fn insert_rand_n<M, I, R>(n: uint,
+pub fn insert_rand_n<M, I, R>(n: usize,
                               map: &mut M,
                               b: &mut Bencher,
                               mut insert: I,
                               mut remove: R) where
-    I: FnMut(&mut M, uint),
-    R: FnMut(&mut M, uint),
+    I: FnMut(&mut M, usize),
+    R: FnMut(&mut M, usize),
 {
     // setup
     let mut rng = rand::weak_rng();
 
     for _ in 0..n {
-        insert(map, rng.gen::<uint>() % n);
+        insert(map, rng.gen::<usize>() % n);
     }
 
     // measure
     b.iter(|| {
-        let k = rng.gen::<uint>() % n;
+        let k = rng.gen::<usize>() % n;
         insert(map, k);
         remove(map, k);
     });
     black_box(map);
 }
 
-pub fn insert_seq_n<M, I, R>(n: uint,
+pub fn insert_seq_n<M, I, R>(n: usize,
                              map: &mut M,
                              b: &mut Bencher,
                              mut insert: I,
                              mut remove: R) where
-    I: FnMut(&mut M, uint),
-    R: FnMut(&mut M, uint),
+    I: FnMut(&mut M, usize),
+    R: FnMut(&mut M, usize),
 {
     // setup
-    for i in 0u..n {
+    for i in 0..n {
         insert(map, i * 2);
     }
 
@@ -60,18 +60,17 @@ pub fn insert_seq_n<M, I, R>(n: uint,
     black_box(map);
 }
 
-pub fn find_rand_n<M, T, I, F>(n: uint,
+pub fn find_rand_n<M, T, I, F>(n: usize,
                                map: &mut M,
                                b: &mut Bencher,
                                mut insert: I,
                                mut find: F) where
-    I: FnMut(&mut M, uint),
-    F: FnMut(&M, uint) -> T,
+    I: FnMut(&mut M, usize),
+    F: FnMut(&M, usize) -> T,
 {
     // setup
     let mut rng = rand::weak_rng();
-    let mut keys = (0..n).map(|_| rng.gen::<uint>() % n)
-                              .collect::<Vec<_>>();
+    let mut keys: Vec<_> = (0..n).map(|_| rng.gen::<usize>() % n).collect();
 
     for k in &keys {
         insert(map, *k);
@@ -88,16 +87,16 @@ pub fn find_rand_n<M, T, I, F>(n: uint,
     })
 }
 
-pub fn find_seq_n<M, T, I, F>(n: uint,
+pub fn find_seq_n<M, T, I, F>(n: usize,
                               map: &mut M,
                               b: &mut Bencher,
                               mut insert: I,
                               mut find: F) where
-    I: FnMut(&mut M, uint),
-    F: FnMut(&M, uint) -> T,
+    I: FnMut(&mut M, usize),
+    F: FnMut(&M, usize) -> T,
 {
     // setup
-    for i in 0u..n {
+    for i in 0..n {
         insert(map, i);
     }
 
index b51ec13335e0eb721ef52d8a73f5d90e0ab5cb0b..fe477c3495f81279daf1917e43719feb9156cbfc 100644 (file)
 //! ```
 //! use std::cmp::Ordering;
 //! use std::collections::BinaryHeap;
-//! use std::uint;
+//! use std::usize;
 //!
 //! #[derive(Copy, Eq, PartialEq)]
 //! struct State {
-//!     cost: uint,
-//!     position: uint,
+//!     cost: usize,
+//!     position: usize,
 //! }
 //!
 //! // The priority queue depends on `Ord`.
 //!     }
 //! }
 //!
-//! // Each node is represented as an `uint`, for a shorter implementation.
+//! // Each node is represented as an `usize`, for a shorter implementation.
 //! struct Edge {
-//!     node: uint,
-//!     cost: uint,
+//!     node: usize,
+//!     cost: usize,
 //! }
 //!
 //! // Dijkstra's shortest path algorithm.
 //!
 //! // Start at `start` and use `dist` to track the current shortest distance
 //! // to each node. This implementation isn't memory-efficient as it may leave duplicate
-//! // nodes in the queue. It also uses `uint::MAX` as a sentinel value,
+//! // nodes in the queue. It also uses `usize::MAX` as a sentinel value,
 //! // for a simpler implementation.
-//! fn shortest_path(adj_list: &Vec<Vec<Edge>>, start: uint, goal: uint) -> uint {
+//! fn shortest_path(adj_list: &Vec<Vec<Edge>>, start: usize, goal: usize) -> usize {
 //!     // dist[node] = current shortest distance from `start` to `node`
-//!     let mut dist: Vec<_> = (0..adj_list.len()).map(|_| uint::MAX).collect();
+//!     let mut dist: Vec<_> = (0..adj_list.len()).map(|_| usize::MAX).collect();
 //!
 //!     let mut heap = BinaryHeap::new();
 //!
@@ -98,7 +98,7 @@
 //!     }
 //!
 //!     // Goal not reachable
-//!     uint::MAX
+//!     usize::MAX
 //! }
 //!
 //! fn main() {
 //!     assert_eq!(shortest_path(&graph, 0, 3), 3);
 //!     assert_eq!(shortest_path(&graph, 3, 0), 7);
 //!     assert_eq!(shortest_path(&graph, 0, 4), 5);
-//!     assert_eq!(shortest_path(&graph, 4, 0), uint::MAX);
+//!     assert_eq!(shortest_path(&graph, 4, 0), usize::MAX);
 //! }
 //! ```
 
@@ -201,7 +201,7 @@ pub fn new() -> BinaryHeap<T> { BinaryHeap { data: vec![] } }
     /// heap.push(4u);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(capacity: uint) -> BinaryHeap<T> {
+    pub fn with_capacity(capacity: usize) -> BinaryHeap<T> {
         BinaryHeap { data: Vec::with_capacity(capacity) }
     }
 
@@ -295,7 +295,7 @@ pub fn peek(&self) -> Option<&T> {
     /// heap.push(4u);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint { self.data.capacity() }
+    pub fn capacity(&self) -> usize { self.data.capacity() }
 
     /// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
     /// given `BinaryHeap`. Does nothing if the capacity is already sufficient.
@@ -306,7 +306,7 @@ pub fn capacity(&self) -> uint { self.data.capacity() }
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -318,7 +318,7 @@ pub fn capacity(&self) -> uint { self.data.capacity() }
     /// heap.push(4u);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_exact(&mut self, additional: uint) {
+    pub fn reserve_exact(&mut self, additional: usize) {
         self.data.reserve_exact(additional);
     }
 
@@ -327,7 +327,7 @@ pub fn reserve_exact(&mut self, additional: uint) {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -339,7 +339,7 @@ pub fn reserve_exact(&mut self, additional: uint) {
     /// heap.push(4u);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve(&mut self, additional: uint) {
+    pub fn reserve(&mut self, additional: usize) {
         self.data.reserve(additional);
     }
 
@@ -497,7 +497,7 @@ pub fn into_sorted_vec(mut self) -> Vec<T> {
     // zeroed element), shift along the others and move it back into the
     // vector over the junk element. This reduces the constant factor
     // compared to using swaps, which involves twice as many moves.
-    fn sift_up(&mut self, start: uint, mut pos: uint) {
+    fn sift_up(&mut self, start: usize, mut pos: usize) {
         unsafe {
             let new = replace(&mut self.data[pos], zeroed());
 
@@ -514,7 +514,7 @@ fn sift_up(&mut self, start: uint, mut pos: uint) {
         }
     }
 
-    fn sift_down_range(&mut self, mut pos: uint, end: uint) {
+    fn sift_down_range(&mut self, mut pos: usize, end: usize) {
         unsafe {
             let start = pos;
             let new = replace(&mut self.data[pos], zeroed());
@@ -536,14 +536,14 @@ fn sift_down_range(&mut self, mut pos: uint, end: uint) {
         }
     }
 
-    fn sift_down(&mut self, pos: uint) {
+    fn sift_down(&mut self, pos: usize) {
         let len = self.len();
         self.sift_down_range(pos, len);
     }
 
     /// Returns the length of the binary heap.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { self.data.len() }
+    pub fn len(&self) -> usize { self.data.len() }
 
     /// Checks if the binary heap is empty.
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -584,7 +584,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
     fn next(&mut self) -> Option<&'a T> { self.iter.next() }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -610,7 +610,7 @@ impl<T> Iterator for IntoIter<T> {
     fn next(&mut self) -> Option<T> { self.iter.next() }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -636,7 +636,7 @@ impl<'a, T: 'a> Iterator for Drain<'a, T> {
     fn next(&mut self) -> Option<T> { self.iter.next() }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -692,7 +692,7 @@ mod tests {
 
     #[test]
     fn test_iterator() {
-        let data = vec!(5, 9, 3);
+        let data = vec![5, 9, 3];
         let iterout = [9, 5, 3];
         let heap = BinaryHeap::from_vec(data);
         let mut i = 0;
@@ -704,27 +704,27 @@ fn test_iterator() {
 
     #[test]
     fn test_iterator_reverse() {
-        let data = vec!(5, 9, 3);
-        let iterout = vec!(3, 5, 9);
+        let data = vec![5, 9, 3];
+        let iterout = vec![3, 5, 9];
         let pq = BinaryHeap::from_vec(data);
 
-        let v: Vec<int> = pq.iter().rev().map(|&x| x).collect();
+        let v: Vec<_> = pq.iter().rev().map(|&x| x).collect();
         assert_eq!(v, iterout);
     }
 
     #[test]
     fn test_move_iter() {
-        let data = vec!(5, 9, 3);
-        let iterout = vec!(9, 5, 3);
+        let data = vec![5, 9, 3];
+        let iterout = vec![9, 5, 3];
         let pq = BinaryHeap::from_vec(data);
 
-        let v: Vec<int> = pq.into_iter().collect();
+        let v: Vec<_> = pq.into_iter().collect();
         assert_eq!(v, iterout);
     }
 
     #[test]
     fn test_move_iter_size_hint() {
-        let data = vec!(5, 9);
+        let data = vec![5, 9];
         let pq = BinaryHeap::from_vec(data);
 
         let mut it = pq.into_iter();
@@ -741,17 +741,17 @@ fn test_move_iter_size_hint() {
 
     #[test]
     fn test_move_iter_reverse() {
-        let data = vec!(5, 9, 3);
-        let iterout = vec!(3, 5, 9);
+        let data = vec![5, 9, 3];
+        let iterout = vec![3, 5, 9];
         let pq = BinaryHeap::from_vec(data);
 
-        let v: Vec<int> = pq.into_iter().rev().collect();
+        let v: Vec<_> = pq.into_iter().rev().collect();
         assert_eq!(v, iterout);
     }
 
     #[test]
     fn test_peek_and_pop() {
-        let data = vec!(2u, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1);
+        let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
         let mut sorted = data.clone();
         sorted.sort();
         let mut heap = BinaryHeap::from_vec(data);
@@ -763,7 +763,7 @@ fn test_peek_and_pop() {
 
     #[test]
     fn test_push() {
-        let mut heap = BinaryHeap::from_vec(vec!(2, 4, 9));
+        let mut heap = BinaryHeap::from_vec(vec![2, 4, 9]);
         assert_eq!(heap.len(), 3);
         assert!(*heap.peek().unwrap() == 9);
         heap.push(11);
@@ -785,7 +785,7 @@ fn test_push() {
 
     #[test]
     fn test_push_unique() {
-        let mut heap = BinaryHeap::from_vec(vec!(box 2, box 4, box 9));
+        let mut heap = BinaryHeap::from_vec(vec![box 2, box 4, box 9]);
         assert_eq!(heap.len(), 3);
         assert!(*heap.peek().unwrap() == box 9);
         heap.push(box 11);
@@ -807,7 +807,7 @@ fn test_push_unique() {
 
     #[test]
     fn test_push_pop() {
-        let mut heap = BinaryHeap::from_vec(vec!(5, 5, 2, 1, 3));
+        let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
         assert_eq!(heap.len(), 5);
         assert_eq!(heap.push_pop(6), 6);
         assert_eq!(heap.len(), 5);
@@ -821,7 +821,7 @@ fn test_push_pop() {
 
     #[test]
     fn test_replace() {
-        let mut heap = BinaryHeap::from_vec(vec!(5, 5, 2, 1, 3));
+        let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
         assert_eq!(heap.len(), 5);
         assert_eq!(heap.replace(6).unwrap(), 5);
         assert_eq!(heap.len(), 5);
@@ -833,7 +833,7 @@ fn test_replace() {
         assert_eq!(heap.len(), 5);
     }
 
-    fn check_to_vec(mut data: Vec<int>) {
+    fn check_to_vec(mut data: Vec<i32>) {
         let heap = BinaryHeap::from_vec(data.clone());
         let mut v = heap.clone().into_vec();
         v.sort();
@@ -845,44 +845,44 @@ fn check_to_vec(mut data: Vec<int>) {
 
     #[test]
     fn test_to_vec() {
-        check_to_vec(vec!());
-        check_to_vec(vec!(5));
-        check_to_vec(vec!(3, 2));
-        check_to_vec(vec!(2, 3));
-        check_to_vec(vec!(5, 1, 2));
-        check_to_vec(vec!(1, 100, 2, 3));
-        check_to_vec(vec!(1, 3, 5, 7, 9, 2, 4, 6, 8, 0));
-        check_to_vec(vec!(2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1));
-        check_to_vec(vec!(9, 11, 9, 9, 9, 9, 11, 2, 3, 4, 11, 9, 0, 0, 0, 0));
-        check_to_vec(vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
-        check_to_vec(vec!(10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0));
-        check_to_vec(vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 1, 2));
-        check_to_vec(vec!(5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1));
+        check_to_vec(vec![]);
+        check_to_vec(vec![5]);
+        check_to_vec(vec![3, 2]);
+        check_to_vec(vec![2, 3]);
+        check_to_vec(vec![5, 1, 2]);
+        check_to_vec(vec![1, 100, 2, 3]);
+        check_to_vec(vec![1, 3, 5, 7, 9, 2, 4, 6, 8, 0]);
+        check_to_vec(vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1]);
+        check_to_vec(vec![9, 11, 9, 9, 9, 9, 11, 2, 3, 4, 11, 9, 0, 0, 0, 0]);
+        check_to_vec(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
+        check_to_vec(vec![10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]);
+        check_to_vec(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 1, 2]);
+        check_to_vec(vec![5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1]);
     }
 
     #[test]
     fn test_empty_pop() {
-        let mut heap = BinaryHeap::<int>::new();
+        let mut heap = BinaryHeap::<i32>::new();
         assert!(heap.pop().is_none());
     }
 
     #[test]
     fn test_empty_peek() {
-        let empty = BinaryHeap::<int>::new();
+        let empty = BinaryHeap::<i32>::new();
         assert!(empty.peek().is_none());
     }
 
     #[test]
     fn test_empty_replace() {
-        let mut heap = BinaryHeap::<int>::new();
+        let mut heap = BinaryHeap::new();
         assert!(heap.replace(5).is_none());
     }
 
     #[test]
     fn test_from_iter() {
-        let xs = vec!(9u, 8, 7, 6, 5, 4, 3, 2, 1);
+        let xs = vec![9, 8, 7, 6, 5, 4, 3, 2, 1];
 
-        let mut q: BinaryHeap<uint> = xs.iter().rev().map(|&x| x).collect();
+        let mut q: BinaryHeap<_> = xs.iter().rev().cloned().collect();
 
         for &x in &xs {
             assert_eq!(q.pop().unwrap(), x);
@@ -891,8 +891,7 @@ fn test_from_iter() {
 
     #[test]
     fn test_drain() {
-        let mut q: BinaryHeap<_> =
-            [9u, 8, 7, 6, 5, 4, 3, 2, 1].iter().cloned().collect();
+        let mut q: BinaryHeap<_> = [9, 8, 7, 6, 5, 4, 3, 2, 1].iter().cloned().collect();
 
         assert_eq!(q.drain().take(5).count(), 5);
 
index c9b3f72526f8c5c0d2c09770f7887cb8fa712d91..2728e08d6158c5c75f97208d7bb490f5b6a3205b 100644 (file)
@@ -18,7 +18,7 @@
 // rather `or` and `and`.
 
 // (1) Be careful, most things can overflow here because the amount of bits in
-//     memory can overflow `uint`.
+//     memory can overflow `usize`.
 // (2) Make sure that the underlying vector has no excess length:
 //     E. g. `nbits == 16`, `storage.len() == 2` would be excess length,
 //     because the last word isn't used at all. This is important because some
@@ -54,7 +54,7 @@
 //!     bv.set(0, false);
 //!     bv.set(1, false);
 //!
-//!     for i in iter::range_inclusive(2, (max_prime as f64).sqrt() as uint) {
+//!     for i in iter::range_inclusive(2, (max_prime as f64).sqrt() as usize) {
 //!         // if i is a prime
 //!         if bv[i] {
 //!             // Mark all multiples of i as non-prime (any multiples below i * i
@@ -66,7 +66,7 @@
 //! };
 //!
 //! // Simple primality tests below our max bound
-//! let print_primes = 20u;
+//! let print_primes = 20;
 //! print!("The primes below {} are: ", print_primes);
 //! for x in 0..print_primes {
 //!     if primes.contains(&x) {
@@ -93,7 +93,7 @@
 use core::num::Int;
 use core::ops::Index;
 use core::slice;
-use core::{u8, u32, uint};
+use core::{u8, u32, usize};
 use bitv_set; //so meta
 
 use Vec;
@@ -162,15 +162,15 @@ pub struct Bitv {
     /// Internal representation of the bit vector
     storage: Vec<u32>,
     /// The number of valid bits in the internal representation
-    nbits: uint
+    nbits: usize
 }
 
 // FIXME(Gankro): NopeNopeNopeNopeNope (wait for IndexGet to be a thing)
-impl Index<uint> for Bitv {
+impl Index<usize> for Bitv {
     type Output = bool;
 
     #[inline]
-    fn index(&self, i: &uint) -> &bool {
+    fn index(&self, i: &usize) -> &bool {
         if self.get(*i).expect("index out of bounds") {
             &TRUE
         } else {
@@ -180,7 +180,7 @@ fn index(&self, i: &uint) -> &bool {
 }
 
 /// Computes how many blocks are needed to store that many bits
-fn blocks_for_bits(bits: uint) -> uint {
+fn blocks_for_bits(bits: usize) -> usize {
     // If we want 17 bits, dividing by 32 will produce 0. So we add 1 to make sure we
     // reserve enough. But if we want exactly a multiple of 32, this will actually allocate
     // one too many. So we need to check if that's the case. We can do that by computing if
@@ -188,7 +188,7 @@ fn blocks_for_bits(bits: uint) -> uint {
     // superior modulo operator on a power of two to this.
     //
     // Note that we can technically avoid this branch with the expression
-    // `(nbits + u32::BITS - 1) / 32::BITS`, but if nbits is almost uint::MAX this will overflow.
+    // `(nbits + u32::BITS - 1) / 32::BITS`, but if nbits is almost usize::MAX this will overflow.
     if bits % u32::BITS == 0 {
         bits / u32::BITS
     } else {
@@ -197,7 +197,7 @@ fn blocks_for_bits(bits: uint) -> uint {
 }
 
 /// Computes the bitmask for the final word of the vector
-fn mask_for_bits(bits: uint) -> u32 {
+fn mask_for_bits(bits: usize) -> u32 {
     // Note especially that a perfect multiple of u32::BITS should mask all 1s.
     !0u32 >> (u32::BITS - bits % u32::BITS) % u32::BITS
 }
@@ -272,7 +272,7 @@ pub fn new() -> Bitv {
     ///     assert_eq!(x, false);
     /// }
     /// ```
-    pub fn from_elem(nbits: uint, bit: bool) -> Bitv {
+    pub fn from_elem(nbits: usize, bit: bool) -> Bitv {
         let nblocks = blocks_for_bits(nbits);
         let mut bitv = Bitv {
             storage: repeat(if bit { !0u32 } else { 0u32 }).take(nblocks).collect(),
@@ -290,7 +290,7 @@ pub fn from_elem(nbits: uint, bit: bool) -> Bitv {
     /// It is important to note that this function does not specify the
     /// *length* of the returned bitvector, but only the *capacity*.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(nbits: uint) -> Bitv {
+    pub fn with_capacity(nbits: usize) -> Bitv {
         Bitv {
             storage: Vec::with_capacity(blocks_for_bits(nbits)),
             nbits: 0,
@@ -351,7 +351,7 @@ pub fn from_bytes(bytes: &[u8]) -> Bitv {
     /// let bv = Bitv::from_fn(5, |i| { i % 2 == 0 });
     /// assert!(bv.eq_vec(&[true, false, true, false, true]));
     /// ```
-    pub fn from_fn<F>(len: uint, mut f: F) -> Bitv where F: FnMut(uint) -> bool {
+    pub fn from_fn<F>(len: usize, mut f: F) -> Bitv where F: FnMut(usize) -> bool {
         let mut bitv = Bitv::from_elem(len, false);
         for i in 0u..len {
             bitv.set(i, f(i));
@@ -376,7 +376,7 @@ pub fn from_fn<F>(len: uint, mut f: F) -> Bitv where F: FnMut(uint) -> bool {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn get(&self, i: uint) -> Option<bool> {
+    pub fn get(&self, i: usize) -> Option<bool> {
         if i >= self.nbits {
             return None;
         }
@@ -405,7 +405,7 @@ pub fn get(&self, i: uint) -> Option<bool> {
     #[inline]
     #[unstable(feature = "collections",
                reason = "panic semantics are likely to change in the future")]
-    pub fn set(&mut self, i: uint, x: bool) {
+    pub fn set(&mut self, i: usize, x: bool) {
         assert!(i < self.nbits);
         let w = i / u32::BITS;
         let b = i % u32::BITS;
@@ -649,7 +649,7 @@ pub fn any(&self) -> bool {
     /// assert_eq!(bv.to_bytes(), vec!(0b00100000, 0b10000000));
     /// ```
     pub fn to_bytes(&self) -> Vec<u8> {
-        fn bit(bitv: &Bitv, byte: uint, bit: uint) -> u8 {
+        fn bit(bitv: &Bitv, byte: usize, bit: usize) -> u8 {
             let offset = byte * 8 + bit;
             if offset >= bitv.nbits {
                 0
@@ -709,7 +709,7 @@ pub fn eq_vec(&self, v: &[bool]) -> bool {
     /// assert!(bv.eq_vec(&[false, true]));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn truncate(&mut self, len: uint) {
+    pub fn truncate(&mut self, len: usize) {
         if len < self.len() {
             self.nbits = len;
             // This fixes (2).
@@ -723,7 +723,7 @@ pub fn truncate(&mut self, len: uint) {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -736,7 +736,7 @@ pub fn truncate(&mut self, len: uint) {
     /// assert!(bv.capacity() >= 13);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve(&mut self, additional: uint) {
+    pub fn reserve(&mut self, additional: usize) {
         let desired_cap = self.len().checked_add(additional).expect("capacity overflow");
         let storage_len = self.storage.len();
         if desired_cap > self.capacity() {
@@ -753,7 +753,7 @@ pub fn reserve(&mut self, additional: uint) {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -766,7 +766,7 @@ pub fn reserve(&mut self, additional: uint) {
     /// assert!(bv.capacity() >= 13);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_exact(&mut self, additional: uint) {
+    pub fn reserve_exact(&mut self, additional: usize) {
         let desired_cap = self.len().checked_add(additional).expect("capacity overflow");
         let storage_len = self.storage.len();
         if desired_cap > self.capacity() {
@@ -788,15 +788,15 @@ pub fn reserve_exact(&mut self, additional: uint) {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint {
-        self.storage.capacity().checked_mul(u32::BITS).unwrap_or(uint::MAX)
+    pub fn capacity(&self) -> usize {
+        self.storage.capacity().checked_mul(u32::BITS).unwrap_or(usize::MAX)
     }
 
     /// Grows the `Bitv` in-place, adding `n` copies of `value` to the `Bitv`.
     ///
     /// # Panics
     ///
-    /// Panics if the new len overflows a `uint`.
+    /// Panics if the new len overflows a `usize`.
     ///
     /// # Examples
     ///
@@ -808,7 +808,7 @@ pub fn capacity(&self) -> uint {
     /// assert_eq!(bv.len(), 10);
     /// assert_eq!(bv.to_bytes(), vec!(0b01001011, 0b11000000));
     /// ```
-    pub fn grow(&mut self, n: uint, value: bool) {
+    pub fn grow(&mut self, n: usize, value: bool) {
         // Note: we just bulk set all the bits in the last word in this fn in multiple places
         // which is technically wrong if not all of these bits are to be used. However, at the end
         // of this fn we call `fix_last_block` at the end of this fn, which should fix this.
@@ -901,7 +901,7 @@ pub fn push(&mut self, elem: bool) {
     /// Return the total number of bits in this vector
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { self.nbits }
+    pub fn len(&self) -> usize { self.nbits }
 
     /// Returns true if there are no bits in this vector
     #[inline]
@@ -1012,8 +1012,8 @@ impl cmp::Eq for Bitv {}
 #[derive(Clone)]
 pub struct Iter<'a> {
     bitv: &'a Bitv,
-    next_idx: uint,
-    end_idx: uint,
+    next_idx: usize,
+    end_idx: usize,
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -1031,7 +1031,7 @@ fn next(&mut self) -> Option<bool> {
         }
     }
 
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let rem = self.end_idx - self.next_idx;
         (rem, Some(rem))
     }
@@ -1056,12 +1056,12 @@ impl<'a> ExactSizeIterator for Iter<'a> {}
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> RandomAccessIterator for Iter<'a> {
     #[inline]
-    fn indexable(&self) -> uint {
+    fn indexable(&self) -> usize {
         self.end_idx - self.next_idx
     }
 
     #[inline]
-    fn idx(&mut self, index: uint) -> Option<bool> {
+    fn idx(&mut self, index: usize) -> Option<bool> {
         if index >= self.indexable() {
             None
         } else {
@@ -1083,7 +1083,7 @@ fn into_iter(self) -> Iter<'a> {
 ///
 /// It should also be noted that the amount of storage necessary for holding a
 /// set of objects is proportional to the maximum of the objects when viewed
-/// as a `uint`.
+/// as a `usize`.
 ///
 /// # Examples
 ///
@@ -1130,8 +1130,8 @@ fn default() -> BitvSet { BitvSet::new() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl FromIterator<uint> for BitvSet {
-    fn from_iter<I:Iterator<Item=uint>>(iterator: I) -> BitvSet {
+impl FromIterator<usize> for BitvSet {
+    fn from_iter<I:Iterator<Item=usize>>(iterator: I) -> BitvSet {
         let mut ret = BitvSet::new();
         ret.extend(iterator);
         ret
@@ -1139,9 +1139,9 @@ fn from_iter<I:Iterator<Item=uint>>(iterator: I) -> BitvSet {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl Extend<uint> for BitvSet {
+impl Extend<usize> for BitvSet {
     #[inline]
-    fn extend<I: Iterator<Item=uint>>(&mut self, iterator: I) {
+    fn extend<I: Iterator<Item=usize>>(&mut self, iterator: I) {
         for i in iterator {
             self.insert(i);
         }
@@ -1207,7 +1207,7 @@ pub fn new() -> BitvSet {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(nbits: uint) -> BitvSet {
+    pub fn with_capacity(nbits: usize) -> BitvSet {
         let bitv = Bitv::from_elem(nbits, false);
         BitvSet::from_bitv(bitv)
     }
@@ -1245,7 +1245,7 @@ pub fn from_bitv(bitv: Bitv) -> BitvSet {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self.bitv.capacity()
     }
 
@@ -1266,7 +1266,7 @@ pub fn capacity(&self) -> uint {
     /// assert!(s.capacity() >= 10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_len(&mut self, len: uint) {
+    pub fn reserve_len(&mut self, len: usize) {
         let cur_len = self.bitv.len();
         if len >= cur_len {
             self.bitv.reserve(len - cur_len);
@@ -1292,7 +1292,7 @@ pub fn reserve_len(&mut self, len: uint) {
     /// assert!(s.capacity() >= 10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_len_exact(&mut self, len: uint) {
+    pub fn reserve_len_exact(&mut self, len: usize) {
         let cur_len = self.bitv.len();
         if len >= cur_len {
             self.bitv.reserve_exact(len - cur_len);
@@ -1448,7 +1448,7 @@ fn or(w1: u32, w2: u32) -> u32 { w1 | w2 }
         })
     }
 
-    /// Iterator over each uint stored in `self` intersect `other`.
+    /// Iterator over each usize stored in `self` intersect `other`.
     /// See [intersect_with](#method.intersect_with) for an efficient in-place version.
     ///
     /// # Examples
@@ -1478,7 +1478,7 @@ fn bitand(w1: u32, w2: u32) -> u32 { w1 & w2 }
         }.take(min))
     }
 
-    /// Iterator over each uint stored in the `self` setminus `other`.
+    /// Iterator over each usize stored in the `self` setminus `other`.
     /// See [difference_with](#method.difference_with) for an efficient in-place version.
     ///
     /// # Examples
@@ -1651,7 +1651,7 @@ pub fn symmetric_difference_with(&mut self, other: &BitvSet) {
     /// Return the number of set bits in this set.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint  {
+    pub fn len(&self) -> usize  {
         self.bitv.blocks().fold(0, |acc, n| acc + n.count_ones())
     }
 
@@ -1672,7 +1672,7 @@ pub fn clear(&mut self) {
     /// Returns `true` if this set contains the specified integer.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn contains(&self, value: &uint) -> bool {
+    pub fn contains(&self, value: &usize) -> bool {
         let bitv = &self.bitv;
         *value < bitv.nbits && bitv[*value]
     }
@@ -1709,7 +1709,7 @@ pub fn is_superset(&self, other: &BitvSet) -> bool {
     /// Adds a value to the set. Returns `true` if the value was not already
     /// present in the set.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn insert(&mut self, value: uint) -> bool {
+    pub fn insert(&mut self, value: usize) -> bool {
         if self.contains(&value) {
             return false;
         }
@@ -1727,7 +1727,7 @@ pub fn insert(&mut self, value: uint) -> bool {
     /// Removes a value from the set. Returns `true` if the value was
     /// present in the set.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn remove(&mut self, value: &uint) -> bool {
+    pub fn remove(&mut self, value: &usize) -> bool {
         if !self.contains(value) {
             return false;
         }
@@ -1767,7 +1767,7 @@ fn hash(&self, state: &mut S) {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct SetIter<'a> {
     set: &'a BitvSet,
-    next_idx: uint
+    next_idx: usize
 }
 
 /// An iterator combining two `BitvSet` iterators.
@@ -1777,7 +1777,7 @@ struct TwoBitPositions<'a> {
     other: &'a BitvSet,
     merge: fn(u32, u32) -> u32,
     current_word: u32,
-    next_idx: uint
+    next_idx: usize
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -1791,9 +1791,9 @@ struct TwoBitPositions<'a> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for SetIter<'a> {
-    type Item = uint;
+    type Item = usize;
 
-    fn next(&mut self) -> Option<uint> {
+    fn next(&mut self) -> Option<usize> {
         while self.next_idx < self.set.bitv.len() {
             let idx = self.next_idx;
             self.next_idx += 1;
@@ -1807,16 +1807,16 @@ fn next(&mut self) -> Option<uint> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         (0, Some(self.set.bitv.len() - self.next_idx))
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for TwoBitPositions<'a> {
-    type Item = uint;
+    type Item = usize;
 
-    fn next(&mut self) -> Option<uint> {
+    fn next(&mut self) -> Option<usize> {
         while self.next_idx < self.set.bitv.len() ||
               self.next_idx < self.other.bitv.len() {
             let bit_idx = self.next_idx % u32::BITS;
@@ -1844,7 +1844,7 @@ fn next(&mut self) -> Option<uint> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let cap = cmp::max(self.set.bitv.len(), self.other.bitv.len());
         (0, Some(cap - self.next_idx))
     }
@@ -1852,34 +1852,34 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for Union<'a> {
-    type Item = uint;
+    type Item = usize;
 
-    #[inline] fn next(&mut self) -> Option<uint> { self.0.next() }
-    #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
+    #[inline] fn next(&mut self) -> Option<usize> { self.0.next() }
+    #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.0.size_hint() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for Intersection<'a> {
-    type Item = uint;
+    type Item = usize;
 
-    #[inline] fn next(&mut self) -> Option<uint> { self.0.next() }
-    #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
+    #[inline] fn next(&mut self) -> Option<usize> { self.0.next() }
+    #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.0.size_hint() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for Difference<'a> {
-    type Item = uint;
+    type Item = usize;
 
-    #[inline] fn next(&mut self) -> Option<uint> { self.0.next() }
-    #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
+    #[inline] fn next(&mut self) -> Option<usize> { self.0.next() }
+    #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.0.size_hint() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for SymmetricDifference<'a> {
-    type Item = uint;
+    type Item = usize;
 
-    #[inline] fn next(&mut self) -> Option<uint> { self.0.next() }
-    #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
+    #[inline] fn next(&mut self) -> Option<usize> { self.0.next() }
+    #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.0.size_hint() }
 }
 
 impl<'a> IntoIterator for &'a BitvSet {
@@ -2288,7 +2288,7 @@ fn test_from_bools() {
 
     #[test]
     fn test_to_bools() {
-        let bools = vec!(false, false, true, false, false, true, true, false);
+        let bools = vec![false, false, true, false, false, true, true, false];
         assert_eq!(Bitv::from_bytes(&[0b00100110]).iter().collect::<Vec<bool>>(), bools);
     }
 
@@ -2299,7 +2299,7 @@ fn test_bitv_iterator() {
 
         assert_eq!(bitv.iter().collect::<Vec<bool>>(), bools);
 
-        let long = (0i32..10000).map(|i| i % 2 == 0).collect::<Vec<_>>();
+        let long: Vec<_> = (0i32..10000).map(|i| i % 2 == 0).collect();
         let bitv: Bitv = long.iter().map(|n| *n).collect();
         assert_eq!(bitv.iter().collect::<Vec<bool>>(), long)
     }
@@ -2530,7 +2530,7 @@ mod bitv_bench {
 
     use super::Bitv;
 
-    static BENCH_BITS : uint = 1 << 14;
+    static BENCH_BITS : usize = 1 << 14;
 
     fn rng() -> rand::IsaacRng {
         let seed: &[_] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
@@ -2538,12 +2538,12 @@ fn rng() -> rand::IsaacRng {
     }
 
     #[bench]
-    fn bench_uint_small(b: &mut Bencher) {
+    fn bench_usize_small(b: &mut Bencher) {
         let mut r = rng();
-        let mut bitv = 0 as uint;
+        let mut bitv = 0 as usize;
         b.iter(|| {
             for _ in 0u..100 {
-                bitv |= 1 << ((r.next_u32() as uint) % u32::BITS);
+                bitv |= 1 << ((r.next_u32() as usize) % u32::BITS);
             }
             black_box(&bitv);
         });
@@ -2555,7 +2555,7 @@ fn bench_bitv_set_big_fixed(b: &mut Bencher) {
         let mut bitv = Bitv::from_elem(BENCH_BITS, false);
         b.iter(|| {
             for _ in 0u..100 {
-                bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
+                bitv.set((r.next_u32() as usize) % BENCH_BITS, true);
             }
             black_box(&bitv);
         });
@@ -2567,7 +2567,7 @@ fn bench_bitv_set_big_variable(b: &mut Bencher) {
         let mut bitv = Bitv::from_elem(BENCH_BITS, false);
         b.iter(|| {
             for _ in 0u..100 {
-                bitv.set((r.next_u32() as uint) % BENCH_BITS, r.gen());
+                bitv.set((r.next_u32() as usize) % BENCH_BITS, r.gen());
             }
             black_box(&bitv);
         });
@@ -2579,7 +2579,7 @@ fn bench_bitv_set_small(b: &mut Bencher) {
         let mut bitv = Bitv::from_elem(u32::BITS, false);
         b.iter(|| {
             for _ in 0u..100 {
-                bitv.set((r.next_u32() as uint) % u32::BITS, true);
+                bitv.set((r.next_u32() as usize) % u32::BITS, true);
             }
             black_box(&bitv);
         });
@@ -2601,7 +2601,7 @@ fn bench_bitv_small_iter(b: &mut Bencher) {
             let mut sum = 0u;
             for _ in 0u..10 {
                 for pres in &bitv {
-                    sum += pres as uint;
+                    sum += pres as usize;
                 }
             }
             sum
@@ -2614,7 +2614,7 @@ fn bench_bitv_big_iter(b: &mut Bencher) {
         b.iter(|| {
             let mut sum = 0u;
             for pres in &bitv {
-                sum += pres as uint;
+                sum += pres as usize;
             }
             sum
         })
@@ -2645,9 +2645,9 @@ fn test_bitv_set_show() {
     }
 
     #[test]
-    fn test_bitv_set_from_uints() {
-        let uints = vec![0, 2, 2, 3];
-        let a: BitvSet = uints.into_iter().collect();
+    fn test_bitv_set_from_usizes() {
+        let usizes = vec![0, 2, 2, 3];
+        let a: BitvSet = usizes.into_iter().collect();
         let mut b = BitvSet::new();
         b.insert(0);
         b.insert(2);
@@ -2657,16 +2657,16 @@ fn test_bitv_set_from_uints() {
 
     #[test]
     fn test_bitv_set_iterator() {
-        let uints = vec![0, 2, 2, 3];
-        let bitv: BitvSet = uints.into_iter().collect();
+        let usizes = vec![0, 2, 2, 3];
+        let bitv: BitvSet = usizes.into_iter().collect();
 
-        let idxs: Vec<uint> = bitv.iter().collect();
+        let idxs: Vec<_> = bitv.iter().collect();
         assert_eq!(idxs, vec![0, 2, 3]);
 
         let long: BitvSet = (0u..10000).filter(|&n| n % 2 == 0).collect();
-        let real = range_step(0, 10000, 2).collect::<Vec<uint>>();
+        let real: Vec<_> = range_step(0, 10000, 2).collect();
 
-        let idxs: Vec<uint> = long.iter().collect();
+        let idxs: Vec<_> = long.iter().collect();
         assert_eq!(idxs, real);
     }
 
@@ -2731,7 +2731,7 @@ fn test_bitv_set_intersection() {
         assert!(b.insert(3));
 
         let expected = [3, 5, 11, 77];
-        let actual = a.intersection(&b).collect::<Vec<uint>>();
+        let actual: Vec<_> = a.intersection(&b).collect();
         assert_eq!(actual, expected);
     }
 
@@ -2750,7 +2750,7 @@ fn test_bitv_set_difference() {
         assert!(b.insert(200));
 
         let expected = [1, 5, 500];
-        let actual = a.difference(&b).collect::<Vec<uint>>();
+        let actual: Vec<_> = a.difference(&b).collect();
         assert_eq!(actual, expected);
     }
 
@@ -2771,7 +2771,7 @@ fn test_bitv_set_symmetric_difference() {
         assert!(b.insert(220));
 
         let expected = [1, 5, 11, 14, 220];
-        let actual = a.symmetric_difference(&b).collect::<Vec<uint>>();
+        let actual: Vec<_> = a.symmetric_difference(&b).collect();
         assert_eq!(actual, expected);
     }
 
@@ -2796,7 +2796,7 @@ fn test_bitv_set_union() {
         assert!(b.insert(19));
 
         let expected = [1, 3, 5, 9, 11, 13, 19, 24, 160, 200];
-        let actual = a.union(&b).collect::<Vec<uint>>();
+        let actual: Vec<_> = a.union(&b).collect();
         assert_eq!(actual, expected);
     }
 
@@ -3025,7 +3025,7 @@ mod bitv_set_bench {
 
     use super::{Bitv, BitvSet};
 
-    static BENCH_BITS : uint = 1 << 14;
+    static BENCH_BITS : usize = 1 << 14;
 
     fn rng() -> rand::IsaacRng {
         let seed: &[_] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
@@ -3037,8 +3037,8 @@ fn bench_bitvset_small(b: &mut Bencher) {
         let mut r = rng();
         let mut bitv = BitvSet::new();
         b.iter(|| {
-            for _ in 0u..100 {
-                bitv.insert((r.next_u32() as uint) % u32::BITS);
+            for _ in 0..100 {
+                bitv.insert((r.next_u32() as usize) % u32::BITS);
             }
             black_box(&bitv);
         });
@@ -3049,8 +3049,8 @@ fn bench_bitvset_big(b: &mut Bencher) {
         let mut r = rng();
         let mut bitv = BitvSet::new();
         b.iter(|| {
-            for _ in 0u..100 {
-                bitv.insert((r.next_u32() as uint) % BENCH_BITS);
+            for _ in 0..100 {
+                bitv.insert((r.next_u32() as usize) % BENCH_BITS);
             }
             black_box(&bitv);
         });
@@ -3061,9 +3061,9 @@ fn bench_bitvset_iter(b: &mut Bencher) {
         let bitv = BitvSet::from_bitv(Bitv::from_fn(BENCH_BITS,
                                               |idx| {idx % 3 == 0}));
         b.iter(|| {
-            let mut sum = 0u;
+            let mut sum = 0;
             for idx in &bitv {
-                sum += idx as uint;
+                sum += idx as usize;
             }
             sum
         })
index 99ee5957913dc5659e21c07f7bfb9c703d4c8886..d792bd8d1522d304e95c08d31d46e6e5a87d0b0b 100644 (file)
 /// would like to further explore choosing the optimal search strategy based on the choice of B,
 /// and possibly other factors. Using linear search, searching for a random element is expected
 /// to take O(B log<sub>B</sub>n) comparisons, which is generally worse than a BST. In practice,
-/// however, performance is excellent. `BTreeMap` is able to readily outperform `TreeMap` under
-/// many workloads, and is competitive where it doesn't. BTreeMap also generally *scales* better
-/// than TreeMap, making it more appropriate for large datasets.
-///
-/// However, `TreeMap` may still be more appropriate to use in many contexts. If elements are very
-/// large or expensive to compare, `TreeMap` may be more appropriate. It won't allocate any
-/// more space than is needed, and will perform the minimal number of comparisons necessary.
-/// `TreeMap` also provides much better performance stability guarantees. Generally, very few
-/// changes need to be made to update a BST, and two updates are expected to take about the same
-/// amount of time on roughly equal sized BSTs. However a B-Tree's performance is much more
-/// amortized. If a node is overfull, it must be split into two nodes. If a node is underfull, it
-/// may be merged with another. Both of these operations are relatively expensive to perform, and
-/// it's possible to force one to occur at every single level of the tree in a single insertion or
-/// deletion. In fact, a malicious or otherwise unlucky sequence of insertions and deletions can
-/// force this degenerate behaviour to occur on every operation. While the total amount of work
-/// done on each operation isn't *catastrophic*, and *is* still bounded by O(B log<sub>B</sub>n),
-/// it is certainly much slower when it does.
+/// however, performance is excellent.
 #[derive(Clone)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct BTreeMap<K, V> {
     root: Node<K, V>,
-    length: uint,
-    depth: uint,
-    b: uint,
+    length: usize,
+    depth: usize,
+    b: usize,
 }
 
 /// An abstract base over-which all other BTree iterators are built.
 struct AbsIter<T> {
     traversals: RingBuf<T>,
-    size: uint,
+    size: usize,
 }
 
 /// An iterator over a BTreeMap's entries.
@@ -171,7 +155,7 @@ pub fn new() -> BTreeMap<K, V> {
     /// Makes a new empty BTreeMap with the given B.
     ///
     /// B cannot be less than 2.
-    pub fn with_b(b: uint) -> BTreeMap<K, V> {
+    pub fn with_b(b: usize) -> BTreeMap<K, V> {
         assert!(b > 1, "B must be greater than 1");
         BTreeMap {
             length: 0,
@@ -1001,7 +985,7 @@ fn next(&mut self) -> Option<(K, V)> {
         }
     }
 
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         (self.size, Some(self.size))
     }
 }
@@ -1038,7 +1022,7 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
     type Item = (&'a K, &'a V);
 
     fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> {
@@ -1052,7 +1036,7 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
     type Item = (&'a K, &'a mut V);
 
     fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> {
@@ -1066,7 +1050,7 @@ impl<K, V> Iterator for IntoIter<K, V> {
     type Item = (K, V);
 
     fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<K, V> DoubleEndedIterator for IntoIter<K, V> {
@@ -1080,7 +1064,7 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
     type Item = &'a K;
 
     fn next(&mut self) -> Option<(&'a K)> { self.inner.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> {
@@ -1095,7 +1079,7 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
     type Item = &'a V;
 
     fn next(&mut self) -> Option<(&'a V)> { self.inner.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
@@ -1289,7 +1273,7 @@ pub fn into_iter(self) -> IntoIter<K, V> {
     /// a.insert(1u, "a");
     /// a.insert(2u, "b");
     ///
-    /// let keys: Vec<uint> = a.keys().cloned().collect();
+    /// let keys: Vec<usize> = a.keys().cloned().collect();
     /// assert_eq!(keys, vec![1u,2,]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -1335,7 +1319,7 @@ fn second<A, B>((_, b): (A, B)) -> B { b }
     /// assert_eq!(a.len(), 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { self.length }
+    pub fn len(&self) -> usize { self.length }
 
     /// Return true if the map contains no elements.
     ///
@@ -1546,7 +1530,7 @@ pub fn range_mut<'a>(&'a mut self, min: Bound<&K>, max: Bound<&K>) -> RangeMut<'
     /// use std::collections::BTreeMap;
     /// use std::collections::btree_map::Entry;
     ///
-    /// let mut count: BTreeMap<&str, uint> = BTreeMap::new();
+    /// let mut count: BTreeMap<&str, usize> = BTreeMap::new();
     ///
     /// // count the number of occurrences of letters in the vec
     /// for x in vec!["a","b","a","c","a","b"].iter() {
@@ -1622,7 +1606,7 @@ mod test {
     #[test]
     fn test_basic_large() {
         let mut map = BTreeMap::new();
-        let size = 10000u;
+        let size = 10000;
         assert_eq!(map.len(), 0);
 
         for i in 0..size {
@@ -1669,7 +1653,7 @@ fn test_basic_small() {
         let mut map = BTreeMap::new();
         assert_eq!(map.remove(&1), None);
         assert_eq!(map.get(&1), None);
-        assert_eq!(map.insert(1u, 1u), None);
+        assert_eq!(map.insert(1, 1), None);
         assert_eq!(map.get(&1), Some(&1));
         assert_eq!(map.insert(1, 2), Some(1));
         assert_eq!(map.get(&1), Some(&2));
@@ -1682,12 +1666,12 @@ fn test_basic_small() {
 
     #[test]
     fn test_iter() {
-        let size = 10000u;
+        let size = 10000;
 
         // Forwards
-        let mut map: BTreeMap<uint, uint> = (0..size).map(|i| (i, i)).collect();
+        let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
-        fn test<T>(size: uint, mut iter: T) where T: Iterator<Item=(uint, uint)> {
+        fn test<T>(size: usize, mut iter: T) where T: Iterator<Item=(usize, usize)> {
             for i in 0..size {
                 assert_eq!(iter.size_hint(), (size - i, Some(size - i)));
                 assert_eq!(iter.next().unwrap(), (i, i));
@@ -1702,12 +1686,12 @@ fn test<T>(size: uint, mut iter: T) where T: Iterator<Item=(uint, uint)> {
 
     #[test]
     fn test_iter_rev() {
-        let size = 10000u;
+        let size = 10000;
 
         // Forwards
-        let mut map: BTreeMap<uint, uint> = (0..size).map(|i| (i, i)).collect();
+        let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
-        fn test<T>(size: uint, mut iter: T) where T: Iterator<Item=(uint, uint)> {
+        fn test<T>(size: usize, mut iter: T) where T: Iterator<Item=(usize, usize)> {
             for i in 0..size {
                 assert_eq!(iter.size_hint(), (size - i, Some(size - i)));
                 assert_eq!(iter.next().unwrap(), (size - i - 1, size - i - 1));
@@ -1722,13 +1706,13 @@ fn test<T>(size: uint, mut iter: T) where T: Iterator<Item=(uint, uint)> {
 
     #[test]
     fn test_iter_mixed() {
-        let size = 10000u;
+        let size = 10000;
 
         // Forwards
-        let mut map: BTreeMap<uint, uint> = (0..size).map(|i| (i, i)).collect();
+        let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
-        fn test<T>(size: uint, mut iter: T)
-                where T: Iterator<Item=(uint, uint)> + DoubleEndedIterator {
+        fn test<T>(size: usize, mut iter: T)
+                where T: Iterator<Item=(usize, usize)> + DoubleEndedIterator {
             for i in 0..size / 4 {
                 assert_eq!(iter.size_hint(), (size - i * 2, Some(size - i * 2)));
                 assert_eq!(iter.next().unwrap(), (i, i));
@@ -1748,13 +1732,13 @@ fn test<T>(size: uint, mut iter: T)
 
     #[test]
     fn test_range_small() {
-        let size = 5u;
+        let size = 5;
 
         // Forwards
-        let map: BTreeMap<uint, uint> = (0..size).map(|i| (i, i)).collect();
+        let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
-        let mut j = 0u;
-        for ((&k, &v), i) in map.range(Included(&2), Unbounded).zip(2u..size) {
+        let mut j = 0;
+        for ((&k, &v), i) in map.range(Included(&2), Unbounded).zip(2..size) {
             assert_eq!(k, i);
             assert_eq!(v, i);
             j += 1;
@@ -1764,10 +1748,10 @@ fn test_range_small() {
 
     #[test]
     fn test_range_1000() {
-        let size = 1000u;
-        let map: BTreeMap<uint, uint> = (0..size).map(|i| (i, i)).collect();
+        let size = 1000;
+        let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
-        fn test(map: &BTreeMap<uint, uint>, size: uint, min: Bound<&uint>, max: Bound<&uint>) {
+        fn test(map: &BTreeMap<u32, u32>, size: u32, min: Bound<&u32>, max: Bound<&u32>) {
             let mut kvs = map.range(min, max).map(|(&k, &v)| (k, v));
             let mut pairs = (0..size).map(|i| (i, i));
 
@@ -1787,8 +1771,8 @@ fn test(map: &BTreeMap<uint, uint>, size: uint, min: Bound<&uint>, max: Bound<&u
 
     #[test]
     fn test_range() {
-        let size = 200u;
-        let map: BTreeMap<uint, uint> = (0..size).map(|i| (i, i)).collect();
+        let size = 200;
+        let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
         for i in 0..size {
             for j in i..size {
@@ -1808,7 +1792,7 @@ fn test_range() {
     fn test_entry(){
         let xs = [(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)];
 
-        let mut map: BTreeMap<int, int> = xs.iter().map(|&x| x).collect();
+        let mut map: BTreeMap<_, _> = xs.iter().map(|&x| x).collect();
 
         // Existing key (insert)
         match map.entry(1) {
@@ -1872,7 +1856,7 @@ mod bench {
 
     #[bench]
     pub fn insert_rand_100(b: &mut Bencher) {
-        let mut m : BTreeMap<uint,uint> = BTreeMap::new();
+        let mut m = BTreeMap::new();
         insert_rand_n(100, &mut m, b,
                       |m, i| { m.insert(i, 1); },
                       |m, i| { m.remove(&i); });
@@ -1880,7 +1864,7 @@ pub fn insert_rand_100(b: &mut Bencher) {
 
     #[bench]
     pub fn insert_rand_10_000(b: &mut Bencher) {
-        let mut m : BTreeMap<uint,uint> = BTreeMap::new();
+        let mut m = BTreeMap::new();
         insert_rand_n(10_000, &mut m, b,
                       |m, i| { m.insert(i, 1); },
                       |m, i| { m.remove(&i); });
@@ -1889,7 +1873,7 @@ pub fn insert_rand_10_000(b: &mut Bencher) {
     // Insert seq
     #[bench]
     pub fn insert_seq_100(b: &mut Bencher) {
-        let mut m : BTreeMap<uint,uint> = BTreeMap::new();
+        let mut m = BTreeMap::new();
         insert_seq_n(100, &mut m, b,
                      |m, i| { m.insert(i, 1); },
                      |m, i| { m.remove(&i); });
@@ -1897,7 +1881,7 @@ pub fn insert_seq_100(b: &mut Bencher) {
 
     #[bench]
     pub fn insert_seq_10_000(b: &mut Bencher) {
-        let mut m : BTreeMap<uint,uint> = BTreeMap::new();
+        let mut m = BTreeMap::new();
         insert_seq_n(10_000, &mut m, b,
                      |m, i| { m.insert(i, 1); },
                      |m, i| { m.remove(&i); });
@@ -1906,7 +1890,7 @@ pub fn insert_seq_10_000(b: &mut Bencher) {
     // Find rand
     #[bench]
     pub fn find_rand_100(b: &mut Bencher) {
-        let mut m : BTreeMap<uint,uint> = BTreeMap::new();
+        let mut m = BTreeMap::new();
         find_rand_n(100, &mut m, b,
                     |m, i| { m.insert(i, 1); },
                     |m, i| { m.get(&i); });
@@ -1914,7 +1898,7 @@ pub fn find_rand_100(b: &mut Bencher) {
 
     #[bench]
     pub fn find_rand_10_000(b: &mut Bencher) {
-        let mut m : BTreeMap<uint,uint> = BTreeMap::new();
+        let mut m = BTreeMap::new();
         find_rand_n(10_000, &mut m, b,
                     |m, i| { m.insert(i, 1); },
                     |m, i| { m.get(&i); });
@@ -1923,7 +1907,7 @@ pub fn find_rand_10_000(b: &mut Bencher) {
     // Find seq
     #[bench]
     pub fn find_seq_100(b: &mut Bencher) {
-        let mut m : BTreeMap<uint,uint> = BTreeMap::new();
+        let mut m = BTreeMap::new();
         find_seq_n(100, &mut m, b,
                    |m, i| { m.insert(i, 1); },
                    |m, i| { m.get(&i); });
@@ -1931,14 +1915,14 @@ pub fn find_seq_100(b: &mut Bencher) {
 
     #[bench]
     pub fn find_seq_10_000(b: &mut Bencher) {
-        let mut m : BTreeMap<uint,uint> = BTreeMap::new();
+        let mut m = BTreeMap::new();
         find_seq_n(10_000, &mut m, b,
                    |m, i| { m.insert(i, 1); },
                    |m, i| { m.get(&i); });
     }
 
-    fn bench_iter(b: &mut Bencher, size: uint) {
-        let mut map = BTreeMap::<uint, uint>::new();
+    fn bench_iter(b: &mut Bencher, size: i32) {
+        let mut map = BTreeMap::<i32, i32>::new();
         let mut rng = weak_rng();
 
         for _ in 0..size {
index 8fdfe9ed56a4882014fdcce5f8e1dea865bbbaa1..429c62c857116970aab064df277cfeb90bcab6b0 100644 (file)
@@ -65,7 +65,7 @@ pub struct Node<K, V> {
     //
     // Note: instead of accessing this field directly, please call the `len()` method, which should
     // be more stable in the face of representation changes.
-    _len: uint,
+    _len: usize,
 
     // FIXME(gereeter) It shouldn't be necessary to store the capacity in every node, as it should
     // be constant throughout the tree. Once a solution to this is found, it might be possible to
@@ -74,7 +74,7 @@ pub struct Node<K, V> {
     //
     // Note: instead of accessing this field directly, please call the `capacity()` method, which
     // should be more stable in the face of representation changes.
-    _capacity: uint,
+    _capacity: usize,
 }
 
 struct NodeSlice<'a, K: 'a, V: 'a> {
@@ -102,7 +102,7 @@ struct MutNodeSlice<'a, K: 'a, V: 'a> {
 ///
 /// Fails if `target_alignment` is not a power of two.
 #[inline]
-fn round_up_to_next(unrounded: uint, target_alignment: uint) -> uint {
+fn round_up_to_next(unrounded: usize, target_alignment: usize) -> usize {
     assert!(num::UnsignedInt::is_power_of_two(target_alignment));
     (unrounded + target_alignment - 1) & !(target_alignment - 1)
 }
@@ -120,10 +120,10 @@ fn test_rounding() {
 // Returns a tuple of (val_offset, edge_offset),
 // from the start of a mallocated array.
 #[inline]
-fn calculate_offsets(keys_size: uint,
-                     vals_size: uint, vals_align: uint,
-                     edges_align: uint)
-                     -> (uint, uint) {
+fn calculate_offsets(keys_size: usize,
+                     vals_size: usize, vals_align: usize,
+                     edges_align: usize)
+                     -> (usize, usize) {
     let vals_offset = round_up_to_next(keys_size, vals_align);
     let end_of_vals = vals_offset + vals_size;
 
@@ -135,10 +135,10 @@ fn calculate_offsets(keys_size: uint,
 // Returns a tuple of (minimum required alignment, array_size),
 // from the start of a mallocated array.
 #[inline]
-fn calculate_allocation(keys_size: uint, keys_align: uint,
-                        vals_size: uint, vals_align: uint,
-                        edges_size: uint, edges_align: uint)
-                        -> (uint, uint) {
+fn calculate_allocation(keys_size: usize, keys_align: usize,
+                        vals_size: usize, vals_align: usize,
+                        edges_size: usize, edges_align: usize)
+                        -> (usize, usize) {
     let (_, edges_offset) = calculate_offsets(keys_size,
                                               vals_size, vals_align,
                                                          edges_align);
@@ -159,7 +159,7 @@ fn test_offset_calculation() {
     assert_eq!(calculate_offsets(6, 12, 4, 8), (8, 24));
 }
 
-fn calculate_allocation_generic<K, V>(capacity: uint, is_leaf: bool) -> (uint, uint) {
+fn calculate_allocation_generic<K, V>(capacity: usize, is_leaf: bool) -> (usize, usize) {
     let (keys_size, keys_align) = (capacity * mem::size_of::<K>(), mem::min_align_of::<K>());
     let (vals_size, vals_align) = (capacity * mem::size_of::<V>(), mem::min_align_of::<V>());
     let (edges_size, edges_align) = if is_leaf {
@@ -175,7 +175,7 @@ fn calculate_allocation_generic<K, V>(capacity: uint, is_leaf: bool) -> (uint, u
     )
 }
 
-fn calculate_offsets_generic<K, V>(capacity: uint, is_leaf: bool) -> (uint, uint) {
+fn calculate_offsets_generic<K, V>(capacity: usize, is_leaf: bool) -> (usize, usize) {
     let keys_size = capacity * mem::size_of::<K>();
     let vals_size = capacity * mem::size_of::<V>();
     let vals_align = mem::min_align_of::<V>();
@@ -203,16 +203,16 @@ unsafe fn from_slice(slice: &[T]) -> RawItems<T> {
         RawItems::from_parts(slice.as_ptr(), slice.len())
     }
 
-    unsafe fn from_parts(ptr: *const T, len: uint) -> RawItems<T> {
+    unsafe fn from_parts(ptr: *const T, len: usize) -> RawItems<T> {
         if mem::size_of::<T>() == 0 {
             RawItems {
                 head: ptr,
-                tail: (ptr as uint + len) as *const T,
+                tail: (ptr as usize + len) as *const T,
             }
         } else {
             RawItems {
                 head: ptr,
-                tail: ptr.offset(len as int),
+                tail: ptr.offset(len as isize),
             }
         }
     }
@@ -221,7 +221,7 @@ unsafe fn push(&mut self, val: T) {
         ptr::write(self.tail as *mut T, val);
 
         if mem::size_of::<T>() == 0 {
-            self.tail = (self.tail as uint + 1) as *const T;
+            self.tail = (self.tail as usize + 1) as *const T;
         } else {
             self.tail = self.tail.offset(1);
         }
@@ -239,7 +239,7 @@ fn next(&mut self) -> Option<T> {
                 let ret = Some(ptr::read(self.head));
 
                 if mem::size_of::<T>() == 0 {
-                    self.head = (self.head as uint + 1) as *const T;
+                    self.head = (self.head as usize + 1) as *const T;
                 } else {
                     self.head = self.head.offset(1);
                 }
@@ -257,7 +257,7 @@ fn next_back(&mut self) -> Option<T> {
         } else {
             unsafe {
                 if mem::size_of::<T>() == 0 {
-                    self.tail = (self.tail as uint - 1) as *const T;
+                    self.tail = (self.tail as usize - 1) as *const T;
                 } else {
                     self.tail = self.tail.offset(-1);
                 }
@@ -299,7 +299,7 @@ fn drop(&mut self) {
 impl<K, V> Node<K, V> {
     /// Make a new internal node. The caller must initialize the result to fix the invariant that
     /// there are `len() + 1` edges.
-    unsafe fn new_internal(capacity: uint) -> Node<K, V> {
+    unsafe fn new_internal(capacity: usize) -> Node<K, V> {
         let (alignment, size) = calculate_allocation_generic::<K, V>(capacity, false);
 
         let buffer = heap::allocate(size, alignment);
@@ -309,15 +309,15 @@ unsafe fn new_internal(capacity: uint) -> Node<K, V> {
 
         Node {
             keys: Unique(buffer as *mut K),
-            vals: Unique(buffer.offset(vals_offset as int) as *mut V),
-            edges: Unique(buffer.offset(edges_offset as int) as *mut Node<K, V>),
+            vals: Unique(buffer.offset(vals_offset as isize) as *mut V),
+            edges: Unique(buffer.offset(edges_offset as isize) as *mut Node<K, V>),
             _len: 0,
             _capacity: capacity,
         }
     }
 
     /// Make a new leaf node
-    fn new_leaf(capacity: uint) -> Node<K, V> {
+    fn new_leaf(capacity: usize) -> Node<K, V> {
         let (alignment, size) = calculate_allocation_generic::<K, V>(capacity, true);
 
         let buffer = unsafe { heap::allocate(size, alignment) };
@@ -327,7 +327,7 @@ fn new_leaf(capacity: uint) -> Node<K, V> {
 
         Node {
             keys: Unique(buffer as *mut K),
-            vals: Unique(unsafe { buffer.offset(vals_offset as int) as *mut V }),
+            vals: Unique(unsafe { buffer.offset(vals_offset as isize) as *mut V }),
             edges: Unique(ptr::null_mut()),
             _len: 0,
             _capacity: capacity,
@@ -479,15 +479,15 @@ fn clone(&self) -> Node<K, V> {
 ///
 /// ```rust,ignore
 /// struct Nasty<'a> {
-///     first: &'a Node<uint, uint>,
-///     second: &'a Node<uint, uint>,
+///     first: &'a Node<usize, usize>,
+///     second: &'a Node<usize, usize>,
 ///     flag: &'a Cell<bool>,
 /// }
 ///
 /// impl<'a> Deref for Nasty<'a> {
-///     type Target = Node<uint, uint>;
+///     type Target = Node<usize, usize>;
 ///
-///     fn deref(&self) -> &Node<uint, uint> {
+///     fn deref(&self) -> &Node<usize, usize> {
 ///         if self.flag.get() {
 ///             &*self.second
 ///         } else {
@@ -524,7 +524,7 @@ fn clone(&self) -> Node<K, V> {
 #[derive(Copy)]
 pub struct Handle<NodeRef, Type, NodeType> {
     node: NodeRef,
-    index: uint
+    index: usize
 }
 
 pub mod handle {
@@ -546,7 +546,7 @@ pub fn search<Q: ?Sized, NodeRef: Deref<Target=Node<K, V>>>(node: NodeRef, key:
                   -> SearchResult<NodeRef> where Q: BorrowFrom<K> + Ord {
         // FIXME(Gankro): Tune when to search linear or binary based on B (and maybe K/V).
         // For the B configured as of this writing (B = 6), binary search was *significantly*
-        // worse for uints.
+        // worse for usizes.
         match node.as_slices_internal().search_linear(key) {
             (index, true) => Found(Handle { node: node, index: index }),
             (index, false) => GoDown(Handle { node: node, index: index }),
@@ -557,12 +557,12 @@ pub fn search<Q: ?Sized, NodeRef: Deref<Target=Node<K, V>>>(node: NodeRef, key:
 // Public interface
 impl <K, V> Node<K, V> {
     /// Make a leaf root from scratch
-    pub fn make_leaf_root(b: uint) -> Node<K, V> {
+    pub fn make_leaf_root(b: usize) -> Node<K, V> {
         Node::new_leaf(capacity_from_b(b))
     }
 
     /// Make an internal root and swap it with an old root
-    pub fn make_internal_root(left_and_out: &mut Node<K,V>, b: uint, key: K, value: V,
+    pub fn make_internal_root(left_and_out: &mut Node<K,V>, b: usize, key: K, value: V,
             right: Node<K,V>) {
         let node = mem::replace(left_and_out, unsafe { Node::new_internal(capacity_from_b(b)) });
         left_and_out._len = 1;
@@ -575,12 +575,12 @@ pub fn make_internal_root(left_and_out: &mut Node<K,V>, b: uint, key: K, value:
     }
 
     /// How many key-value pairs the node contains
-    pub fn len(&self) -> uint {
+    pub fn len(&self) -> usize {
         self._len
     }
 
     /// How many key-value pairs the node can fit
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self._capacity
     }
 
@@ -1038,7 +1038,7 @@ impl<K, V> Node<K, V> {
     /// # Panics (in debug build)
     ///
     /// Panics if the given index is out of bounds.
-    pub fn kv_handle(&mut self, index: uint) -> Handle<&mut Node<K, V>, handle::KV,
+    pub fn kv_handle(&mut self, index: usize) -> Handle<&mut Node<K, V>, handle::KV,
                                                        handle::LeafOrInternal> {
         // Necessary for correctness, but in a private module
         debug_assert!(index < self.len(), "kv_handle index out of bounds");
@@ -1114,15 +1114,15 @@ unsafe fn push_edge(&mut self, edge: Node<K, V>) {
 
     // This must be followed by insert_edge on an internal node.
     #[inline]
-    unsafe fn insert_kv(&mut self, index: uint, key: K, val: V) -> &mut V {
+    unsafe fn insert_kv(&mut self, index: usize, key: K, val: V) -> &mut V {
         ptr::copy_memory(
-            self.keys_mut().as_mut_ptr().offset(index as int + 1),
-            self.keys().as_ptr().offset(index as int),
+            self.keys_mut().as_mut_ptr().offset(index as isize + 1),
+            self.keys().as_ptr().offset(index as isize),
             self.len() - index
         );
         ptr::copy_memory(
-            self.vals_mut().as_mut_ptr().offset(index as int + 1),
-            self.vals().as_ptr().offset(index as int),
+            self.vals_mut().as_mut_ptr().offset(index as isize + 1),
+            self.vals().as_ptr().offset(index as isize),
             self.len() - index
         );
 
@@ -1136,10 +1136,10 @@ unsafe fn insert_kv(&mut self, index: uint, key: K, val: V) -> &mut V {
 
     // This can only be called immediately after a call to insert_kv.
     #[inline]
-    unsafe fn insert_edge(&mut self, index: uint, edge: Node<K, V>) {
+    unsafe fn insert_edge(&mut self, index: usize, edge: Node<K, V>) {
         ptr::copy_memory(
-            self.edges_mut().as_mut_ptr().offset(index as int + 1),
-            self.edges().as_ptr().offset(index as int),
+            self.edges_mut().as_mut_ptr().offset(index as isize + 1),
+            self.edges().as_ptr().offset(index as isize),
             self.len() - index
         );
         ptr::write(self.edges_mut().get_unchecked_mut(index), edge);
@@ -1166,18 +1166,18 @@ unsafe fn pop_edge(&mut self) -> 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) {
+    unsafe fn remove_kv(&mut self, index: usize) -> (K, V) {
         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),
-            self.keys().as_ptr().offset(index as int + 1),
+            self.keys_mut().as_mut_ptr().offset(index as isize),
+            self.keys().as_ptr().offset(index as isize + 1),
             self.len() - index - 1
         );
         ptr::copy_memory(
-            self.vals_mut().as_mut_ptr().offset(index as int),
-            self.vals().as_ptr().offset(index as int + 1),
+            self.vals_mut().as_mut_ptr().offset(index as isize),
+            self.vals().as_ptr().offset(index as isize + 1),
             self.len() - index - 1
         );
 
@@ -1188,12 +1188,12 @@ unsafe fn remove_kv(&mut self, index: uint) -> (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> {
+    unsafe fn remove_edge(&mut self, index: usize) -> Node<K, V> {
         let edge = ptr::read(self.edges().get_unchecked(index));
 
         ptr::copy_memory(
-            self.edges_mut().as_mut_ptr().offset(index as int),
-            self.edges().as_ptr().offset(index as int + 1),
+            self.edges_mut().as_mut_ptr().offset(index as isize),
+            self.edges().as_ptr().offset(index as isize + 1),
             self.len() - index + 1
         );
 
@@ -1220,18 +1220,18 @@ fn split(&mut self) -> (K, V, Node<K, V>) {
             let right_offset = self.len() - right.len();
             ptr::copy_nonoverlapping_memory(
                 right.keys_mut().as_mut_ptr(),
-                self.keys().as_ptr().offset(right_offset as int),
+                self.keys().as_ptr().offset(right_offset as isize),
                 right.len()
             );
             ptr::copy_nonoverlapping_memory(
                 right.vals_mut().as_mut_ptr(),
-                self.vals().as_ptr().offset(right_offset as int),
+                self.vals().as_ptr().offset(right_offset as isize),
                 right.len()
             );
             if !self.is_leaf() {
                 ptr::copy_nonoverlapping_memory(
                     right.edges_mut().as_mut_ptr(),
-                    self.edges().as_ptr().offset(right_offset as int),
+                    self.edges().as_ptr().offset(right_offset as isize),
                     right.len() + 1
                 );
             }
@@ -1260,18 +1260,18 @@ fn absorb(&mut self, key: K, val: V, mut right: Node<K, V>) {
             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),
+                self.keys_mut().as_mut_ptr().offset(old_len as isize + 1),
                 right.keys().as_ptr(),
                 right.len()
             );
             ptr::copy_nonoverlapping_memory(
-                self.vals_mut().as_mut_ptr().offset(old_len as int + 1),
+                self.vals_mut().as_mut_ptr().offset(old_len as isize + 1),
                 right.vals().as_ptr(),
                 right.len()
             );
             if !self.is_leaf() {
                 ptr::copy_nonoverlapping_memory(
-                    self.edges_mut().as_mut_ptr().offset(old_len as int + 1),
+                    self.edges_mut().as_mut_ptr().offset(old_len as isize + 1),
                     right.edges().as_ptr(),
                     right.len() + 1
                 );
@@ -1284,12 +1284,12 @@ fn absorb(&mut self, key: K, val: V, mut right: Node<K, V>) {
 }
 
 /// Get the capacity of a node from the order of the parent B-Tree
-fn capacity_from_b(b: uint) -> uint {
+fn capacity_from_b(b: usize) -> usize {
     2 * b - 1
 }
 
 /// Get the minimum load of a node from its capacity
-fn min_load_from_capacity(cap: uint) -> uint {
+fn min_load_from_capacity(cap: usize) -> usize {
     // B - 1
     cap / 2
 }
@@ -1334,7 +1334,7 @@ struct MoveTraversalImpl<K, V> {
 
     // For deallocation when we are done iterating.
     ptr: *mut u8,
-    capacity: uint,
+    capacity: usize,
     is_leaf: bool
 }
 
@@ -1490,7 +1490,7 @@ macro_rules! node_slice_impl {
      $as_slices_internal:ident, $index:ident, $iter:ident) => {
         impl<'a, K: Ord + 'a, V: 'a> $NodeSlice<'a, K, V> {
             /// Performs linear search in a slice. Returns a tuple of (index, is_exact_match).
-            fn search_linear<Q: ?Sized>(&self, key: &Q) -> (uint, bool)
+            fn search_linear<Q: ?Sized>(&self, key: &Q) -> (usize, bool)
                     where Q: BorrowFrom<K> + Ord {
                 for (i, k) in self.keys.iter().enumerate() {
                     match key.cmp(BorrowFrom::borrow_from(k)) {
index 1997fe189be44d21baed70551e5bfb7f9ba14764..b02c522f86da92471eeda0c049a58f71df16b867 100644 (file)
@@ -101,7 +101,7 @@ pub fn new() -> BTreeSet<T> {
     /// B cannot be less than 2.
     #[unstable(feature = "collections",
                reason = "probably want this to be on the type, eventually")]
-    pub fn with_b(b: uint) -> BTreeSet<T> {
+    pub fn with_b(b: usize) -> BTreeSet<T> {
         BTreeSet { map: BTreeMap::with_b(b) }
     }
 }
@@ -114,13 +114,13 @@ impl<T> BTreeSet<T> {
     /// ```
     /// use std::collections::BTreeSet;
     ///
-    /// let set: BTreeSet<uint> = [1u, 2, 3, 4].iter().map(|&x| x).collect();
+    /// let set: BTreeSet<usize> = [1u, 2, 3, 4].iter().map(|&x| x).collect();
     ///
     /// for x in set.iter() {
     ///     println!("{}", x);
     /// }
     ///
-    /// let v: Vec<uint> = set.iter().map(|&x| x).collect();
+    /// let v: Vec<usize> = set.iter().map(|&x| x).collect();
     /// assert_eq!(v, vec![1u,2,3,4]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -135,9 +135,9 @@ pub fn iter(&self) -> Iter<T> {
     /// ```
     /// use std::collections::BTreeSet;
     ///
-    /// let set: BTreeSet<uint> = [1u, 2, 3, 4].iter().map(|&x| x).collect();
+    /// let set: BTreeSet<usize> = [1u, 2, 3, 4].iter().map(|&x| x).collect();
     ///
-    /// let v: Vec<uint> = set.into_iter().collect();
+    /// let v: Vec<usize> = set.into_iter().collect();
     /// assert_eq!(v, vec![1u,2,3,4]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -196,7 +196,7 @@ impl<T: Ord> BTreeSet<T> {
     /// b.insert(2u);
     /// b.insert(3u);
     ///
-    /// let diff: Vec<uint> = a.difference(&b).cloned().collect();
+    /// let diff: Vec<usize> = a.difference(&b).cloned().collect();
     /// assert_eq!(diff, vec![1u]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -219,7 +219,7 @@ pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Difference<'a, T> {
     /// b.insert(2u);
     /// b.insert(3u);
     ///
-    /// let sym_diff: Vec<uint> = a.symmetric_difference(&b).cloned().collect();
+    /// let sym_diff: Vec<usize> = a.symmetric_difference(&b).cloned().collect();
     /// assert_eq!(sym_diff, vec![1u,3]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -243,7 +243,7 @@ pub fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T>)
     /// b.insert(2u);
     /// b.insert(3u);
     ///
-    /// let intersection: Vec<uint> = a.intersection(&b).cloned().collect();
+    /// let intersection: Vec<usize> = a.intersection(&b).cloned().collect();
     /// assert_eq!(intersection, vec![2u]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -265,7 +265,7 @@ pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T>)
     /// let mut b = BTreeSet::new();
     /// b.insert(2u);
     ///
-    /// let union: Vec<uint> = a.union(&b).cloned().collect();
+    /// let union: Vec<usize> = a.union(&b).cloned().collect();
     /// assert_eq!(union, vec![1u,2]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -286,7 +286,7 @@ pub fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> Union<'a, T> {
     /// assert_eq!(v.len(), 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { self.map.len() }
+    pub fn len(&self) -> usize { self.map.len() }
 
     /// Returns true if the set contains no elements
     ///
@@ -625,7 +625,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
     type Item = &'a T;
 
     fn next(&mut self) -> Option<&'a T> { self.iter.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
@@ -640,7 +640,7 @@ impl<T> Iterator for IntoIter<T> {
     type Item = T;
 
     fn next(&mut self) -> Option<T> { self.iter.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> DoubleEndedIterator for IntoIter<T> {
@@ -770,23 +770,23 @@ fn test_hash() {
     }
 
     struct Counter<'a, 'b> {
-        i: &'a mut uint,
-        expected: &'b [int],
+        i: &'a mut usize,
+        expected: &'b [i32],
     }
 
-    impl<'a, 'b, 'c> FnMut<(&'c int,)> for Counter<'a, 'b> {
+    impl<'a, 'b, 'c> FnMut<(&'c i32,)> for Counter<'a, 'b> {
         type Output = bool;
 
-        extern "rust-call" fn call_mut(&mut self, (&x,): (&'c int,)) -> bool {
+        extern "rust-call" fn call_mut(&mut self, (&x,): (&'c i32,)) -> bool {
             assert_eq!(x, self.expected[*self.i]);
             *self.i += 1;
             true
         }
     }
 
-    fn check<F>(a: &[int], b: &[int], expected: &[int], f: F) where
+    fn check<F>(a: &[i32], b: &[i32], expected: &[i32], f: F) where
         // FIXME Replace Counter with `Box<FnMut(_) -> _>`
-        F: FnOnce(&BTreeSet<int>, &BTreeSet<int>, Counter) -> bool,
+        F: FnOnce(&BTreeSet<i32>, &BTreeSet<i32>, Counter) -> bool,
     {
         let mut set_a = BTreeSet::new();
         let mut set_b = BTreeSet::new();
@@ -801,7 +801,7 @@ fn check<F>(a: &[int], b: &[int], expected: &[int], f: F) where
 
     #[test]
     fn test_intersection() {
-        fn check_intersection(a: &[int], b: &[int], expected: &[int]) {
+        fn check_intersection(a: &[i32], b: &[i32], expected: &[i32]) {
             check(a, b, expected, |x, y, f| x.intersection(y).all(f))
         }
 
@@ -817,7 +817,7 @@ fn check_intersection(a: &[int], b: &[int], expected: &[int]) {
 
     #[test]
     fn test_difference() {
-        fn check_difference(a: &[int], b: &[int], expected: &[int]) {
+        fn check_difference(a: &[i32], b: &[i32], expected: &[i32]) {
             check(a, b, expected, |x, y, f| x.difference(y).all(f))
         }
 
@@ -834,8 +834,7 @@ fn check_difference(a: &[int], b: &[int], expected: &[int]) {
 
     #[test]
     fn test_symmetric_difference() {
-        fn check_symmetric_difference(a: &[int], b: &[int],
-                                      expected: &[int]) {
+        fn check_symmetric_difference(a: &[i32], b: &[i32], expected: &[i32]) {
             check(a, b, expected, |x, y, f| x.symmetric_difference(y).all(f))
         }
 
@@ -849,8 +848,7 @@ fn check_symmetric_difference(a: &[int], b: &[int],
 
     #[test]
     fn test_union() {
-        fn check_union(a: &[int], b: &[int],
-                                      expected: &[int]) {
+        fn check_union(a: &[i32], b: &[i32], expected: &[i32]) {
             check(a, b, expected, |x, y, f| x.union(y).all(f))
         }
 
@@ -865,9 +863,9 @@ fn check_union(a: &[int], b: &[int],
     #[test]
     fn test_zip() {
         let mut x = BTreeSet::new();
-        x.insert(5u);
-        x.insert(12u);
-        x.insert(11u);
+        x.insert(5);
+        x.insert(12);
+        x.insert(11);
 
         let mut y = BTreeSet::new();
         y.insert("foo");
@@ -878,13 +876,13 @@ fn test_zip() {
         let mut z = x.iter().zip(y.iter());
 
         // FIXME: #5801: this needs a type hint to compile...
-        let result: Option<(&uint, & &'static str)> = z.next();
-        assert_eq!(result.unwrap(), (&5u, &("bar")));
+        let result: Option<(&usize, & &'static str)> = z.next();
+        assert_eq!(result.unwrap(), (&5, &("bar")));
 
-        let result: Option<(&uint, & &'static str)> = z.next();
-        assert_eq!(result.unwrap(), (&11u, &("foo")));
+        let result: Option<(&usize, & &'static str)> = z.next();
+        assert_eq!(result.unwrap(), (&11, &("foo")));
 
-        let result: Option<(&uint, & &'static str)> = z.next();
+        let result: Option<(&usize, & &'static str)> = z.next();
         assert!(result.is_none());
     }
 
index d93e61b91f20026a7c2a3a8fd8abf074d9bc7ba4..748230c5d24cf9765a1dc9ba12fe5c0b64c0ab92 100644 (file)
@@ -35,7 +35,7 @@
 /// A doubly-linked list.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct DList<T> {
-    length: uint,
+    length: usize,
     list_head: Link<T>,
     list_tail: Rawlink<Node<T>>,
 }
@@ -61,7 +61,7 @@ struct Node<T> {
 pub struct Iter<'a, T:'a> {
     head: &'a Link<T>,
     tail: Rawlink<Node<T>>,
-    nelem: uint,
+    nelem: usize,
 }
 
 // FIXME #19839: deriving is too aggressive on the bounds (T doesn't need to be Clone).
@@ -82,7 +82,7 @@ pub struct IterMut<'a, T:'a> {
     list: &'a mut DList<T>,
     head: Rawlink<Node<T>>,
     tail: Rawlink<Node<T>>,
-    nelem: uint,
+    nelem: usize,
 }
 
 /// An iterator over mutable references to the items of a `DList`.
@@ -345,7 +345,7 @@ pub fn is_empty(&self) -> bool {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint {
+    pub fn len(&self) -> usize {
         self.length
     }
 
@@ -578,7 +578,7 @@ pub fn pop_back(&mut self) -> Option<T> {
     /// assert_eq!(splitted.pop_front(), None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn split_off(&mut self, at: uint) -> DList<T> {
+    pub fn split_off(&mut self, at: usize) -> DList<T> {
         let len = self.len();
         assert!(at < len, "Cannot split off at a nonexistent index");
         if at == 0 {
@@ -659,7 +659,7 @@ fn next(&mut self) -> Option<&'a A> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         (self.nelem, Some(self.nelem))
     }
 }
@@ -701,7 +701,7 @@ fn next(&mut self) -> Option<&'a mut A> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         (self.nelem, Some(self.nelem))
     }
 }
@@ -810,7 +810,7 @@ impl<A> Iterator for IntoIter<A> {
     fn next(&mut self) -> Option<A> { self.list.pop_front() }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         (self.list.length, Some(self.list.length))
     }
 }
@@ -935,11 +935,11 @@ mod tests {
     use super::{DList, Node};
 
     pub fn check_links<T>(list: &DList<T>) {
-        let mut len = 0u;
+        let mut len = 0;
         let mut last_ptr: Option<&Node<T>> = None;
         let mut node_ptr: &Node<T>;
         match list.list_head {
-            None => { assert_eq!(0u, list.length); return }
+            None => { assert_eq!(0, list.length); return }
             Some(ref node) => node_ptr = &**node,
         }
         loop {
@@ -968,7 +968,7 @@ pub fn check_links<T>(list: &DList<T>) {
 
     #[test]
     fn test_basic() {
-        let mut m: DList<Box<int>> = DList::new();
+        let mut m = DList::new();
         assert_eq!(m.pop_front(), None);
         assert_eq!(m.pop_back(), None);
         assert_eq!(m.pop_front(), None);
@@ -1007,7 +1007,7 @@ fn test_basic() {
     }
 
     #[cfg(test)]
-    fn generate_test() -> DList<int> {
+    fn generate_test() -> DList<i32> {
         list_from(&[0,1,2,3,4,5,6])
     }
 
@@ -1020,7 +1020,7 @@ fn list_from<T: Clone>(v: &[T]) -> DList<T> {
     fn test_append() {
         // Empty to empty
         {
-            let mut m: DList<int> = DList::new();
+            let mut m = DList::<i32>::new();
             let mut n = DList::new();
             m.append(&mut n);
             check_links(&m);
@@ -1122,7 +1122,7 @@ fn test_split_off() {
     fn test_iterator() {
         let m = generate_test();
         for (i, elt) in m.iter().enumerate() {
-            assert_eq!(i as int, *elt);
+            assert_eq!(i as i32, *elt);
         }
         let mut n = DList::new();
         assert_eq!(n.iter().next(), None);
@@ -1170,7 +1170,7 @@ fn test_iterator_double_end() {
     fn test_rev_iter() {
         let m = generate_test();
         for (i, elt) in m.iter().rev().enumerate() {
-            assert_eq!((6 - i) as int, *elt);
+            assert_eq!((6 - i) as i32, *elt);
         }
         let mut n = DList::new();
         assert_eq!(n.iter().rev().next(), None);
@@ -1187,7 +1187,7 @@ fn test_mut_iter() {
         let mut m = generate_test();
         let mut len = m.len();
         for (i, elt) in m.iter_mut().enumerate() {
-            assert_eq!(i as int, *elt);
+            assert_eq!(i as i32, *elt);
             len -= 1;
         }
         assert_eq!(len, 0);
@@ -1245,14 +1245,14 @@ fn test_insert_prev() {
         }
         check_links(&m);
         assert_eq!(m.len(), 3 + len * 2);
-        assert_eq!(m.into_iter().collect::<Vec<int>>(), vec![-2,0,1,2,3,4,5,6,7,8,9,0,1]);
+        assert_eq!(m.into_iter().collect::<Vec<_>>(), vec![-2,0,1,2,3,4,5,6,7,8,9,0,1]);
     }
 
     #[test]
     fn test_mut_rev_iter() {
         let mut m = generate_test();
         for (i, elt) in m.iter_mut().rev().enumerate() {
-            assert_eq!((6-i) as int, *elt);
+            assert_eq!((6 - i) as i32, *elt);
         }
         let mut n = DList::new();
         assert!(n.iter_mut().rev().next().is_none());
@@ -1268,13 +1268,13 @@ fn test_send() {
         Thread::scoped(move || {
             check_links(&n);
             let a: &[_] = &[&1,&2,&3];
-            assert_eq!(a, n.iter().collect::<Vec<&int>>());
+            assert_eq!(a, n.iter().collect::<Vec<_>>());
         }).join().ok().unwrap();
     }
 
     #[test]
     fn test_eq() {
-        let mut n: DList<u8> = list_from(&[]);
+        let mut n = list_from(&[]);
         let mut m = list_from(&[]);
         assert!(n == m);
         n.push_front(1);
@@ -1307,7 +1307,7 @@ fn test_hash() {
 
     #[test]
     fn test_ord() {
-        let n: DList<int> = list_from(&[]);
+        let n = list_from(&[]);
         let m = list_from(&[1,2,3]);
         assert!(n < m);
         assert!(m > n);
@@ -1349,7 +1349,7 @@ fn test_ord_nan() {
 
     #[test]
     fn test_fuzz() {
-        for _ in 0u..25 {
+        for _ in 0..25 {
             fuzz_test(3);
             fuzz_test(16);
             fuzz_test(189);
@@ -1358,18 +1358,16 @@ fn test_fuzz() {
 
     #[test]
     fn test_show() {
-        let list: DList<i32> = (0..10).collect();
+        let list: DList<_> = (0..10).collect();
         assert_eq!(format!("{:?}", list), "DList [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
 
-        let list: DList<&str> = vec!["just", "one", "test", "more"].iter()
-                                                                   .map(|&s| s)
-                                                                   .collect();
+        let list: DList<_> = vec!["just", "one", "test", "more"].iter().cloned().collect();
         assert_eq!(format!("{:?}", list), "DList [\"just\", \"one\", \"test\", \"more\"]");
     }
 
     #[cfg(test)]
-    fn fuzz_test(sz: int) {
-        let mut m: DList<int> = DList::new();
+    fn fuzz_test(sz: i32) {
+        let mut m: DList<_> = DList::new();
         let mut v = vec![];
         for i in 0..sz {
             check_links(&m);
@@ -1398,7 +1396,7 @@ fn fuzz_test(sz: int) {
 
         check_links(&m);
 
-        let mut i = 0u;
+        let mut i = 0;
         for (a, &b) in m.into_iter().zip(v.iter()) {
             i += 1;
             assert_eq!(a, b);
@@ -1410,13 +1408,13 @@ fn fuzz_test(sz: int) {
     fn bench_collect_into(b: &mut test::Bencher) {
         let v = &[0; 64];
         b.iter(|| {
-            let _: DList<int> = v.iter().map(|x| *x).collect();
+            let _: DList<_> = v.iter().cloned().collect();
         })
     }
 
     #[bench]
     fn bench_push_front(b: &mut test::Bencher) {
-        let mut m: DList<int> = DList::new();
+        let mut m: DList<_> = DList::new();
         b.iter(|| {
             m.push_front(0);
         })
@@ -1424,7 +1422,7 @@ fn bench_push_front(b: &mut test::Bencher) {
 
     #[bench]
     fn bench_push_back(b: &mut test::Bencher) {
-        let mut m: DList<int> = DList::new();
+        let mut m: DList<_> = DList::new();
         b.iter(|| {
             m.push_back(0);
         })
@@ -1432,7 +1430,7 @@ fn bench_push_back(b: &mut test::Bencher) {
 
     #[bench]
     fn bench_push_back_pop_back(b: &mut test::Bencher) {
-        let mut m: DList<int> = DList::new();
+        let mut m: DList<_> = DList::new();
         b.iter(|| {
             m.push_back(0);
             m.pop_back();
@@ -1441,7 +1439,7 @@ fn bench_push_back_pop_back(b: &mut test::Bencher) {
 
     #[bench]
     fn bench_push_front_pop_front(b: &mut test::Bencher) {
-        let mut m: DList<int> = DList::new();
+        let mut m: DList<_> = DList::new();
         b.iter(|| {
             m.push_front(0);
             m.pop_front();
@@ -1451,7 +1449,7 @@ fn bench_push_front_pop_front(b: &mut test::Bencher) {
     #[bench]
     fn bench_iter(b: &mut test::Bencher) {
         let v = &[0; 128];
-        let m: DList<int> = v.iter().map(|&x|x).collect();
+        let m: DList<_> = v.iter().cloned().collect();
         b.iter(|| {
             assert!(m.iter().count() == 128);
         })
@@ -1459,7 +1457,7 @@ fn bench_iter(b: &mut test::Bencher) {
     #[bench]
     fn bench_iter_mut(b: &mut test::Bencher) {
         let v = &[0; 128];
-        let mut m: DList<int> = v.iter().map(|&x|x).collect();
+        let mut m: DList<_> = v.iter().cloned().collect();
         b.iter(|| {
             assert!(m.iter_mut().count() == 128);
         })
@@ -1467,7 +1465,7 @@ fn bench_iter_mut(b: &mut test::Bencher) {
     #[bench]
     fn bench_iter_rev(b: &mut test::Bencher) {
         let v = &[0; 128];
-        let m: DList<int> = v.iter().map(|&x|x).collect();
+        let m: DList<_> = v.iter().cloned().collect();
         b.iter(|| {
             assert!(m.iter().rev().count() == 128);
         })
@@ -1475,7 +1473,7 @@ fn bench_iter_rev(b: &mut test::Bencher) {
     #[bench]
     fn bench_iter_mut_rev(b: &mut test::Bencher) {
         let v = &[0; 128];
-        let mut m: DList<int> = v.iter().map(|&x|x).collect();
+        let mut m: DList<_> = v.iter().cloned().collect();
         b.iter(|| {
             assert!(m.iter_mut().rev().count() == 128);
         })
index 8cbf50d29f23b02ebe9347b89c83dd619499e653..da146506077478a22dd1ff58e56f17393cb785c2 100644 (file)
@@ -26,7 +26,7 @@
 pub struct EnumSet<E> {
     // We must maintain the invariant that no bits are set
     // for which no variant exists
-    bits: uint
+    bits: usize
 }
 
 impl<E> Copy for EnumSet<E> {}
@@ -47,37 +47,37 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-/// An interface for casting C-like enum to uint and back.
+/// An interface for casting C-like enum to usize and back.
 /// A typically implementation is as below.
 ///
 /// ```{rust,ignore}
-/// #[repr(uint)]
+/// #[repr(usize)]
 /// enum Foo {
 ///     A, B, C
 /// }
 ///
 /// impl CLike for Foo {
-///     fn to_uint(&self) -> uint {
-///         *self as uint
+///     fn to_usize(&self) -> usize {
+///         *self as usize
 ///     }
 ///
-///     fn from_uint(v: uint) -> Foo {
+///     fn from_usize(v: usize) -> Foo {
 ///         unsafe { mem::transmute(v) }
 ///     }
 /// }
 /// ```
 pub trait CLike {
-    /// Converts a C-like enum to a `uint`.
-    fn to_uint(&self) -> uint;
-    /// Converts a `uint` to a C-like enum.
-    fn from_uint(uint) -> Self;
+    /// Converts a C-like enum to a `usize`.
+    fn to_usize(&self) -> usize;
+    /// Converts a `usize` to a C-like enum.
+    fn from_usize(usize) -> Self;
 }
 
-fn bit<E:CLike>(e: &E) -> uint {
-    use core::uint;
-    let value = e.to_uint();
-    assert!(value < uint::BITS,
-            "EnumSet only supports up to {} variants.", uint::BITS - 1);
+fn bit<E:CLike>(e: &E) -> usize {
+    use core::usize;
+    let value = e.to_usize();
+    assert!(value < usize::BITS,
+            "EnumSet only supports up to {} variants.", usize::BITS - 1);
     1 << value
 }
 
@@ -92,7 +92,7 @@ pub fn new() -> EnumSet<E> {
     /// Returns the number of elements in the given `EnumSet`.
     #[unstable(feature = "collections",
                reason = "matches collection reform specification, waiting for dust to settle")]
-    pub fn len(&self) -> uint {
+    pub fn len(&self) -> usize {
         self.bits.count_ones()
     }
 
@@ -205,8 +205,8 @@ fn bitxor(self, e: EnumSet<E>) -> EnumSet<E> {
 
 /// An iterator over an EnumSet
 pub struct Iter<E> {
-    index: uint,
-    bits: uint,
+    index: usize,
+    bits: usize,
 }
 
 // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
@@ -220,7 +220,7 @@ fn clone(&self) -> Iter<E> {
 }
 
 impl<E:CLike> Iter<E> {
-    fn new(bits: uint) -> Iter<E> {
+    fn new(bits: usize) -> Iter<E> {
         Iter { index: 0, bits: bits }
     }
 }
@@ -237,13 +237,13 @@ fn next(&mut self) -> Option<E> {
             self.index += 1;
             self.bits >>= 1;
         }
-        let elem = CLike::from_uint(self.index);
+        let elem = CLike::from_usize(self.index);
         self.index += 1;
         self.bits >>= 1;
         Some(elem)
     }
 
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let exact = self.bits.count_ones();
         (exact, Some(exact))
     }
@@ -282,17 +282,17 @@ mod test {
     use super::{EnumSet, CLike};
 
     #[derive(Copy, PartialEq, Debug)]
-    #[repr(uint)]
+    #[repr(usize)]
     enum Foo {
         A, B, C
     }
 
     impl CLike for Foo {
-        fn to_uint(&self) -> uint {
-            *self as uint
+        fn to_usize(&self) -> usize {
+            *self as usize
         }
 
-        fn from_uint(v: uint) -> Foo {
+        fn from_usize(v: usize) -> Foo {
             unsafe { mem::transmute(v) }
         }
     }
@@ -486,7 +486,7 @@ fn test_operators() {
     fn test_overflow() {
         #[allow(dead_code)]
         #[derive(Copy)]
-        #[repr(uint)]
+        #[repr(usize)]
         enum Bar {
             V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,
             V10, V11, V12, V13, V14, V15, V16, V17, V18, V19,
@@ -498,11 +498,11 @@ enum Bar {
         }
 
         impl CLike for Bar {
-            fn to_uint(&self) -> uint {
-                *self as uint
+            fn to_usize(&self) -> usize {
+                *self as usize
             }
 
-            fn from_uint(v: uint) -> Bar {
+            fn from_usize(v: usize) -> Bar {
                 unsafe { mem::transmute(v) }
             }
         }
index 18021dea9f29ed5f118208d9b948a5a1431b4cac..85c4a64c0c1722575fcf06b47caf5533b8c48a0a 100644 (file)
@@ -32,8 +32,8 @@
 
 use alloc::heap;
 
-static INITIAL_CAPACITY: uint = 7u; // 2^3 - 1
-static MINIMUM_CAPACITY: uint = 1u; // 2 - 1
+static INITIAL_CAPACITY: usize = 7u; // 2^3 - 1
+static MINIMUM_CAPACITY: usize = 1u; // 2 - 1
 
 /// `RingBuf` is a circular buffer, which can be used as a double-ended queue efficiently.
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -44,9 +44,9 @@ pub struct RingBuf<T> {
     // If tail == head the buffer is empty. The length of the ringbuf
     // is defined as the distance between the two.
 
-    tail: uint,
-    head: uint,
-    cap: uint,
+    tail: usize,
+    head: usize,
+    cap: usize,
     ptr: *mut T
 }
 
@@ -59,7 +59,7 @@ unsafe impl<T: Sync> Sync for RingBuf<T> {}
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Clone> Clone for RingBuf<T> {
     fn clone(&self) -> RingBuf<T> {
-        self.iter().map(|t| t.clone()).collect()
+        self.iter().cloned().collect()
     }
 }
 
@@ -99,14 +99,14 @@ unsafe fn buffer_as_mut_slice(&mut self) -> &mut [T] {
 
     /// Moves an element out of the buffer
     #[inline]
-    unsafe fn buffer_read(&mut self, off: uint) -> T {
-        ptr::read(self.ptr.offset(off as int))
+    unsafe fn buffer_read(&mut self, off: usize) -> T {
+        ptr::read(self.ptr.offset(off as isize))
     }
 
     /// Writes an element into the buffer, moving it.
     #[inline]
-    unsafe fn buffer_write(&mut self, off: uint, t: T) {
-        ptr::write(self.ptr.offset(off as int), t);
+    unsafe fn buffer_write(&mut self, off: usize, t: T) {
+        ptr::write(self.ptr.offset(off as isize), t);
     }
 
     /// Returns true iff the buffer is at capacity
@@ -115,31 +115,31 @@ fn is_full(&self) -> bool { self.cap - self.len() == 1 }
 
     /// Returns the index in the underlying buffer for a given logical element index.
     #[inline]
-    fn wrap_index(&self, idx: uint) -> uint { wrap_index(idx, self.cap) }
+    fn wrap_index(&self, idx: usize) -> usize { wrap_index(idx, self.cap) }
 
     /// Copies a contiguous block of memory len long from src to dst
     #[inline]
-    unsafe fn copy(&self, dst: uint, src: uint, len: uint) {
+    unsafe fn copy(&self, dst: usize, src: usize, len: usize) {
         debug_assert!(dst + len <= self.cap, "dst={} src={} len={} cap={}", dst, src, len,
                       self.cap);
         debug_assert!(src + len <= self.cap, "dst={} src={} len={} cap={}", dst, src, len,
                       self.cap);
         ptr::copy_memory(
-            self.ptr.offset(dst as int),
-            self.ptr.offset(src as int),
+            self.ptr.offset(dst as isize),
+            self.ptr.offset(src as isize),
             len);
     }
 
     /// Copies a contiguous block of memory len long from src to dst
     #[inline]
-    unsafe fn copy_nonoverlapping(&self, dst: uint, src: uint, len: uint) {
+    unsafe fn copy_nonoverlapping(&self, dst: usize, src: usize, len: usize) {
         debug_assert!(dst + len <= self.cap, "dst={} src={} len={} cap={}", dst, src, len,
                       self.cap);
         debug_assert!(src + len <= self.cap, "dst={} src={} len={} cap={}", dst, src, len,
                       self.cap);
         ptr::copy_nonoverlapping_memory(
-            self.ptr.offset(dst as int),
-            self.ptr.offset(src as int),
+            self.ptr.offset(dst as isize),
+            self.ptr.offset(src as isize),
             len);
     }
 }
@@ -153,7 +153,7 @@ pub fn new() -> RingBuf<T> {
 
     /// Creates an empty `RingBuf` with space for at least `n` elements.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(n: uint) -> RingBuf<T> {
+    pub fn with_capacity(n: usize) -> RingBuf<T> {
         // +1 since the ringbuffer always leaves one space empty
         let cap = cmp::max(n + 1, MINIMUM_CAPACITY + 1).next_power_of_two();
         assert!(cap > n, "capacity overflow");
@@ -192,10 +192,10 @@ pub fn with_capacity(n: uint) -> RingBuf<T> {
     /// assert_eq!(buf.get(1).unwrap(), &4);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn get(&self, i: uint) -> Option<&T> {
+    pub fn get(&self, i: usize) -> Option<&T> {
         if i < self.len() {
             let idx = self.wrap_index(self.tail + i);
-            unsafe { Some(&*self.ptr.offset(idx as int)) }
+            unsafe { Some(&*self.ptr.offset(idx as isize)) }
         } else {
             None
         }
@@ -222,10 +222,10 @@ pub fn get(&self, i: uint) -> Option<&T> {
     /// assert_eq!(buf[1], 7);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn get_mut(&mut self, i: uint) -> Option<&mut T> {
+    pub fn get_mut(&mut self, i: usize) -> Option<&mut T> {
         if i < self.len() {
             let idx = self.wrap_index(self.tail + i);
-            unsafe { Some(&mut *self.ptr.offset(idx as int)) }
+            unsafe { Some(&mut *self.ptr.offset(idx as isize)) }
         } else {
             None
         }
@@ -251,13 +251,13 @@ pub fn get_mut(&mut self, i: uint) -> Option<&mut T> {
     /// assert_eq!(buf[2], 3);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn swap(&mut self, i: uint, j: uint) {
+    pub fn swap(&mut self, i: usize, j: usize) {
         assert!(i < self.len());
         assert!(j < self.len());
         let ri = self.wrap_index(self.tail + i);
         let rj = self.wrap_index(self.tail + j);
         unsafe {
-            ptr::swap(self.ptr.offset(ri as int), self.ptr.offset(rj as int))
+            ptr::swap(self.ptr.offset(ri as isize), self.ptr.offset(rj as isize))
         }
     }
 
@@ -274,7 +274,7 @@ pub fn swap(&mut self, i: uint, j: uint) {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint { self.cap - 1 }
+    pub fn capacity(&self) -> usize { self.cap - 1 }
 
     /// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
     /// given `RingBuf`. Does nothing if the capacity is already sufficient.
@@ -285,7 +285,7 @@ pub fn capacity(&self) -> uint { self.cap - 1 }
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -297,7 +297,7 @@ pub fn capacity(&self) -> uint { self.cap - 1 }
     /// assert!(buf.capacity() >= 11);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_exact(&mut self, additional: uint) {
+    pub fn reserve_exact(&mut self, additional: usize) {
         self.reserve(additional);
     }
 
@@ -306,7 +306,7 @@ pub fn reserve_exact(&mut self, additional: uint) {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -318,7 +318,7 @@ pub fn reserve_exact(&mut self, additional: uint) {
     /// assert!(buf.capacity() >= 11);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve(&mut self, additional: uint) {
+    pub fn reserve(&mut self, additional: usize) {
         let new_len = self.len() + additional;
         assert!(new_len + 1 > self.len(), "capacity overflow");
         if new_len > self.capacity() {
@@ -482,7 +482,7 @@ pub fn shrink_to_fit(&mut self) {
     /// ```
     #[unstable(feature = "collections",
                reason = "matches collection reform specification; waiting on panic semantics")]
-    pub fn truncate(&mut self, len: uint) {
+    pub fn truncate(&mut self, len: usize) {
         for _ in len..self.len() {
             self.pop_back();
         }
@@ -604,7 +604,7 @@ pub fn as_mut_slices<'a>(&'a mut self) -> (&'a mut [T], &'a mut [T]) {
     /// assert_eq!(v.len(), 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { count(self.tail, self.head, self.cap) }
+    pub fn len(&self) -> usize { count(self.tail, self.head, self.cap) }
 
     /// Returns true if the buffer contains no elements
     ///
@@ -878,7 +878,7 @@ fn is_contiguous(&self) -> bool {
     /// ```
     #[unstable(feature = "collections",
                reason = "the naming of this function may be altered")]
-    pub fn swap_back_remove(&mut self, index: uint) -> Option<T> {
+    pub fn swap_back_remove(&mut self, index: usize) -> Option<T> {
         let length = self.len();
         if length > 0 && index < length - 1 {
             self.swap(index, length - 1);
@@ -911,7 +911,7 @@ pub fn swap_back_remove(&mut self, index: uint) -> Option<T> {
     /// ```
     #[unstable(feature = "collections",
                reason = "the naming of this function may be altered")]
-    pub fn swap_front_remove(&mut self, index: uint) -> Option<T> {
+    pub fn swap_front_remove(&mut self, index: usize) -> Option<T> {
         let length = self.len();
         if length > 0 && index < length && index != 0 {
             self.swap(index, 0);
@@ -939,7 +939,7 @@ pub fn swap_front_remove(&mut self, index: uint) -> Option<T> {
     /// buf.insert(1,11);
     /// assert_eq!(Some(&11), buf.get(1));
     /// ```
-    pub fn insert(&mut self, i: uint, t: T) {
+    pub fn insert(&mut self, i: usize, t: T) {
         assert!(i <= self.len(), "index out of bounds");
         if self.is_full() {
             self.reserve(1);
@@ -1144,7 +1144,7 @@ pub fn insert(&mut self, i: uint, t: T) {
     /// assert_eq!(Some(&15), buf.get(2));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn remove(&mut self, i: uint) -> Option<T> {
+    pub fn remove(&mut self, i: usize) -> Option<T> {
         if self.is_empty() || self.len() <= i {
             return None;
         }
@@ -1312,7 +1312,7 @@ impl<T: Clone> RingBuf<T> {
     /// ```
     #[unstable(feature = "collections",
                reason = "matches collection reform specification; waiting on panic semantics")]
-    pub fn resize(&mut self, new_len: uint, value: T) {
+    pub fn resize(&mut self, new_len: usize, value: T) {
         let len = self.len();
 
         if new_len > len {
@@ -1325,14 +1325,14 @@ pub fn resize(&mut self, new_len: uint, value: T) {
 
 /// Returns the index in the underlying buffer for a given logical element index.
 #[inline]
-fn wrap_index(index: uint, size: uint) -> uint {
+fn wrap_index(index: usize, size: usize) -> usize {
     // size is always a power of 2
     index & (size - 1)
 }
 
 /// Calculate the number of elements left to be read in the buffer
 #[inline]
-fn count(tail: uint, head: uint, size: uint) -> uint {
+fn count(tail: usize, head: usize, size: usize) -> usize {
     // size is always a power of 2
     (head - tail) & (size - 1)
 }
@@ -1341,8 +1341,8 @@ fn count(tail: uint, head: uint, size: uint) -> uint {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Iter<'a, T:'a> {
     ring: &'a [T],
-    tail: uint,
-    head: uint
+    tail: usize,
+    head: usize
 }
 
 // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
@@ -1371,7 +1371,7 @@ fn next(&mut self) -> Option<&'a T> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let len = count(self.tail, self.head, self.ring.len());
         (len, Some(len))
     }
@@ -1395,13 +1395,13 @@ impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> RandomAccessIterator for Iter<'a, T> {
     #[inline]
-    fn indexable(&self) -> uint {
+    fn indexable(&self) -> usize {
         let (len, _) = self.size_hint();
         len
     }
 
     #[inline]
-    fn idx(&mut self, j: uint) -> Option<&'a T> {
+    fn idx(&mut self, j: usize) -> Option<&'a T> {
         if j >= self.indexable() {
             None
         } else {
@@ -1418,9 +1418,9 @@ fn idx(&mut self, j: uint) -> Option<&'a T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct IterMut<'a, T:'a> {
     ptr: *mut T,
-    tail: uint,
-    head: uint,
-    cap: uint,
+    tail: usize,
+    head: usize,
+    cap: usize,
     marker: marker::ContravariantLifetime<'a>,
 }
 
@@ -1437,12 +1437,12 @@ fn next(&mut self) -> Option<&'a mut T> {
         self.tail = wrap_index(self.tail + 1, self.cap);
 
         unsafe {
-            Some(&mut *self.ptr.offset(tail as int))
+            Some(&mut *self.ptr.offset(tail as isize))
         }
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let len = count(self.tail, self.head, self.cap);
         (len, Some(len))
     }
@@ -1458,7 +1458,7 @@ fn next_back(&mut self) -> Option<&'a mut T> {
         self.head = wrap_index(self.head - 1, self.cap);
 
         unsafe {
-            Some(&mut *self.ptr.offset(self.head as int))
+            Some(&mut *self.ptr.offset(self.head as isize))
         }
     }
 }
@@ -1482,7 +1482,7 @@ fn next(&mut self) -> Option<T> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let len = self.inner.len();
         (len, Some(len))
     }
@@ -1526,7 +1526,7 @@ fn next(&mut self) -> Option<T> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let len = self.inner.len();
         (len, Some(len))
     }
@@ -1580,21 +1580,21 @@ fn hash(&self, state: &mut S) {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<A> Index<uint> for RingBuf<A> {
+impl<A> Index<usize> for RingBuf<A> {
     type Output = A;
 
     #[inline]
-    fn index<'a>(&'a self, i: &uint) -> &'a A {
+    fn index<'a>(&'a self, i: &usize) -> &'a A {
         self.get(*i).expect("Out of bounds access")
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<A> IndexMut<uint> for RingBuf<A> {
+impl<A> IndexMut<usize> for RingBuf<A> {
     type Output = A;
 
     #[inline]
-    fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut A {
+    fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut A {
         self.get_mut(*i).expect("Out of bounds access")
     }
 }
@@ -1673,13 +1673,13 @@ mod tests {
     #[allow(deprecated)]
     fn test_simple() {
         let mut d = RingBuf::new();
-        assert_eq!(d.len(), 0u);
+        assert_eq!(d.len(), 0);
         d.push_front(17);
         d.push_front(42);
         d.push_back(137);
-        assert_eq!(d.len(), 3u);
+        assert_eq!(d.len(), 3);
         d.push_back(137);
-        assert_eq!(d.len(), 4u);
+        assert_eq!(d.len(), 4);
         assert_eq!(*d.front().unwrap(), 42);
         assert_eq!(*d.back().unwrap(), 137);
         let mut i = d.pop_front();
@@ -1690,15 +1690,15 @@ fn test_simple() {
         assert_eq!(i, Some(137));
         i = d.pop_back();
         assert_eq!(i, Some(17));
-        assert_eq!(d.len(), 0u);
+        assert_eq!(d.len(), 0);
         d.push_back(3);
-        assert_eq!(d.len(), 1u);
+        assert_eq!(d.len(), 1);
         d.push_front(2);
-        assert_eq!(d.len(), 2u);
+        assert_eq!(d.len(), 2);
         d.push_back(4);
-        assert_eq!(d.len(), 3u);
+        assert_eq!(d.len(), 3);
         d.push_front(1);
-        assert_eq!(d.len(), 4u);
+        assert_eq!(d.len(), 4);
         debug!("{}", d[0]);
         debug!("{}", d[1]);
         debug!("{}", d[2]);
@@ -1743,21 +1743,21 @@ fn test_parameterized<T:Clone + PartialEq + Debug>(a: T, b: T, c: T, d: T) {
     #[test]
     fn test_push_front_grow() {
         let mut deq = RingBuf::new();
-        for i in 0u..66 {
+        for i in 0..66 {
             deq.push_front(i);
         }
         assert_eq!(deq.len(), 66);
 
-        for i in 0u..66 {
+        for i in 0..66 {
             assert_eq!(deq[i], 65 - i);
         }
 
         let mut deq = RingBuf::new();
-        for i in 0u..66 {
+        for i in 0..66 {
             deq.push_back(i);
         }
 
-        for i in 0u..66 {
+        for i in 0..66 {
             assert_eq!(deq[i], i);
         }
     }
@@ -1765,7 +1765,7 @@ fn test_push_front_grow() {
     #[test]
     fn test_index() {
         let mut deq = RingBuf::new();
-        for i in 1u..4 {
+        for i in 1..4 {
             deq.push_front(i);
         }
         assert_eq!(deq[1], 2);
@@ -1775,7 +1775,7 @@ fn test_index() {
     #[should_fail]
     fn test_index_out_of_bounds() {
         let mut deq = RingBuf::new();
-        for i in 1u..4 {
+        for i in 1..4 {
             deq.push_front(i);
         }
         deq[3];
@@ -1784,7 +1784,7 @@ fn test_index_out_of_bounds() {
     #[bench]
     fn bench_new(b: &mut test::Bencher) {
         b.iter(|| {
-            let ring: RingBuf<u64> = RingBuf::new();
+            let ring: RingBuf<i32> = RingBuf::new();
             test::black_box(ring);
         })
     }
@@ -1815,7 +1815,7 @@ fn bench_push_front_100(b: &mut test::Bencher) {
 
     #[bench]
     fn bench_pop_back_100(b: &mut test::Bencher) {
-        let mut deq: RingBuf<i32> = RingBuf::with_capacity(101);
+        let mut deq= RingBuf::<i32>::with_capacity(101);
 
         b.iter(|| {
             deq.head = 100;
@@ -1828,7 +1828,7 @@ fn bench_pop_back_100(b: &mut test::Bencher) {
 
     #[bench]
     fn bench_pop_front_100(b: &mut test::Bencher) {
-        let mut deq: RingBuf<i32> = RingBuf::with_capacity(101);
+        let mut deq = RingBuf::<i32>::with_capacity(101);
 
         b.iter(|| {
             deq.head = 100;
@@ -1852,7 +1852,7 @@ fn bench_grow_1025(b: &mut test::Bencher) {
 
     #[bench]
     fn bench_iter_1000(b: &mut test::Bencher) {
-        let ring: RingBuf<i32> = (0..1000).collect();
+        let ring: RingBuf<_> = (0..1000).collect();
 
         b.iter(|| {
             let mut sum = 0;
@@ -1865,7 +1865,7 @@ fn bench_iter_1000(b: &mut test::Bencher) {
 
     #[bench]
     fn bench_mut_iter_1000(b: &mut test::Bencher) {
-        let mut ring: RingBuf<i32> = (0..1000).collect();
+        let mut ring: RingBuf<_> = (0..1000).collect();
 
         b.iter(|| {
             let mut sum = 0;
@@ -1978,11 +1978,7 @@ fn test_with_capacity_non_power_two() {
     #[test]
     fn test_reserve_exact() {
         let mut d = RingBuf::new();
-        d.push_back(0u64);
-        d.reserve_exact(50);
-        assert!(d.capacity() >= 51);
-        let mut d = RingBuf::new();
-        d.push_back(0u32);
+        d.push_back(0);
         d.reserve_exact(50);
         assert!(d.capacity() >= 51);
     }
@@ -1990,21 +1986,17 @@ fn test_reserve_exact() {
     #[test]
     fn test_reserve() {
         let mut d = RingBuf::new();
-        d.push_back(0u64);
-        d.reserve(50);
-        assert!(d.capacity() >= 51);
-        let mut d = RingBuf::new();
-        d.push_back(0u32);
+        d.push_back(0);
         d.reserve(50);
         assert!(d.capacity() >= 51);
     }
 
     #[test]
     fn test_swap() {
-        let mut d: RingBuf<i32> = (0..5).collect();
+        let mut d: RingBuf<_> = (0..5).collect();
         d.pop_front();
         d.swap(0, 3);
-        assert_eq!(d.iter().map(|&x|x).collect::<Vec<i32>>(), vec!(4, 2, 3, 1));
+        assert_eq!(d.iter().cloned().collect::<Vec<_>>(), vec!(4, 2, 3, 1));
     }
 
     #[test]
@@ -2018,7 +2010,7 @@ fn test_iter() {
         }
         {
             let b: &[_] = &[&0,&1,&2,&3,&4];
-            assert_eq!(d.iter().collect::<Vec<&i32>>(), b);
+            assert_eq!(d.iter().collect::<Vec<_>>(), b);
         }
 
         for i in 6..9 {
@@ -2026,7 +2018,7 @@ fn test_iter() {
         }
         {
             let b: &[_] = &[&8,&7,&6,&0,&1,&2,&3,&4];
-            assert_eq!(d.iter().collect::<Vec<&i32>>(), b);
+            assert_eq!(d.iter().collect::<Vec<_>>(), b);
         }
 
         let mut it = d.iter();
@@ -2049,14 +2041,14 @@ fn test_rev_iter() {
         }
         {
             let b: &[_] = &[&4,&3,&2,&1,&0];
-            assert_eq!(d.iter().rev().collect::<Vec<&i32>>(), b);
+            assert_eq!(d.iter().rev().collect::<Vec<_>>(), b);
         }
 
         for i in 6..9 {
             d.push_front(i);
         }
         let b: &[_] = &[&4,&3,&2,&1,&0,&6,&7,&8];
-        assert_eq!(d.iter().rev().collect::<Vec<&i32>>(), b);
+        assert_eq!(d.iter().rev().collect::<Vec<_>>(), b);
     }
 
     #[test]
@@ -2070,8 +2062,8 @@ fn test_mut_rev_iter_wrap() {
         assert_eq!(d.pop_front(), Some(1));
         d.push_back(4);
 
-        assert_eq!(d.iter_mut().rev().map(|x| *x).collect::<Vec<i32>>(),
-                   vec!(4, 3, 2));
+        assert_eq!(d.iter_mut().rev().cloned().collect::<Vec<_>>(),
+                   vec![4, 3, 2]);
     }
 
     #[test]
@@ -2079,7 +2071,7 @@ fn test_mut_iter() {
         let mut d = RingBuf::new();
         assert!(d.iter_mut().next().is_none());
 
-        for i in 0u..3 {
+        for i in 0..3 {
             d.push_front(i);
         }
 
@@ -2102,7 +2094,7 @@ fn test_mut_rev_iter() {
         let mut d = RingBuf::new();
         assert!(d.iter_mut().rev().next().is_none());
 
-        for i in 0u..3 {
+        for i in 0..3 {
             d.push_front(i);
         }
 
@@ -2141,7 +2133,7 @@ fn test_into_iter() {
             }
 
             let b = vec![0,1,2,3,4];
-            assert_eq!(d.into_iter().collect::<Vec<i32>>(), b);
+            assert_eq!(d.into_iter().collect::<Vec<_>>(), b);
         }
 
         // wrapped iter
@@ -2155,7 +2147,7 @@ fn test_into_iter() {
             }
 
             let b = vec![8,7,6,0,1,2,3,4];
-            assert_eq!(d.into_iter().collect::<Vec<i32>>(), b);
+            assert_eq!(d.into_iter().collect::<Vec<_>>(), b);
         }
 
         // partially used
@@ -2224,7 +2216,7 @@ fn test_drain() {
 
         // partially used
         {
-            let mut d: RingBuf<i32> = RingBuf::new();
+            let mut d: RingBuf<_> = RingBuf::new();
             for i in 0..5 {
                 d.push_back(i);
             }
@@ -2250,12 +2242,12 @@ fn test_drain() {
     fn test_from_iter() {
         use core::iter;
         let v = vec!(1,2,3,4,5,6,7);
-        let deq: RingBuf<i32> = v.iter().map(|&x| x).collect();
-        let u: Vec<i32> = deq.iter().map(|&x| x).collect();
+        let deq: RingBuf<_> = v.iter().cloned().collect();
+        let u: Vec<_> = deq.iter().cloned().collect();
         assert_eq!(u, v);
 
-        let seq = iter::count(0u, 2).take(256);
-        let deq: RingBuf<uint> = seq.collect();
+        let seq = iter::count(0, 2).take(256);
+        let deq: RingBuf<_> = seq.collect();
         for (i, &x) in deq.iter().enumerate() {
             assert_eq!(2*i, x);
         }
@@ -2269,14 +2261,14 @@ fn test_clone() {
         d.push_front(42);
         d.push_back(137);
         d.push_back(137);
-        assert_eq!(d.len(), 4u);
+        assert_eq!(d.len(), 4);
         let mut e = d.clone();
-        assert_eq!(e.len(), 4u);
+        assert_eq!(e.len(), 4);
         while !d.is_empty() {
             assert_eq!(d.pop_back(), e.pop_back());
         }
-        assert_eq!(d.len(), 0u);
-        assert_eq!(e.len(), 0u);
+        assert_eq!(d.len(), 0);
+        assert_eq!(e.len(), 0);
     }
 
     #[test]
@@ -2333,18 +2325,18 @@ fn test_ord() {
 
     #[test]
     fn test_show() {
-        let ringbuf: RingBuf<i32> = (0..10).collect();
+        let ringbuf: RingBuf<_> = (0..10).collect();
         assert_eq!(format!("{:?}", ringbuf), "RingBuf [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
 
-        let ringbuf: RingBuf<&str> = vec!["just", "one", "test", "more"].iter()
-                                                                        .map(|&s| s)
+        let ringbuf: RingBuf<_> = vec!["just", "one", "test", "more"].iter()
+                                                                        .cloned()
                                                                         .collect();
         assert_eq!(format!("{:?}", ringbuf), "RingBuf [\"just\", \"one\", \"test\", \"more\"]");
     }
 
     #[test]
     fn test_drop() {
-        static mut drops: uint = 0;
+        static mut drops: i32 = 0;
         struct Elem;
         impl Drop for Elem {
             fn drop(&mut self) {
@@ -2364,7 +2356,7 @@ fn drop(&mut self) {
 
     #[test]
     fn test_drop_with_pop() {
-        static mut drops: uint = 0;
+        static mut drops: i32 = 0;
         struct Elem;
         impl Drop for Elem {
             fn drop(&mut self) {
@@ -2388,7 +2380,7 @@ fn drop(&mut self) {
 
     #[test]
     fn test_drop_clear() {
-        static mut drops: uint = 0;
+        static mut drops: i32 = 0;
         struct Elem;
         impl Drop for Elem {
             fn drop(&mut self) {
index 8721de1299fb2fc71e48f2bb0082ad72081e7ef6..3fe3fe04a5432f906ab67b92a63e7b3f57f94191 100644 (file)
@@ -26,7 +26,7 @@
 //! block of memory that a mutable slice points to:
 //!
 //! ```rust
-//! let x: &mut[int] = &mut [1, 2, 3];
+//! let x: &mut[i32] = &mut [1, 2, 3];
 //! x[1] = 7;
 //! assert_eq!(x[0], 1);
 //! assert_eq!(x[1], 7);
@@ -168,25 +168,25 @@ pub trait SliceExt {
     /// ```
     #[unstable(feature = "collections",
                reason = "uncertain about this API approach")]
-    fn move_from(&mut self, src: Vec<Self::Item>, start: uint, end: uint) -> uint;
+    fn move_from(&mut self, src: Vec<Self::Item>, start: usize, end: usize) -> usize;
 
     /// Deprecated: use `&s[start .. end]` notation instead.
     #[unstable(feature = "collections",
                reason = "will be replaced by slice syntax")]
     #[deprecated(since = "1.0.0", reason = "use &s[start .. end] instead")]
-    fn slice(&self, start: uint, end: uint) -> &[Self::Item];
+    fn slice(&self, start: usize, end: usize) -> &[Self::Item];
 
     /// Deprecated: use `&s[start..]` notation instead.
     #[unstable(feature = "collections",
                reason = "will be replaced by slice syntax")]
     #[deprecated(since = "1.0.0", reason = "use &s[start..] instead")]
-    fn slice_from(&self, start: uint) -> &[Self::Item];
+    fn slice_from(&self, start: usize) -> &[Self::Item];
 
     /// Deprecated: use `&s[..end]` notation instead.
     #[unstable(feature = "collections",
                reason = "will be replaced by slice syntax")]
     #[deprecated(since = "1.0.0", reason = "use &s[..end] instead")]
-    fn slice_to(&self, end: uint) -> &[Self::Item];
+    fn slice_to(&self, end: usize) -> &[Self::Item];
 
     /// Divides one slice into two at an index.
     ///
@@ -205,7 +205,7 @@ pub trait SliceExt {
     /// assert_eq!([30, 20, 50], v2);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn split_at(&self, mid: uint) -> (&[Self::Item], &[Self::Item]);
+    fn split_at(&self, mid: usize) -> (&[Self::Item], &[Self::Item]);
 
     /// Returns an iterator over the slice.
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -245,7 +245,7 @@ fn split<F>(&self, pred: F) -> Split<Self::Item, F>
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn splitn<F>(&self, n: uint, pred: F) -> SplitN<Self::Item, F>
+    fn splitn<F>(&self, n: usize, pred: F) -> SplitN<Self::Item, F>
                  where F: FnMut(&Self::Item) -> bool;
 
     /// Returns an iterator over subslices separated by elements that match
@@ -265,7 +265,7 @@ fn splitn<F>(&self, n: uint, pred: F) -> SplitN<Self::Item, F>
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
+    fn rsplitn<F>(&self, n: usize, pred: F) -> RSplitN<Self::Item, F>
                   where F: FnMut(&Self::Item) -> bool;
 
     /// Returns an iterator over all contiguous windows of length
@@ -288,7 +288,7 @@ fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn windows(&self, size: uint) -> Windows<Self::Item>;
+    fn windows(&self, size: usize) -> Windows<Self::Item>;
 
     /// Returns an iterator over `size` elements of the slice at a
     /// time. The chunks do not overlap. If `size` does not divide the
@@ -311,7 +311,7 @@ fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn chunks(&self, size: uint) -> Chunks<Self::Item>;
+    fn chunks(&self, size: usize) -> Chunks<Self::Item>;
 
     /// Returns the element of a slice at the given index, or `None` if the
     /// index is out of bounds.
@@ -324,7 +324,7 @@ fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
     /// assert_eq!(None, v.get(3));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn get(&self, index: uint) -> Option<&Self::Item>;
+    fn get(&self, index: usize) -> Option<&Self::Item>;
 
     /// Returns the first element of a slice, or `None` if it is empty.
     ///
@@ -365,7 +365,7 @@ fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
     /// Returns a pointer to the element at the given index, without doing
     /// bounds checking.
     #[stable(feature = "rust1", since = "1.0.0")]
-    unsafe fn get_unchecked(&self, index: uint) -> &Self::Item;
+    unsafe fn get_unchecked(&self, index: usize) -> &Self::Item;
 
     /// Returns an unsafe pointer to the slice's buffer
     ///
@@ -410,7 +410,7 @@ fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
     /// assert!(match r { Ok(1...4) => true, _ => false, });
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn binary_search_by<F>(&self, f: F) -> Result<uint, uint> where
+    fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where
         F: FnMut(&Self::Item) -> Ordering;
 
     /// Return the number of elements in the slice
@@ -422,7 +422,7 @@ fn binary_search_by<F>(&self, f: F) -> Result<uint, uint> where
     /// assert_eq!(a.len(), 3);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len(&self) -> uint;
+    fn len(&self) -> usize;
 
     /// Returns true if the slice has a length of 0
     ///
@@ -438,7 +438,7 @@ fn is_empty(&self) -> bool { self.len() == 0 }
     /// Returns a mutable reference to the element at the given index,
     /// or `None` if the index is out of bounds
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn get_mut(&mut self, index: uint) -> Option<&mut Self::Item>;
+    fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item>;
 
     /// Work with `self` as a mut slice.
     /// Primarily intended for getting a &mut [T] from a [T; N].
@@ -449,19 +449,19 @@ fn is_empty(&self) -> bool { self.len() == 0 }
     #[unstable(feature = "collections",
                reason = "will be replaced by slice syntax")]
     #[deprecated(since = "1.0.0", reason = "use &mut s[start .. end] instead")]
-    fn slice_mut(&mut self, start: uint, end: uint) -> &mut [Self::Item];
+    fn slice_mut(&mut self, start: usize, end: usize) -> &mut [Self::Item];
 
     /// Deprecated: use `&mut s[start ..]` instead.
     #[unstable(feature = "collections",
                reason = "will be replaced by slice syntax")]
     #[deprecated(since = "1.0.0", reason = "use &mut s[start ..] instead")]
-    fn slice_from_mut(&mut self, start: uint) -> &mut [Self::Item];
+    fn slice_from_mut(&mut self, start: usize) -> &mut [Self::Item];
 
     /// Deprecated: use `&mut s[.. end]` instead.
     #[unstable(feature = "collections",
                reason = "will be replaced by slice syntax")]
     #[deprecated(since = "1.0.0", reason = "use &mut s[.. end] instead")]
-    fn slice_to_mut(&mut self, end: uint) -> &mut [Self::Item];
+    fn slice_to_mut(&mut self, end: usize) -> &mut [Self::Item];
 
     /// Returns an iterator that allows modifying each value
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -495,7 +495,7 @@ fn split_mut<F>(&mut self, pred: F) -> SplitMut<Self::Item, F>
     /// `pred`, limited to splitting at most `n` times.  The matched element is
     /// not contained in the subslices.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn splitn_mut<F>(&mut self, n: uint, pred: F) -> SplitNMut<Self::Item, F>
+    fn splitn_mut<F>(&mut self, n: usize, pred: F) -> SplitNMut<Self::Item, F>
                      where F: FnMut(&Self::Item) -> bool;
 
     /// Returns an iterator over subslices separated by elements that match
@@ -503,7 +503,7 @@ fn splitn_mut<F>(&mut self, n: uint, pred: F) -> SplitNMut<Self::Item, F>
     /// the slice and works backwards.  The matched element is not contained in
     /// the subslices.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn rsplitn_mut<F>(&mut self,  n: uint, pred: F) -> RSplitNMut<Self::Item, F>
+    fn rsplitn_mut<F>(&mut self,  n: usize, pred: F) -> RSplitNMut<Self::Item, F>
                       where F: FnMut(&Self::Item) -> bool;
 
     /// Returns an iterator over `chunk_size` elements of the slice at a time.
@@ -515,7 +515,7 @@ fn rsplitn_mut<F>(&mut self,  n: uint, pred: F) -> RSplitNMut<Self::Item, F>
     ///
     /// Panics if `chunk_size` is 0.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn chunks_mut(&mut self, chunk_size: uint) -> ChunksMut<Self::Item>;
+    fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<Self::Item>;
 
     /// Swaps two elements in a slice.
     ///
@@ -536,7 +536,7 @@ fn rsplitn_mut<F>(&mut self,  n: uint, pred: F) -> RSplitNMut<Self::Item, F>
     /// assert!(v == ["a", "d", "c", "b"]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn swap(&mut self, a: uint, b: uint);
+    fn swap(&mut self, a: usize, b: usize);
 
     /// Divides one `&mut` into two at an index.
     ///
@@ -573,7 +573,7 @@ fn rsplitn_mut<F>(&mut self,  n: uint, pred: F) -> RSplitNMut<Self::Item, F>
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn split_at_mut(&mut self, mid: uint) -> (&mut [Self::Item], &mut [Self::Item]);
+    fn split_at_mut(&mut self, mid: usize) -> (&mut [Self::Item], &mut [Self::Item]);
 
     /// Reverse the order of elements in a slice, in place.
     ///
@@ -589,7 +589,7 @@ fn rsplitn_mut<F>(&mut self,  n: uint, pred: F) -> RSplitNMut<Self::Item, F>
 
     /// Returns an unsafe mutable pointer to the element in index
     #[stable(feature = "rust1", since = "1.0.0")]
-    unsafe fn get_unchecked_mut(&mut self, index: uint) -> &mut Self::Item;
+    unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut Self::Item;
 
     /// Return an unsafe mutable pointer to the slice's buffer.
     ///
@@ -651,7 +651,7 @@ fn rsplitn_mut<F>(&mut self,  n: uint, pred: F) -> RSplitNMut<Self::Item, F>
     /// assert!(dst == [3, 4, 5]);
     /// ```
     #[unstable(feature = "collections")]
-    fn clone_from_slice(&mut self, &[Self::Item]) -> uint where Self::Item: Clone;
+    fn clone_from_slice(&mut self, &[Self::Item]) -> usize where Self::Item: Clone;
 
     /// Sorts the slice, in place.
     ///
@@ -692,12 +692,12 @@ fn rsplitn_mut<F>(&mut self,  n: uint, pred: F) -> RSplitNMut<Self::Item, F>
     /// assert!(match r { Ok(1...4) => true, _ => false, });
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn binary_search(&self, x: &Self::Item) -> Result<uint, uint> where Self::Item: Ord;
+    fn binary_search(&self, x: &Self::Item) -> Result<usize, usize> where Self::Item: Ord;
 
     /// Deprecated: use `binary_search` instead.
     #[unstable(feature = "collections")]
     #[deprecated(since = "1.0.0", reason = "use binary_search instead")]
-    fn binary_search_elem(&self, x: &Self::Item) -> Result<uint, uint> where Self::Item: Ord {
+    fn binary_search_elem(&self, x: &Self::Item) -> Result<usize, usize> where Self::Item: Ord {
         self.binary_search(x)
     }
 
@@ -743,11 +743,11 @@ fn binary_search_elem(&self, x: &Self::Item) -> Result<uint, uint> where Self::I
 
     /// Find the first index containing a matching value.
     #[unstable(feature = "collections")]
-    fn position_elem(&self, t: &Self::Item) -> Option<uint> where Self::Item: PartialEq;
+    fn position_elem(&self, t: &Self::Item) -> Option<usize> where Self::Item: PartialEq;
 
     /// Find the last index containing a matching value.
     #[unstable(feature = "collections")]
-    fn rposition_elem(&self, t: &Self::Item) -> Option<uint> where Self::Item: PartialEq;
+    fn rposition_elem(&self, t: &Self::Item) -> Option<usize> where Self::Item: PartialEq;
 
     /// Returns true if the slice contains an element with the given value.
     ///
@@ -804,7 +804,7 @@ fn sort_by<F>(&mut self, compare: F) where F: FnMut(&T, &T) -> Ordering {
     }
 
     #[inline]
-    fn move_from(&mut self, mut src: Vec<T>, start: uint, end: uint) -> uint {
+    fn move_from(&mut self, mut src: Vec<T>, start: usize, end: usize) -> usize {
         for (a, b) in self.iter_mut().zip(src[start .. end].iter_mut()) {
             mem::swap(a, b);
         }
@@ -812,22 +812,22 @@ fn move_from(&mut self, mut src: Vec<T>, start: uint, end: uint) -> uint {
     }
 
     #[inline]
-    fn slice<'a>(&'a self, start: uint, end: uint) -> &'a [T] {
+    fn slice<'a>(&'a self, start: usize, end: usize) -> &'a [T] {
         &self[start .. end]
     }
 
     #[inline]
-    fn slice_from<'a>(&'a self, start: uint) -> &'a [T] {
+    fn slice_from<'a>(&'a self, start: usize) -> &'a [T] {
         &self[start ..]
     }
 
     #[inline]
-    fn slice_to<'a>(&'a self, end: uint) -> &'a [T] {
+    fn slice_to<'a>(&'a self, end: usize) -> &'a [T] {
         &self[.. end]
     }
 
     #[inline]
-    fn split_at<'a>(&'a self, mid: uint) -> (&'a [T], &'a [T]) {
+    fn split_at<'a>(&'a self, mid: usize) -> (&'a [T], &'a [T]) {
         core_slice::SliceExt::split_at(self, mid)
     }
 
@@ -843,29 +843,29 @@ fn split<F>(&self, pred: F) -> Split<T, F>
     }
 
     #[inline]
-    fn splitn<F>(&self, n: uint, pred: F) -> SplitN<T, F>
+    fn splitn<F>(&self, n: usize, pred: F) -> SplitN<T, F>
                  where F: FnMut(&T) -> bool {
         core_slice::SliceExt::splitn(self, n, pred)
     }
 
     #[inline]
-    fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<T, F>
+    fn rsplitn<F>(&self, n: usize, pred: F) -> RSplitN<T, F>
                   where F: FnMut(&T) -> bool {
         core_slice::SliceExt::rsplitn(self, n, pred)
     }
 
     #[inline]
-    fn windows<'a>(&'a self, size: uint) -> Windows<'a, T> {
+    fn windows<'a>(&'a self, size: usize) -> Windows<'a, T> {
         core_slice::SliceExt::windows(self, size)
     }
 
     #[inline]
-    fn chunks<'a>(&'a self, size: uint) -> Chunks<'a, T> {
+    fn chunks<'a>(&'a self, size: usize) -> Chunks<'a, T> {
         core_slice::SliceExt::chunks(self, size)
     }
 
     #[inline]
-    fn get<'a>(&'a self, index: uint) -> Option<&'a T> {
+    fn get<'a>(&'a self, index: usize) -> Option<&'a T> {
         core_slice::SliceExt::get(self, index)
     }
 
@@ -890,7 +890,7 @@ fn last<'a>(&'a self) -> Option<&'a T> {
     }
 
     #[inline]
-    unsafe fn get_unchecked<'a>(&'a self, index: uint) -> &'a T {
+    unsafe fn get_unchecked<'a>(&'a self, index: usize) -> &'a T {
         core_slice::SliceExt::get_unchecked(self, index)
     }
 
@@ -900,13 +900,13 @@ fn as_ptr(&self) -> *const T {
     }
 
     #[inline]
-    fn binary_search_by<F>(&self, f: F) -> Result<uint, uint>
+    fn binary_search_by<F>(&self, f: F) -> Result<usize, usize>
                         where F: FnMut(&T) -> Ordering {
         core_slice::SliceExt::binary_search_by(self, f)
     }
 
     #[inline]
-    fn len(&self) -> uint {
+    fn len(&self) -> usize {
         core_slice::SliceExt::len(self)
     }
 
@@ -916,7 +916,7 @@ fn is_empty(&self) -> bool {
     }
 
     #[inline]
-    fn get_mut<'a>(&'a mut self, index: uint) -> Option<&'a mut T> {
+    fn get_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut T> {
         core_slice::SliceExt::get_mut(self, index)
     }
 
@@ -926,17 +926,17 @@ fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
     }
 
     #[inline]
-    fn slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
+    fn slice_mut<'a>(&'a mut self, start: usize, end: usize) -> &'a mut [T] {
         &mut self[start .. end]
     }
 
     #[inline]
-    fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
+    fn slice_from_mut<'a>(&'a mut self, start: usize) -> &'a mut [T] {
         &mut self[start ..]
     }
 
     #[inline]
-    fn slice_to_mut<'a>(&'a mut self, end: uint) -> &'a mut [T] {
+    fn slice_to_mut<'a>(&'a mut self, end: usize) -> &'a mut [T] {
         &mut self[.. end]
     }
 
@@ -972,29 +972,29 @@ fn split_mut<F>(&mut self, pred: F) -> SplitMut<T, F>
     }
 
     #[inline]
-    fn splitn_mut<F>(&mut self, n: uint, pred: F) -> SplitNMut<T, F>
+    fn splitn_mut<F>(&mut self, n: usize, pred: F) -> SplitNMut<T, F>
                      where F: FnMut(&T) -> bool {
         core_slice::SliceExt::splitn_mut(self, n, pred)
     }
 
     #[inline]
-    fn rsplitn_mut<F>(&mut self,  n: uint, pred: F) -> RSplitNMut<T, F>
+    fn rsplitn_mut<F>(&mut self,  n: usize, pred: F) -> RSplitNMut<T, F>
                       where F: FnMut(&T) -> bool {
         core_slice::SliceExt::rsplitn_mut(self, n, pred)
     }
 
     #[inline]
-    fn chunks_mut<'a>(&'a mut self, chunk_size: uint) -> ChunksMut<'a, T> {
+    fn chunks_mut<'a>(&'a mut self, chunk_size: usize) -> ChunksMut<'a, T> {
         core_slice::SliceExt::chunks_mut(self, chunk_size)
     }
 
     #[inline]
-    fn swap(&mut self, a: uint, b: uint) {
+    fn swap(&mut self, a: usize, b: usize) {
         core_slice::SliceExt::swap(self, a, b)
     }
 
     #[inline]
-    fn split_at_mut<'a>(&'a mut self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
+    fn split_at_mut<'a>(&'a mut self, mid: usize) -> (&'a mut [T], &'a mut [T]) {
         core_slice::SliceExt::split_at_mut(self, mid)
     }
 
@@ -1004,7 +1004,7 @@ fn reverse(&mut self) {
     }
 
     #[inline]
-    unsafe fn get_unchecked_mut<'a>(&'a mut self, index: uint) -> &'a mut T {
+    unsafe fn get_unchecked_mut<'a>(&'a mut self, index: usize) -> &'a mut T {
         core_slice::SliceExt::get_unchecked_mut(self, index)
     }
 
@@ -1029,7 +1029,7 @@ fn permutations(&self) -> Permutations<T> where T: Clone {
         }
     }
 
-    fn clone_from_slice(&mut self, src: &[T]) -> uint where T: Clone {
+    fn clone_from_slice(&mut self, src: &[T]) -> usize where T: Clone {
         core_slice::SliceExt::clone_from_slice(self, src)
     }
 
@@ -1038,7 +1038,7 @@ fn sort(&mut self) where T: Ord {
         self.sort_by(|a, b| a.cmp(b))
     }
 
-    fn binary_search(&self, x: &T) -> Result<uint, uint> where T: Ord {
+    fn binary_search(&self, x: &T) -> Result<usize, usize> where T: Ord {
         core_slice::SliceExt::binary_search(self, x)
     }
 
@@ -1050,11 +1050,11 @@ fn prev_permutation(&mut self) -> bool where T: Ord {
         core_slice::SliceExt::prev_permutation(self)
     }
 
-    fn position_elem(&self, t: &T) -> Option<uint> where T: PartialEq {
+    fn position_elem(&self, t: &T) -> Option<usize> where T: PartialEq {
         core_slice::SliceExt::position_elem(self, t)
     }
 
-    fn rposition_elem(&self, t: &T) -> Option<uint> where T: PartialEq {
+    fn rposition_elem(&self, t: &T) -> Option<usize> where T: PartialEq {
         core_slice::SliceExt::rposition_elem(self, t)
     }
 
@@ -1153,13 +1153,13 @@ pub struct ElementSwaps {
     /// If `true`, emit the last swap that returns the sequence to initial
     /// state.
     emit_reset: bool,
-    swaps_made : uint,
+    swaps_made : usize,
 }
 
 impl ElementSwaps {
     /// Creates an `ElementSwaps` iterator for a sequence of `length` elements.
     #[unstable(feature = "collections")]
-    pub fn new(length: uint) -> ElementSwaps {
+    pub fn new(length: usize) -> ElementSwaps {
         // Initialize `sdir` with a direction that position should move in
         // (all negative at the beginning) and the `size` of the
         // element (equal to the original index).
@@ -1200,17 +1200,17 @@ enum Direction { Pos, Neg }
 /// An `Index` and `Direction` together.
 #[derive(Copy, Clone)]
 struct SizeDirection {
-    size: uint,
+    size: usize,
     dir: Direction,
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Iterator for ElementSwaps {
-    type Item = (uint, uint);
+    type Item = (usize, usize);
 
     #[inline]
-    fn next(&mut self) -> Option<(uint, uint)> {
-        fn new_pos(i: uint, s: Direction) -> uint {
+    fn next(&mut self) -> Option<(usize, usize)> {
+        fn new_pos(i: usize, s: Direction) -> usize {
             i + match s { Pos => 1, Neg => -1 }
         }
 
@@ -1252,7 +1252,7 @@ fn new_pos(i: uint, s: Direction) -> uint {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         // For a vector of size n, there are exactly n! permutations.
         let n = (2..self.sdir.len() + 1).product();
         (n - self.swaps_made, Some(n - self.swaps_made))
@@ -1291,7 +1291,7 @@ fn next(&mut self) -> Option<Vec<T>> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         self.swaps.size_hint()
     }
 }
@@ -1332,7 +1332,7 @@ fn insertion_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> O
                 let tmp = ptr::read(read_ptr);
                 ptr::copy_memory(buf_v.offset(j + 1),
                                  &*buf_v.offset(j),
-                                 (i - j) as uint);
+                                 (i - j) as usize);
                 ptr::copy_nonoverlapping_memory(buf_v.offset(j),
                                                 &tmp,
                                                 1);
@@ -1344,8 +1344,8 @@ fn insertion_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> O
 
 fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Ordering {
     // warning: this wildly uses unsafe.
-    static BASE_INSERTION: uint = 32;
-    static LARGE_INSERTION: uint = 16;
+    static BASE_INSERTION: usize = 32;
+    static LARGE_INSERTION: usize = 16;
 
     // FIXME #12092: smaller insertion runs seems to make sorting
     // vectors of large elements a little faster on some platforms,
@@ -1410,7 +1410,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
                 // `.offset(j)` is always in bounds.
                 ptr::copy_memory(buf_dat.offset(j + 1),
                                  &*buf_dat.offset(j),
-                                 i - j as uint);
+                                 i - j as usize);
                 ptr::copy_nonoverlapping_memory(buf_dat.offset(j), read_ptr, 1);
             }
         }
@@ -1458,11 +1458,11 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
                     // case).
                     if left == right_start {
                         // the number remaining in this run.
-                        let elems = (right_end as uint - right as uint) / mem::size_of::<T>();
+                        let elems = (right_end as usize - right as usize) / mem::size_of::<T>();
                         ptr::copy_nonoverlapping_memory(out, &*right, elems);
                         break;
                     } else if right == right_end {
-                        let elems = (right_start as uint - left as uint) / mem::size_of::<T>();
+                        let elems = (right_start as usize - left as usize) / mem::size_of::<T>();
                         ptr::copy_nonoverlapping_memory(out, &*left, elems);
                         break;
                     }
@@ -1506,7 +1506,7 @@ unsafe fn step<T>(ptr: &mut *mut T) -> *mut T {
 #[cfg(test)]
 mod tests {
     use core::cmp::Ordering::{Greater, Less, Equal};
-    use core::prelude::{Some, None, range, Clone};
+    use core::prelude::{Some, None, Clone};
     use core::prelude::{Iterator, IteratorExt};
     use core::prelude::{AsSlice};
     use core::prelude::Ord;
@@ -1519,56 +1519,56 @@ mod tests {
     use vec::Vec;
     use super::{ElementSwaps, SliceConcatExt, SliceExt};
 
-    fn square(n: uint) -> uint { n * n }
+    fn square(n: usize) -> usize { n * n }
 
-    fn is_odd(n: &uint) -> bool { *n % 2u == 1u }
+    fn is_odd(n: &usize) -> bool { *n % 2 == 1 }
 
     #[test]
     fn test_from_fn() {
         // Test on-stack from_fn.
-        let mut v = (0u..3).map(square).collect::<Vec<_>>();
+        let mut v: Vec<_> = (0..3).map(square).collect();
         {
             let v = v;
-            assert_eq!(v.len(), 3u);
-            assert_eq!(v[0], 0u);
-            assert_eq!(v[1], 1u);
-            assert_eq!(v[2], 4u);
+            assert_eq!(v.len(), 3);
+            assert_eq!(v[0], 0);
+            assert_eq!(v[1], 1);
+            assert_eq!(v[2], 4);
         }
 
         // Test on-heap from_fn.
-        v = (0u..5).map(square).collect::<Vec<_>>();
+        v = (0..5).map(square).collect();
         {
             let v = v;
-            assert_eq!(v.len(), 5u);
-            assert_eq!(v[0], 0u);
-            assert_eq!(v[1], 1u);
-            assert_eq!(v[2], 4u);
-            assert_eq!(v[3], 9u);
-            assert_eq!(v[4], 16u);
+            assert_eq!(v.len(), 5);
+            assert_eq!(v[0], 0);
+            assert_eq!(v[1], 1);
+            assert_eq!(v[2], 4);
+            assert_eq!(v[3], 9);
+            assert_eq!(v[4], 16);
         }
     }
 
     #[test]
     fn test_from_elem() {
         // Test on-stack from_elem.
-        let mut v = vec![10u, 10u];
+        let mut v = vec![10, 10];
         {
             let v = v;
-            assert_eq!(v.len(), 2u);
-            assert_eq!(v[0], 10u);
-            assert_eq!(v[1], 10u);
+            assert_eq!(v.len(), 2);
+            assert_eq!(v[0], 10);
+            assert_eq!(v[1], 10);
         }
 
         // Test on-heap from_elem.
-        v = vec![20u, 20u, 20u, 20u, 20u, 20u];
+        v = vec![20; 6];
         {
-            let v = v;
-            assert_eq!(v[0], 20u);
-            assert_eq!(v[1], 20u);
-            assert_eq!(v[2], 20u);
-            assert_eq!(v[3], 20u);
-            assert_eq!(v[4], 20u);
-            assert_eq!(v[5], 20u);
+            let v = v.as_slice();
+            assert_eq!(v[0], 20);
+            assert_eq!(v[1], 20);
+            assert_eq!(v[2], 20);
+            assert_eq!(v[3], 20);
+            assert_eq!(v[4], 20);
+            assert_eq!(v[5], 20);
         }
     }
 
@@ -1624,68 +1624,68 @@ fn test_first_mut() {
     #[test]
     fn test_tail() {
         let mut a = vec![11];
-        let b: &[int] = &[];
+        let b: &[i32] = &[];
         assert_eq!(a.tail(), b);
         a = vec![11, 12];
-        let b: &[int] = &[12];
+        let b: &[i32] = &[12];
         assert_eq!(a.tail(), b);
     }
 
     #[test]
     fn test_tail_mut() {
         let mut a = vec![11];
-        let b: &mut [int] = &mut [];
+        let b: &mut [i32] = &mut [];
         assert!(a.tail_mut() == b);
         a = vec![11, 12];
-        let b: &mut [int] = &mut [12];
+        let b: &mut [_] = &mut [12];
         assert!(a.tail_mut() == b);
     }
 
     #[test]
     #[should_fail]
     fn test_tail_empty() {
-        let a: Vec<int> = vec![];
+        let a = Vec::<i32>::new();
         a.tail();
     }
 
     #[test]
     #[should_fail]
     fn test_tail_mut_empty() {
-        let mut a: Vec<int> = vec![];
+        let mut a = Vec::<i32>::new();
         a.tail_mut();
     }
 
     #[test]
     fn test_init() {
         let mut a = vec![11];
-        let b: &[int] = &[];
+        let b: &[i32] = &[];
         assert_eq!(a.init(), b);
         a = vec![11, 12];
-        let b: &[int] = &[11];
+        let b: &[_] = &[11];
         assert_eq!(a.init(), b);
     }
 
     #[test]
     fn test_init_mut() {
         let mut a = vec![11];
-        let b: &mut [int] = &mut [];
+        let b: &mut [i32] = &mut [];
         assert!(a.init_mut() == b);
         a = vec![11, 12];
-        let b: &mut [int] = &mut [11];
+        let b: &mut [_] = &mut [11];
         assert!(a.init_mut() == b);
     }
 
     #[test]
     #[should_fail]
     fn test_init_empty() {
-        let a: Vec<int> = vec![];
+        let a = Vec::<i32>::new();
         a.init();
     }
 
     #[test]
     #[should_fail]
     fn test_init_mut_empty() {
-        let mut a: Vec<int> = vec![];
+        let mut a = Vec::<i32>::new();
         a.init_mut();
     }
 
@@ -1713,26 +1713,26 @@ fn test_last_mut() {
     fn test_slice() {
         // Test fixed length vector.
         let vec_fixed = [1, 2, 3, 4];
-        let v_a = vec_fixed[1u..vec_fixed.len()].to_vec();
-        assert_eq!(v_a.len(), 3u);
-        let v_a = v_a;
+        let v_a = vec_fixed[1..vec_fixed.len()].to_vec();
+        assert_eq!(v_a.len(), 3);
+
         assert_eq!(v_a[0], 2);
         assert_eq!(v_a[1], 3);
         assert_eq!(v_a[2], 4);
 
         // Test on stack.
         let vec_stack: &[_] = &[1, 2, 3];
-        let v_b = vec_stack[1u..3u].to_vec();
-        assert_eq!(v_b.len(), 2u);
-        let v_b = v_b;
+        let v_b = vec_stack[1..3].to_vec();
+        assert_eq!(v_b.len(), 2);
+
         assert_eq!(v_b[0], 2);
         assert_eq!(v_b[1], 3);
 
         // Test `Box<[T]>`
         let vec_unique = vec![1, 2, 3, 4, 5, 6];
-        let v_d = vec_unique[1u..6u].to_vec();
-        assert_eq!(v_d.len(), 5u);
-        let v_d = v_d;
+        let v_d = vec_unique[1..6].to_vec();
+        assert_eq!(v_d.len(), 5);
+
         assert_eq!(v_d[0], 2);
         assert_eq!(v_d[1], 3);
         assert_eq!(v_d[2], 4);
@@ -1742,21 +1742,21 @@ fn test_slice() {
 
     #[test]
     fn test_slice_from() {
-        let vec: &[int] = &[1, 2, 3, 4];
+        let vec: &[_] = &[1, 2, 3, 4];
         assert_eq!(&vec[], vec);
-        let b: &[int] = &[3, 4];
+        let b: &[_] = &[3, 4];
         assert_eq!(&vec[2..], b);
-        let b: &[int] = &[];
+        let b: &[_] = &[];
         assert_eq!(&vec[4..], b);
     }
 
     #[test]
     fn test_slice_to() {
-        let vec: &[int] = &[1, 2, 3, 4];
+        let vec: &[_] = &[1, 2, 3, 4];
         assert_eq!(&vec[..4], vec);
-        let b: &[int] = &[1, 2];
+        let b: &[_] = &[1, 2];
         assert_eq!(&vec[..2], b);
-        let b: &[int] = &[];
+        let b: &[_] = &[];
         assert_eq!(&vec[..0], b);
     }
 
@@ -1812,12 +1812,12 @@ fn test_push() {
         // Test on-stack push().
         let mut v = vec![];
         v.push(1);
-        assert_eq!(v.len(), 1u);
+        assert_eq!(v.len(), 1);
         assert_eq!(v[0], 1);
 
         // Test on-heap push().
         v.push(2);
-        assert_eq!(v.len(), 2u);
+        assert_eq!(v.len(), 2);
         assert_eq!(v[0], 1);
         assert_eq!(v[1], 2);
     }
@@ -1842,19 +1842,19 @@ fn test_clear() {
 
     #[test]
     fn test_dedup() {
-        fn case(a: Vec<uint>, b: Vec<uint>) {
+        fn case(a: Vec<i32>, b: Vec<i32>) {
             let mut v = a;
             v.dedup();
             assert_eq!(v, b);
         }
         case(vec![], vec![]);
-        case(vec![1u], vec![1]);
-        case(vec![1u,1], vec![1]);
-        case(vec![1u,2,3], vec![1,2,3]);
-        case(vec![1u,1,2,3], vec![1,2,3]);
-        case(vec![1u,2,2,3], vec![1,2,3]);
-        case(vec![1u,2,3,3], vec![1,2,3]);
-        case(vec![1u,1,2,2,2,3,3], vec![1,2,3]);
+        case(vec![1], vec![1]);
+        case(vec![1,1], vec![1]);
+        case(vec![1,2,3], vec![1,2,3]);
+        case(vec![1,1,2,3], vec![1,2,3]);
+        case(vec![1,2,2,3], vec![1,2,3]);
+        case(vec![1,2,3,3], vec![1,2,3]);
+        case(vec![1,1,2,2,2,3,3], vec![1,2,3]);
     }
 
     #[test]
@@ -1887,9 +1887,9 @@ fn test_dedup_shared() {
 
     #[test]
     fn test_retain() {
-        let mut v = vec![1u, 2, 3, 4, 5];
+        let mut v = vec![1, 2, 3, 4, 5];
         v.retain(is_odd);
-        assert_eq!(v, vec![1u, 3, 5]);
+        assert_eq!(v, vec![1, 3, 5]);
     }
 
     #[test]
@@ -1964,56 +1964,56 @@ fn test_permutations() {
 
     #[test]
     fn test_lexicographic_permutations() {
-        let v : &mut[int] = &mut[1, 2, 3, 4, 5];
+        let v : &mut[_] = &mut[1, 2, 3, 4, 5];
         assert!(v.prev_permutation() == false);
         assert!(v.next_permutation());
-        let b: &mut[int] = &mut[1, 2, 3, 5, 4];
+        let b: &mut[_] = &mut[1, 2, 3, 5, 4];
         assert!(v == b);
         assert!(v.prev_permutation());
-        let b: &mut[int] = &mut[1, 2, 3, 4, 5];
+        let b: &mut[_] = &mut[1, 2, 3, 4, 5];
         assert!(v == b);
         assert!(v.next_permutation());
         assert!(v.next_permutation());
-        let b: &mut[int] = &mut[1, 2, 4, 3, 5];
+        let b: &mut[_] = &mut[1, 2, 4, 3, 5];
         assert!(v == b);
         assert!(v.next_permutation());
-        let b: &mut[int] = &mut[1, 2, 4, 5, 3];
+        let b: &mut[_] = &mut[1, 2, 4, 5, 3];
         assert!(v == b);
 
-        let v : &mut[int] = &mut[1, 0, 0, 0];
+        let v : &mut[_] = &mut[1, 0, 0, 0];
         assert!(v.next_permutation() == false);
         assert!(v.prev_permutation());
-        let b: &mut[int] = &mut[0, 1, 0, 0];
+        let b: &mut[_] = &mut[0, 1, 0, 0];
         assert!(v == b);
         assert!(v.prev_permutation());
-        let b: &mut[int] = &mut[0, 0, 1, 0];
+        let b: &mut[_] = &mut[0, 0, 1, 0];
         assert!(v == b);
         assert!(v.prev_permutation());
-        let b: &mut[int] = &mut[0, 0, 0, 1];
+        let b: &mut[_] = &mut[0, 0, 0, 1];
         assert!(v == b);
         assert!(v.prev_permutation() == false);
     }
 
     #[test]
     fn test_lexicographic_permutations_empty_and_short() {
-        let empty : &mut[int] = &mut[];
+        let empty : &mut[i32] = &mut[];
         assert!(empty.next_permutation() == false);
-        let b: &mut[int] = &mut[];
+        let b: &mut[i32] = &mut[];
         assert!(empty == b);
         assert!(empty.prev_permutation() == false);
         assert!(empty == b);
 
-        let one_elem : &mut[int] = &mut[4];
+        let one_elem : &mut[_] = &mut[4];
         assert!(one_elem.prev_permutation() == false);
-        let b: &mut[int] = &mut[4];
+        let b: &mut[_] = &mut[4];
         assert!(one_elem == b);
         assert!(one_elem.next_permutation() == false);
         assert!(one_elem == b);
 
-        let two_elem : &mut[int] = &mut[1, 2];
+        let two_elem : &mut[_] = &mut[1, 2];
         assert!(two_elem.prev_permutation() == false);
-        let b : &mut[int] = &mut[1, 2];
-        let c : &mut[int] = &mut[2, 1];
+        let b : &mut[_] = &mut[1, 2];
+        let c : &mut[_] = &mut[2, 1];
         assert!(two_elem == b);
         assert!(two_elem.next_permutation());
         assert!(two_elem == c);
@@ -2030,9 +2030,9 @@ fn test_position_elem() {
         assert!([].position_elem(&1).is_none());
 
         let v1 = vec![1, 2, 3, 3, 2, 5];
-        assert_eq!(v1.position_elem(&1), Some(0u));
-        assert_eq!(v1.position_elem(&2), Some(1u));
-        assert_eq!(v1.position_elem(&5), Some(5u));
+        assert_eq!(v1.position_elem(&1), Some(0));
+        assert_eq!(v1.position_elem(&2), Some(1));
+        assert_eq!(v1.position_elem(&5), Some(5));
         assert!(v1.position_elem(&4).is_none());
     }
 
@@ -2083,24 +2083,23 @@ fn test_binary_search() {
 
     #[test]
     fn test_reverse() {
-        let mut v: Vec<int> = vec![10, 20];
+        let mut v = vec![10, 20];
         assert_eq!(v[0], 10);
         assert_eq!(v[1], 20);
         v.reverse();
         assert_eq!(v[0], 20);
         assert_eq!(v[1], 10);
 
-        let mut v3: Vec<int> = vec![];
+        let mut v3 = Vec::<i32>::new();
         v3.reverse();
         assert!(v3.is_empty());
     }
 
     #[test]
     fn test_sort() {
-        for len in 4u..25 {
+        for len in 4..25 {
             for _ in 0..100 {
-                let mut v = thread_rng().gen_iter::<uint>().take(len)
-                                      .collect::<Vec<uint>>();
+                let mut v: Vec<_> = thread_rng().gen_iter::<i32>().take(len).collect();
                 let mut v1 = v.clone();
 
                 v.sort();
@@ -2115,10 +2114,10 @@ fn test_sort() {
         }
 
         // shouldn't panic
-        let mut v: [uint; 0] = [];
+        let mut v: [i32; 0] = [];
         v.sort();
 
-        let mut v = [0xDEADBEEFu];
+        let mut v = [0xDEADBEEFu64];
         v.sort();
         assert!(v == [0xDEADBEEF]);
     }
@@ -2126,7 +2125,7 @@ fn test_sort() {
     #[test]
     fn test_sort_stability() {
         for len in 4..25 {
-            for _ in 0u..10 {
+            for _ in 0..10 {
                 let mut counts = [0; 10];
 
                 // create a vector like [(6, 1), (5, 1), (6, 2), ...],
@@ -2134,11 +2133,11 @@ fn test_sort_stability() {
                 // the second item represents which occurrence of that
                 // number this element is, i.e. the second elements
                 // will occur in sorted order.
-                let mut v = (0..len).map(|_| {
-                        let n = thread_rng().gen::<uint>() % 10;
+                let mut v: Vec<_> = (0..len).map(|_| {
+                        let n = thread_rng().gen::<usize>() % 10;
                         counts[n] += 1;
                         (n, counts[n])
-                    }).collect::<Vec<(uint, int)>>();
+                    }).collect();
 
                 // only sort on the first element, so an unstable sort
                 // may mix up the counts.
@@ -2156,28 +2155,28 @@ fn test_sort_stability() {
 
     #[test]
     fn test_concat() {
-        let v: [Vec<int>; 0] = [];
-        let c: Vec<int> = v.concat();
+        let v: [Vec<i32>; 0] = [];
+        let c = v.concat();
         assert_eq!(c, []);
-        let d: Vec<int> = [vec![1], vec![2,3]].concat();
+        let d = [vec![1], vec![2,3]].concat();
         assert_eq!(d, vec![1, 2, 3]);
 
-        let v: [&[int]; 2] = [&[1], &[2, 3]];
+        let v: &[&[_]] = &[&[1], &[2, 3]];
         assert_eq!(v.connect(&0), vec![1, 0, 2, 3]);
-        let v: [&[int]; 3] = [&[1], &[2], &[3]];
+        let v: &[&[_]] = &[&[1], &[2], &[3]];
         assert_eq!(v.connect(&0), vec![1, 0, 2, 0, 3]);
     }
 
     #[test]
     fn test_connect() {
-        let v: [Vec<int>; 0] = [];
+        let v: [Vec<i32>; 0] = [];
         assert_eq!(v.connect(&0), vec![]);
         assert_eq!([vec![1], vec![2, 3]].connect(&0), vec![1, 0, 2, 3]);
         assert_eq!([vec![1], vec![2], vec![3]].connect(&0), vec![1, 0, 2, 0, 3]);
 
-        let v: [&[int]; 2] = [&[1], &[2, 3]];
+        let v: [&[_]; 2] = [&[1], &[2, 3]];
         assert_eq!(v.connect(&0), vec![1, 0, 2, 3]);
-        let v: [&[int]; 3] = [&[1], &[2], &[3]];
+        let v: [&[_]; 3] = [&[1], &[2], &[3]];
         assert_eq!(v.connect(&0), vec![1, 0, 2, 0, 3]);
     }
 
@@ -2209,13 +2208,13 @@ fn test_insert_oob() {
 
     #[test]
     fn test_remove() {
-        let mut a = vec![1,2,3,4];
+        let mut a = vec![1, 2, 3, 4];
 
         assert_eq!(a.remove(2), 3);
-        assert_eq!(a, vec![1,2,4]);
+        assert_eq!(a, vec![1, 2, 4]);
 
         assert_eq!(a.remove(2), 4);
-        assert_eq!(a, vec![1,2]);
+        assert_eq!(a, vec![1, 2]);
 
         assert_eq!(a.remove(0), 1);
         assert_eq!(a, vec![2]);
@@ -2234,19 +2233,16 @@ fn test_remove_fail() {
 
     #[test]
     fn test_capacity() {
-        let mut v = vec![0u64];
-        v.reserve_exact(10u);
-        assert!(v.capacity() >= 11u);
-        let mut v = vec![0u32];
-        v.reserve_exact(10u);
-        assert!(v.capacity() >= 11u);
+        let mut v = vec![0];
+        v.reserve_exact(10);
+        assert!(v.capacity() >= 11);
     }
 
     #[test]
     fn test_slice_2() {
         let v = vec![1, 2, 3, 4, 5];
-        let v = v.slice(1u, 3u);
-        assert_eq!(v.len(), 2u);
+        let v = v.slice(1, 3);
+        assert_eq!(v.len(), 2);
         assert_eq!(v[0], 2);
         assert_eq!(v[1], 3);
     }
@@ -2256,7 +2252,7 @@ fn test_slice_2() {
     fn test_permute_fail() {
         let v = [(box 0, Rc::new(0)), (box 0, Rc::new(0)),
                  (box 0, Rc::new(0)), (box 0, Rc::new(0))];
-        let mut i = 0u;
+        let mut i = 0;
         for _ in v.permutations() {
             if i == 2 {
                 panic!()
@@ -2267,15 +2263,15 @@ fn test_permute_fail() {
 
     #[test]
     fn test_total_ord() {
-        let c: &[int] = &[1, 2, 3];
+        let c = &[1, 2, 3];
         [1, 2, 3, 4][].cmp(c) == Greater;
-        let c: &[int] = &[1, 2, 3, 4];
+        let c = &[1, 2, 3, 4];
         [1, 2, 3][].cmp(c) == Less;
-        let c: &[int] = &[1, 2, 3, 6];
+        let c = &[1, 2, 3, 6];
         [1, 2, 3, 4][].cmp(c) == Equal;
-        let c: &[int] = &[1, 2, 3, 4, 5, 6];
+        let c = &[1, 2, 3, 4, 5, 6];
         [1, 2, 3, 4, 5, 5, 5, 5][].cmp(c) == Less;
-        let c: &[int] = &[1, 2, 3, 4];
+        let c = &[1, 2, 3, 4];
         [2, 2][].cmp(c) == Greater;
     }
 
@@ -2387,76 +2383,76 @@ fn test_mut_rev_iterator() {
     #[test]
     fn test_move_iterator() {
         let xs = vec![1u,2,3,4,5];
-        assert_eq!(xs.into_iter().fold(0, |a: uint, b: uint| 10*a + b), 12345);
+        assert_eq!(xs.into_iter().fold(0, |a: usize, b: usize| 10*a + b), 12345);
     }
 
     #[test]
     fn test_move_rev_iterator() {
         let xs = vec![1u,2,3,4,5];
-        assert_eq!(xs.into_iter().rev().fold(0, |a: uint, b: uint| 10*a + b), 54321);
+        assert_eq!(xs.into_iter().rev().fold(0, |a: usize, b: usize| 10*a + b), 54321);
     }
 
     #[test]
     fn test_splitator() {
         let xs = &[1,2,3,4,5];
 
-        let splits: &[&[int]] = &[&[1], &[3], &[5]];
-        assert_eq!(xs.split(|x| *x % 2 == 0).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[1], &[3], &[5]];
+        assert_eq!(xs.split(|x| *x % 2 == 0).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[], &[2,3,4,5]];
-        assert_eq!(xs.split(|x| *x == 1).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[], &[2,3,4,5]];
+        assert_eq!(xs.split(|x| *x == 1).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[1,2,3,4], &[]];
-        assert_eq!(xs.split(|x| *x == 5).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[1,2,3,4], &[]];
+        assert_eq!(xs.split(|x| *x == 5).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[1,2,3,4,5]];
-        assert_eq!(xs.split(|x| *x == 10).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[1,2,3,4,5]];
+        assert_eq!(xs.split(|x| *x == 10).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[], &[], &[], &[], &[], &[]];
-        assert_eq!(xs.split(|_| true).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[], &[], &[], &[], &[], &[]];
+        assert_eq!(xs.split(|_| true).collect::<Vec<&[i32]>>(),
                    splits);
 
-        let xs: &[int] = &[];
-        let splits: &[&[int]] = &[&[]];
-        assert_eq!(xs.split(|x| *x == 5).collect::<Vec<&[int]>>(), splits);
+        let xs: &[i32] = &[];
+        let splits: &[&[i32]] = &[&[]];
+        assert_eq!(xs.split(|x| *x == 5).collect::<Vec<&[i32]>>(), splits);
     }
 
     #[test]
     fn test_splitnator() {
         let xs = &[1,2,3,4,5];
 
-        let splits: &[&[int]] = &[&[1,2,3,4,5]];
-        assert_eq!(xs.splitn(0, |x| *x % 2 == 0).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[1,2,3,4,5]];
+        assert_eq!(xs.splitn(0, |x| *x % 2 == 0).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[1], &[3,4,5]];
-        assert_eq!(xs.splitn(1, |x| *x % 2 == 0).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[1], &[3,4,5]];
+        assert_eq!(xs.splitn(1, |x| *x % 2 == 0).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[], &[], &[], &[4,5]];
-        assert_eq!(xs.splitn(3, |_| true).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[], &[], &[], &[4,5]];
+        assert_eq!(xs.splitn(3, |_| true).collect::<Vec<_>>(),
                    splits);
 
-        let xs: &[int] = &[];
-        let splits: &[&[int]] = &[&[]];
-        assert_eq!(xs.splitn(1, |x| *x == 5).collect::<Vec<&[int]>>(), splits);
+        let xs: &[i32] = &[];
+        let splits: &[&[i32]] = &[&[]];
+        assert_eq!(xs.splitn(1, |x| *x == 5).collect::<Vec<_>>(), splits);
     }
 
     #[test]
     fn test_splitnator_mut() {
         let xs = &mut [1,2,3,4,5];
 
-        let splits: &[&mut [int]] = &[&mut [1,2,3,4,5]];
-        assert_eq!(xs.splitn_mut(0, |x| *x % 2 == 0).collect::<Vec<&mut [int]>>(),
+        let splits: &[&mut[_]] = &[&mut [1,2,3,4,5]];
+        assert_eq!(xs.splitn_mut(0, |x| *x % 2 == 0).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&mut [int]] = &[&mut [1], &mut [3,4,5]];
-        assert_eq!(xs.splitn_mut(1, |x| *x % 2 == 0).collect::<Vec<&mut [int]>>(),
+        let splits: &[&mut[_]] = &[&mut [1], &mut [3,4,5]];
+        assert_eq!(xs.splitn_mut(1, |x| *x % 2 == 0).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&mut [int]] = &[&mut [], &mut [], &mut [], &mut [4,5]];
-        assert_eq!(xs.splitn_mut(3, |_| true).collect::<Vec<&mut [int]>>(),
+        let splits: &[&mut[_]] = &[&mut [], &mut [], &mut [], &mut [4,5]];
+        assert_eq!(xs.splitn_mut(3, |_| true).collect::<Vec<_>>(),
                    splits);
 
-        let xs: &mut [int] = &mut [];
-        let splits: &[&mut [int]] = &[&mut []];
-        assert_eq!(xs.splitn_mut(1, |x| *x == 5).collect::<Vec<&mut [int]>>(),
+        let xs: &mut [i32] = &mut [];
+        let splits: &[&mut[i32]] = &[&mut []];
+        assert_eq!(xs.splitn_mut(1, |x| *x == 5).collect::<Vec<_>>(),
                    splits);
     }
 
@@ -2464,51 +2460,52 @@ fn test_splitnator_mut() {
     fn test_rsplitator() {
         let xs = &[1,2,3,4,5];
 
-        let splits: &[&[int]] = &[&[5], &[3], &[1]];
-        assert_eq!(xs.split(|x| *x % 2 == 0).rev().collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[5], &[3], &[1]];
+        assert_eq!(xs.split(|x| *x % 2 == 0).rev().collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[2,3,4,5], &[]];
-        assert_eq!(xs.split(|x| *x == 1).rev().collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[2,3,4,5], &[]];
+        assert_eq!(xs.split(|x| *x == 1).rev().collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[], &[1,2,3,4]];
-        assert_eq!(xs.split(|x| *x == 5).rev().collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[], &[1,2,3,4]];
+        assert_eq!(xs.split(|x| *x == 5).rev().collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[1,2,3,4,5]];
-        assert_eq!(xs.split(|x| *x == 10).rev().collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[1,2,3,4,5]];
+        assert_eq!(xs.split(|x| *x == 10).rev().collect::<Vec<_>>(),
                    splits);
 
-        let xs: &[int] = &[];
-        let splits: &[&[int]] = &[&[]];
-        assert_eq!(xs.split(|x| *x == 5).rev().collect::<Vec<&[int]>>(), splits);
+        let xs: &[i32] = &[];
+        let splits: &[&[i32]] = &[&[]];
+        assert_eq!(xs.split(|x| *x == 5).rev().collect::<Vec<&[i32]>>(), splits);
     }
 
     #[test]
     fn test_rsplitnator() {
         let xs = &[1,2,3,4,5];
 
-        let splits: &[&[int]] = &[&[1,2,3,4,5]];
-        assert_eq!(xs.rsplitn(0, |x| *x % 2 == 0).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[1,2,3,4,5]];
+        assert_eq!(xs.rsplitn(0, |x| *x % 2 == 0).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[5], &[1,2,3]];
-        assert_eq!(xs.rsplitn(1, |x| *x % 2 == 0).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[5], &[1,2,3]];
+        assert_eq!(xs.rsplitn(1, |x| *x % 2 == 0).collect::<Vec<_>>(),
                    splits);
-        let splits: &[&[int]] = &[&[], &[], &[], &[1,2]];
-        assert_eq!(xs.rsplitn(3, |_| true).collect::<Vec<&[int]>>(),
+        let splits: &[&[_]] = &[&[], &[], &[], &[1,2]];
+        assert_eq!(xs.rsplitn(3, |_| true).collect::<Vec<_>>(),
                    splits);
 
-        let xs: &[int] = &[];
-        let splits: &[&[int]] = &[&[]];
-        assert_eq!(xs.rsplitn(1, |x| *x == 5).collect::<Vec<&[int]>>(), splits);
+        let xs: &[i32]  = &[];
+        let splits: &[&[i32]] = &[&[]];
+        assert_eq!(xs.rsplitn(1, |x| *x == 5).collect::<Vec<&[i32]>>(), splits);
     }
 
     #[test]
     fn test_windowsator() {
         let v = &[1,2,3,4];
 
-        let wins: &[&[int]] = &[&[1,2], &[2,3], &[3,4]];
-        assert_eq!(v.windows(2).collect::<Vec<&[int]>>(), wins);
-        let wins: &[&[int]] = &[&[1,2,3], &[2,3,4]];
-        assert_eq!(v.windows(3).collect::<Vec<&[int]>>(), wins);
+        let wins: &[&[_]] = &[&[1,2], &[2,3], &[3,4]];
+        assert_eq!(v.windows(2).collect::<Vec<_>>(), wins);
+
+        let wins: &[&[_]] = &[&[1,2,3], &[2,3,4]];
+        assert_eq!(v.windows(3).collect::<Vec<_>>(), wins);
         assert!(v.windows(6).next().is_none());
     }
 
@@ -2527,22 +2524,23 @@ fn test_chunksator() {
 
         assert_eq!(v.chunks(2).len(), 3);
 
-        let chunks: &[&[int]] = &[&[1,2], &[3,4], &[5]];
-        assert_eq!(v.chunks(2).collect::<Vec<&[int]>>(), chunks);
-        let chunks: &[&[int]] = &[&[1,2,3], &[4,5]];
-        assert_eq!(v.chunks(3).collect::<Vec<&[int]>>(), chunks);
-        let chunks: &[&[int]] = &[&[1,2,3,4,5]];
-        assert_eq!(v.chunks(6).collect::<Vec<&[int]>>(), chunks);
+        let chunks: &[&[_]] = &[&[1,2], &[3,4], &[5]];
+        assert_eq!(v.chunks(2).collect::<Vec<_>>(), chunks);
+        let chunks: &[&[_]] = &[&[1,2,3], &[4,5]];
+        assert_eq!(v.chunks(3).collect::<Vec<_>>(), chunks);
+        let chunks: &[&[_]] = &[&[1,2,3,4,5]];
+        assert_eq!(v.chunks(6).collect::<Vec<_>>(), chunks);
 
-        let chunks: &[&[int]] = &[&[5], &[3,4], &[1,2]];
-        assert_eq!(v.chunks(2).rev().collect::<Vec<&[int]>>(), chunks);
+        let chunks: &[&[_]] = &[&[5], &[3,4], &[1,2]];
+        assert_eq!(v.chunks(2).rev().collect::<Vec<_>>(), chunks);
         let mut it = v.chunks(2);
         assert_eq!(it.indexable(), 3);
-        let chunk: &[int] = &[1,2];
+
+        let chunk: &[_] = &[1,2];
         assert_eq!(it.idx(0).unwrap(), chunk);
-        let chunk: &[int] = &[3,4];
+        let chunk: &[_] = &[3,4];
         assert_eq!(it.idx(1).unwrap(), chunk);
-        let chunk: &[int] = &[5];
+        let chunk: &[_] = &[5];
         assert_eq!(it.idx(2).unwrap(), chunk);
         assert_eq!(it.idx(3), None);
     }
@@ -2590,20 +2588,20 @@ macro_rules! test_show_vec {
                 assert_eq!(format!("{:?}", x), x_str);
             })
         }
-        let empty: Vec<int> = vec![];
+        let empty = Vec::<i32>::new();
         test_show_vec!(empty, "[]");
         test_show_vec!(vec![1], "[1]");
         test_show_vec!(vec![1, 2, 3], "[1, 2, 3]");
         test_show_vec!(vec![vec![], vec![1u], vec![1u, 1u]],
                        "[[], [1], [1, 1]]");
 
-        let empty_mut: &mut [int] = &mut[];
+        let empty_mut: &mut [i32] = &mut[];
         test_show_vec!(empty_mut, "[]");
-        let v: &mut[int] = &mut[1];
+        let v = &mut[1];
         test_show_vec!(v, "[1]");
-        let v: &mut[int] = &mut[1, 2, 3];
+        let v = &mut[1, 2, 3];
         test_show_vec!(v, "[1, 2, 3]");
-        let v: &mut [&mut[uint]] = &mut[&mut[], &mut[1u], &mut[1u, 1u]];
+        let v: &mut[&mut[_]] = &mut[&mut[], &mut[1u], &mut[1u, 1u]];
         test_show_vec!(v, "[[], [1], [1, 1]]");
     }
 
@@ -2616,8 +2614,8 @@ macro_rules! t {
             }}
         }
 
-        t!(&[int]);
-        t!(Vec<int>);
+        t!(&[i32]);
+        t!(Vec<i32>);
     }
 
     #[test]
@@ -2829,15 +2827,15 @@ fn test_mut_last() {
         let h = x.last_mut();
         assert_eq!(*h.unwrap(), 5);
 
-        let y: &mut [int] = &mut [];
+        let y: &mut [i32] = &mut [];
         assert!(y.last_mut().is_none());
     }
 
     #[test]
     fn test_to_vec() {
-        let xs = box [1u, 2, 3];
+        let xs = box [1, 2, 3];
         let ys = xs.to_vec();
-        assert_eq!(ys, [1u, 2, 3]);
+        assert_eq!(ys, [1, 2, 3]);
     }
 }
 
@@ -2854,7 +2852,7 @@ mod bench {
     fn iterator(b: &mut Bencher) {
         // peculiar numbers to stop LLVM from optimising the summation
         // out.
-        let v = (0u..100).map(|i| i ^ (i << 1) ^ (i >> 1)).collect::<Vec<_>>();
+        let v: Vec<_> = (0..100).map(|i| i ^ (i << 1) ^ (i >> 1)).collect();
 
         b.iter(|| {
             let mut sum = 0;
@@ -2868,7 +2866,7 @@ fn iterator(b: &mut Bencher) {
 
     #[bench]
     fn mut_iterator(b: &mut Bencher) {
-        let mut v = repeat(0).take(100).collect::<Vec<_>>();
+        let mut v: Vec<_> = repeat(0).take(100).collect();
 
         b.iter(|| {
             let mut i = 0;
@@ -2881,8 +2879,8 @@ fn mut_iterator(b: &mut Bencher) {
 
     #[bench]
     fn concat(b: &mut Bencher) {
-        let xss: Vec<Vec<uint>> =
-            (0..100u).map(|i| (0..i).collect()).collect();
+        let xss: Vec<Vec<i32>> =
+            (0..100).map(|i| (0..i).collect()).collect();
         b.iter(|| {
             xss.concat();
         });
@@ -2890,8 +2888,8 @@ fn concat(b: &mut Bencher) {
 
     #[bench]
     fn connect(b: &mut Bencher) {
-        let xss: Vec<Vec<uint>> =
-            (0..100u).map(|i| (0..i).collect()).collect();
+        let xss: Vec<Vec<i32>> =
+            (0..100).map(|i| (0..i).collect()).collect();
         b.iter(|| {
             xss.connect(&0)
         });
@@ -2899,7 +2897,7 @@ fn connect(b: &mut Bencher) {
 
     #[bench]
     fn push(b: &mut Bencher) {
-        let mut vec: Vec<uint> = vec![];
+        let mut vec = Vec::<i32>::new();
         b.iter(|| {
             vec.push(0);
             black_box(&vec);
@@ -2908,7 +2906,7 @@ fn push(b: &mut Bencher) {
 
     #[bench]
     fn starts_with_same_vector(b: &mut Bencher) {
-        let vec: Vec<uint> = (0u..100).collect();
+        let vec: Vec<_> = (0..100).collect();
         b.iter(|| {
             vec.starts_with(&vec)
         })
@@ -2916,7 +2914,7 @@ fn starts_with_same_vector(b: &mut Bencher) {
 
     #[bench]
     fn starts_with_single_element(b: &mut Bencher) {
-        let vec: Vec<uint> = vec![0];
+        let vec: Vec<_> = vec![0];
         b.iter(|| {
             vec.starts_with(&vec)
         })
@@ -2924,8 +2922,8 @@ fn starts_with_single_element(b: &mut Bencher) {
 
     #[bench]
     fn starts_with_diff_one_element_at_end(b: &mut Bencher) {
-        let vec: Vec<uint> = (0u..100).collect();
-        let mut match_vec: Vec<uint> = (0u..99).collect();
+        let vec: Vec<_> = (0..100).collect();
+        let mut match_vec: Vec<_> = (0..99).collect();
         match_vec.push(0);
         b.iter(|| {
             vec.starts_with(&match_vec)
@@ -2934,7 +2932,7 @@ fn starts_with_diff_one_element_at_end(b: &mut Bencher) {
 
     #[bench]
     fn ends_with_same_vector(b: &mut Bencher) {
-        let vec: Vec<uint> = (0u..100).collect();
+        let vec: Vec<_> = (0..100).collect();
         b.iter(|| {
             vec.ends_with(&vec)
         })
@@ -2942,7 +2940,7 @@ fn ends_with_same_vector(b: &mut Bencher) {
 
     #[bench]
     fn ends_with_single_element(b: &mut Bencher) {
-        let vec: Vec<uint> = vec![0];
+        let vec: Vec<_> = vec![0];
         b.iter(|| {
             vec.ends_with(&vec)
         })
@@ -2950,8 +2948,8 @@ fn ends_with_single_element(b: &mut Bencher) {
 
     #[bench]
     fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) {
-        let vec: Vec<uint> = (0u..100).collect();
-        let mut match_vec: Vec<uint> = (0u..100).collect();
+        let vec: Vec<_> = (0..100).collect();
+        let mut match_vec: Vec<_> = (0..100).collect();
         match_vec[0] = 200;
         b.iter(|| {
             vec.starts_with(&match_vec)
@@ -2960,9 +2958,9 @@ fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) {
 
     #[bench]
     fn contains_last_element(b: &mut Bencher) {
-        let vec: Vec<uint> = (0u..100).collect();
+        let vec: Vec<_> = (0..100).collect();
         b.iter(|| {
-            vec.contains(&99u)
+            vec.contains(&99)
         })
     }
 
@@ -2976,7 +2974,7 @@ fn zero_1kb_from_elem(b: &mut Bencher) {
     #[bench]
     fn zero_1kb_set_memory(b: &mut Bencher) {
         b.iter(|| {
-            let mut v: Vec<uint> = Vec::with_capacity(1024);
+            let mut v = Vec::<u8>::with_capacity(1024);
             unsafe {
                 let vp = v.as_mut_ptr();
                 ptr::set_memory(vp, 0, 1024);
@@ -2989,11 +2987,11 @@ fn zero_1kb_set_memory(b: &mut Bencher) {
     #[bench]
     fn zero_1kb_loop_set(b: &mut Bencher) {
         b.iter(|| {
-            let mut v: Vec<uint> = Vec::with_capacity(1024);
+            let mut v = Vec::<u8>::with_capacity(1024);
             unsafe {
                 v.set_len(1024);
             }
-            for i in 0u..1024 {
+            for i in 0..1024 {
                 v[i] = 0;
             }
         });
@@ -3002,7 +3000,7 @@ fn zero_1kb_loop_set(b: &mut Bencher) {
     #[bench]
     fn zero_1kb_mut_iter(b: &mut Bencher) {
         b.iter(|| {
-            let mut v = Vec::with_capacity(1024);
+            let mut v = Vec::<u8>::with_capacity(1024);
             unsafe {
                 v.set_len(1024);
             }
@@ -3017,10 +3015,10 @@ fn zero_1kb_mut_iter(b: &mut Bencher) {
     fn random_inserts(b: &mut Bencher) {
         let mut rng = weak_rng();
         b.iter(|| {
-            let mut v = repeat((0u, 0u)).take(30).collect::<Vec<_>>();
+            let mut v: Vec<_> = repeat((0, 0)).take(30).collect();
             for _ in 0u..100 {
                 let l = v.len();
-                v.insert(rng.gen::<uint>() % (l + 1),
+                v.insert(rng.gen::<usize>() % (l + 1),
                          (1, 1));
             }
         })
@@ -3029,10 +3027,10 @@ fn random_inserts(b: &mut Bencher) {
     fn random_removes(b: &mut Bencher) {
         let mut rng = weak_rng();
         b.iter(|| {
-            let mut v = repeat((0u, 0u)).take(130).collect::<Vec<_>>();
+            let mut v: Vec<_> = repeat((0, 0)).take(130).collect();
             for _ in 0u..100 {
                 let l = v.len();
-                v.remove(rng.gen::<uint>() % l);
+                v.remove(rng.gen::<usize>() % l);
             }
         })
     }
@@ -3041,7 +3039,7 @@ fn random_removes(b: &mut Bencher) {
     fn sort_random_small(b: &mut Bencher) {
         let mut rng = weak_rng();
         b.iter(|| {
-            let mut v = rng.gen_iter::<u64>().take(5).collect::<Vec<u64>>();
+            let mut v: Vec<_> = rng.gen_iter::<u64>().take(5).collect();
             v.sort();
         });
         b.bytes = 5 * mem::size_of::<u64>() as u64;
@@ -3051,7 +3049,7 @@ fn sort_random_small(b: &mut Bencher) {
     fn sort_random_medium(b: &mut Bencher) {
         let mut rng = weak_rng();
         b.iter(|| {
-            let mut v = rng.gen_iter::<u64>().take(100).collect::<Vec<u64>>();
+            let mut v: Vec<_> = rng.gen_iter::<u64>().take(100).collect();
             v.sort();
         });
         b.bytes = 100 * mem::size_of::<u64>() as u64;
@@ -3061,7 +3059,7 @@ fn sort_random_medium(b: &mut Bencher) {
     fn sort_random_large(b: &mut Bencher) {
         let mut rng = weak_rng();
         b.iter(|| {
-            let mut v = rng.gen_iter::<u64>().take(10000).collect::<Vec<u64>>();
+            let mut v: Vec<_> = rng.gen_iter::<u64>().take(10000).collect();
             v.sort();
         });
         b.bytes = 10000 * mem::size_of::<u64>() as u64;
@@ -3069,14 +3067,14 @@ fn sort_random_large(b: &mut Bencher) {
 
     #[bench]
     fn sort_sorted(b: &mut Bencher) {
-        let mut v = (0u..10000).collect::<Vec<_>>();
+        let mut v: Vec<_> = (0..10000).collect();
         b.iter(|| {
             v.sort();
         });
         b.bytes = (v.len() * mem::size_of_val(&v[0])) as u64;
     }
 
-    type BigSortable = (u64,u64,u64,u64);
+    type BigSortable = (u64, u64, u64, u64);
 
     #[bench]
     fn sort_big_random_small(b: &mut Bencher) {
@@ -3113,7 +3111,7 @@ fn sort_big_random_large(b: &mut Bencher) {
 
     #[bench]
     fn sort_big_sorted(b: &mut Bencher) {
-        let mut v = (0..10000u).map(|i| (i, i, i, i)).collect::<Vec<_>>();
+        let mut v: Vec<BigSortable> = (0..10000).map(|i| (i, i, i, i)).collect();
         b.iter(|| {
             v.sort();
         });
index 336d9fcf5da1eb9b0419d64e459fe8db3cfa8514..e6fb3005ff38cabc73de77ee47bacace74444b4a 100644 (file)
@@ -241,7 +241,7 @@ fn next(&mut self) -> Option<char> {
         }
     }
 
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let (lower, _) = self.iter.size_hint();
         (lower, None)
     }
@@ -367,7 +367,7 @@ impl<'a> Iterator for Utf16Units<'a> {
     fn next(&mut self) -> Option<u16> { self.encoder.next() }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) { self.encoder.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.encoder.size_hint() }
 }
 
 /*
@@ -629,7 +629,7 @@ fn split<P: CharEq>(&self, pat: P) -> Split<P> {
     /// assert_eq!(v, vec![""]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn splitn<P: CharEq>(&self, count: uint, pat: P) -> SplitN<P> {
+    fn splitn<P: CharEq>(&self, count: usize, pat: P) -> SplitN<P> {
         core_str::StrExt::splitn(&self[], count, pat)
     }
 
@@ -679,7 +679,7 @@ fn split_terminator<P: CharEq>(&self, pat: P) -> SplitTerminator<P> {
     /// assert_eq!(v, vec!["leopard", "tiger", "lionX"]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn rsplitn<P: CharEq>(&self, count: uint, pat: P) -> RSplitN<P> {
+    fn rsplitn<P: CharEq>(&self, count: usize, pat: P) -> RSplitN<P> {
         core_str::StrExt::rsplitn(&self[], count, pat)
     }
 
@@ -694,13 +694,13 @@ fn rsplitn<P: CharEq>(&self, count: uint, pat: P) -> RSplitN<P> {
     /// # Example
     ///
     /// ```rust
-    /// let v: Vec<(uint, uint)> = "abcXXXabcYYYabc".match_indices("abc").collect();
+    /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect();
     /// assert_eq!(v, vec![(0,3), (6,9), (12,15)]);
     ///
-    /// let v: Vec<(uint, uint)> = "1abcabc2".match_indices("abc").collect();
+    /// let v: Vec<(usize, usize)> = "1abcabc2".match_indices("abc").collect();
     /// assert_eq!(v, vec![(1,4), (4,7)]);
     ///
-    /// let v: Vec<(uint, uint)> = "ababa".match_indices("aba").collect();
+    /// let v: Vec<(usize, usize)> = "ababa".match_indices("aba").collect();
     /// assert_eq!(v, vec![(0, 3)]); // only the first `aba`
     /// ```
     #[unstable(feature = "collections",
@@ -762,19 +762,19 @@ fn lines_any(&self) -> LinesAny {
     #[unstable(feature = "collections",
                reason = "use slice notation [a..b] instead")]
     #[deprecated(since = "1.0.0", reason = "use slice notation [a..b] instead")]
-    fn slice(&self, begin: uint, end: uint) -> &str;
+    fn slice(&self, begin: usize, end: usize) -> &str;
 
     /// Deprecated: use `s[a..]` instead.
     #[unstable(feature = "collections",
                reason = "use slice notation [a..b] instead")]
     #[deprecated(since = "1.0.0", reason = "use slice notation [a..] instead")]
-    fn slice_from(&self, begin: uint) -> &str;
+    fn slice_from(&self, begin: usize) -> &str;
 
     /// Deprecated: use `s[..a]` instead.
     #[unstable(feature = "collections",
                reason = "use slice notation [a..b] instead")]
     #[deprecated(since = "1.0.0", reason = "use slice notation [..a] instead")]
-    fn slice_to(&self, end: uint) -> &str;
+    fn slice_to(&self, end: usize) -> &str;
 
     /// Returns a slice of the string from the character range
     /// [`begin`..`end`).
@@ -801,7 +801,7 @@ fn lines_any(&self) -> LinesAny {
     /// ```
     #[unstable(feature = "collections",
                reason = "may have yet to prove its worth")]
-    fn slice_chars(&self, begin: uint, end: uint) -> &str {
+    fn slice_chars(&self, begin: usize, end: usize) -> &str {
         core_str::StrExt::slice_chars(&self[], begin, end)
     }
 
@@ -812,7 +812,7 @@ fn slice_chars(&self, begin: uint, end: uint) -> &str {
     /// Caller must check both UTF-8 character boundaries and the boundaries of
     /// the entire slice as well.
     #[stable(feature = "rust1", since = "1.0.0")]
-    unsafe fn slice_unchecked(&self, begin: uint, end: uint) -> &str {
+    unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str {
         core_str::StrExt::slice_unchecked(&self[], begin, end)
     }
 
@@ -925,7 +925,7 @@ fn trim_right_matches<P: CharEq>(&self, pat: P) -> &str {
     /// ```
     #[unstable(feature = "collections",
                reason = "naming is uncertain with container conventions")]
-    fn is_char_boundary(&self, index: uint) -> bool {
+    fn is_char_boundary(&self, index: usize) -> bool {
         core_str::StrExt::is_char_boundary(&self[], index)
     }
 
@@ -945,7 +945,7 @@ fn is_char_boundary(&self, index: uint) -> bool {
     /// use std::str::CharRange;
     ///
     /// let s = "中华Việt Nam";
-    /// let mut i = 0u;
+    /// let mut i = 0;
     /// while i < s.len() {
     ///     let CharRange {ch, next} = s.char_range_at(i);
     ///     println!("{}: {}", i, ch);
@@ -975,7 +975,7 @@ fn is_char_boundary(&self, index: uint) -> bool {
     ///
     /// # Return value
     ///
-    /// A record {ch: char, next: uint} containing the char value and the byte
+    /// A record {ch: char, next: usize} containing the char value and the byte
     /// index of the next Unicode character.
     ///
     /// # Panics
@@ -984,7 +984,7 @@ fn is_char_boundary(&self, index: uint) -> bool {
     /// If `i` is not the index of the beginning of a valid UTF-8 character.
     #[unstable(feature = "collections",
                reason = "naming is uncertain with container conventions")]
-    fn char_range_at(&self, start: uint) -> CharRange {
+    fn char_range_at(&self, start: usize) -> CharRange {
         core_str::StrExt::char_range_at(&self[], start)
     }
 
@@ -1000,7 +1000,7 @@ fn char_range_at(&self, start: uint) -> CharRange {
     /// If `i` is not an index following a valid UTF-8 character.
     #[unstable(feature = "collections",
                reason = "naming is uncertain with container conventions")]
-    fn char_range_at_reverse(&self, start: uint) -> CharRange {
+    fn char_range_at_reverse(&self, start: usize) -> CharRange {
         core_str::StrExt::char_range_at_reverse(&self[], start)
     }
 
@@ -1021,7 +1021,7 @@ fn char_range_at_reverse(&self, start: uint) -> CharRange {
     /// If `i` is not the index of the beginning of a valid UTF-8 character.
     #[unstable(feature = "collections",
                reason = "naming is uncertain with container conventions")]
-    fn char_at(&self, i: uint) -> char {
+    fn char_at(&self, i: usize) -> char {
         core_str::StrExt::char_at(&self[], i)
     }
 
@@ -1033,7 +1033,7 @@ fn char_at(&self, i: uint) -> char {
     /// If `i` is not an index following a valid UTF-8 character.
     #[unstable(feature = "collections",
                reason = "naming is uncertain with container conventions")]
-    fn char_at_reverse(&self, i: uint) -> char {
+    fn char_at_reverse(&self, i: usize) -> char {
         core_str::StrExt::char_at_reverse(&self[], i)
     }
 
@@ -1073,7 +1073,7 @@ fn as_bytes(&self) -> &[u8] {
     /// assert_eq!(s.find(x), None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn find<P: CharEq>(&self, pat: P) -> Option<uint> {
+    fn find<P: CharEq>(&self, pat: P) -> Option<usize> {
         core_str::StrExt::find(&self[], pat)
     }
 
@@ -1101,7 +1101,7 @@ fn find<P: CharEq>(&self, pat: P) -> Option<uint> {
     /// assert_eq!(s.rfind(x), None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn rfind<P: CharEq>(&self, pat: P) -> Option<uint> {
+    fn rfind<P: CharEq>(&self, pat: P) -> Option<usize> {
         core_str::StrExt::rfind(&self[], pat)
     }
 
@@ -1126,7 +1126,7 @@ fn rfind<P: CharEq>(&self, pat: P) -> Option<uint> {
     /// ```
     #[unstable(feature = "collections",
                reason = "might get removed in favor of a more generic find in the future")]
-    fn find_str(&self, needle: &str) -> Option<uint> {
+    fn find_str(&self, needle: &str) -> Option<usize> {
         core_str::StrExt::find_str(&self[], needle)
     }
 
@@ -1170,7 +1170,7 @@ fn slice_shift_char(&self) -> Option<(char, &str)> {
     /// ```
     #[unstable(feature = "collections",
                reason = "awaiting convention about comparability of arbitrary slices")]
-    fn subslice_offset(&self, inner: &str) -> uint {
+    fn subslice_offset(&self, inner: &str) -> usize {
         core_str::StrExt::subslice_offset(&self[], inner)
     }
 
@@ -1202,7 +1202,7 @@ fn utf16_units(&self) -> Utf16Units {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    fn len(&self) -> uint {
+    fn len(&self) -> usize {
         core_str::StrExt::len(&self[])
     }
 
@@ -1264,8 +1264,8 @@ fn graphemes(&self, is_extended: bool) -> Graphemes {
     /// # Example
     ///
     /// ```rust
-    /// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::<Vec<(uint, &str)>>();
-    /// let b: &[_] = &[(0u, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
+    /// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::<Vec<(usize, &str)>>();
+    /// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
     /// assert_eq!(gr_inds.as_slice(), b);
     /// ```
     #[unstable(feature = "collections",
@@ -1301,7 +1301,7 @@ fn words(&self) -> Words {
     /// `is_cjk` = `false`) if the locale is unknown.
     #[unstable(feature = "collections",
                reason = "this functionality may only be provided by libunicode")]
-    fn width(&self, is_cjk: bool) -> uint {
+    fn width(&self, is_cjk: bool) -> usize {
         UnicodeStr::width(&self[], is_cjk)
     }
 
@@ -1326,15 +1326,15 @@ fn trim_right(&self) -> &str {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl StrExt for str {
-    fn slice(&self, begin: uint, end: uint) -> &str {
+    fn slice(&self, begin: usize, end: usize) -> &str {
         &self[begin..end]
     }
 
-    fn slice_from(&self, begin: uint) -> &str {
+    fn slice_from(&self, begin: usize) -> &str {
         &self[begin..]
     }
 
-    fn slice_to(&self, end: uint) -> &str {
+    fn slice_to(&self, end: usize) -> &str {
         &self[..end]
     }
 }
@@ -1357,51 +1357,51 @@ fn test_le() {
 
     #[test]
     fn test_len() {
-        assert_eq!("".len(), 0u);
-        assert_eq!("hello world".len(), 11u);
-        assert_eq!("\x63".len(), 1u);
-        assert_eq!("\u{a2}".len(), 2u);
-        assert_eq!("\u{3c0}".len(), 2u);
-        assert_eq!("\u{2620}".len(), 3u);
-        assert_eq!("\u{1d11e}".len(), 4u);
-
-        assert_eq!("".chars().count(), 0u);
-        assert_eq!("hello world".chars().count(), 11u);
-        assert_eq!("\x63".chars().count(), 1u);
-        assert_eq!("\u{a2}".chars().count(), 1u);
-        assert_eq!("\u{3c0}".chars().count(), 1u);
-        assert_eq!("\u{2620}".chars().count(), 1u);
-        assert_eq!("\u{1d11e}".chars().count(), 1u);
-        assert_eq!("ประเทศไทย中华Việt Nam".chars().count(), 19u);
-
-        assert_eq!("hello".width(false), 10u);
-        assert_eq!("hello".width(true), 10u);
-        assert_eq!("\0\0\0\0\0".width(false), 0u);
-        assert_eq!("\0\0\0\0\0".width(true), 0u);
-        assert_eq!("".width(false), 0u);
-        assert_eq!("".width(true), 0u);
-        assert_eq!("\u{2081}\u{2082}\u{2083}\u{2084}".width(false), 4u);
-        assert_eq!("\u{2081}\u{2082}\u{2083}\u{2084}".width(true), 8u);
+        assert_eq!("".len(), 0);
+        assert_eq!("hello world".len(), 11);
+        assert_eq!("\x63".len(), 1);
+        assert_eq!("\u{a2}".len(), 2);
+        assert_eq!("\u{3c0}".len(), 2);
+        assert_eq!("\u{2620}".len(), 3);
+        assert_eq!("\u{1d11e}".len(), 4);
+
+        assert_eq!("".chars().count(), 0);
+        assert_eq!("hello world".chars().count(), 11);
+        assert_eq!("\x63".chars().count(), 1);
+        assert_eq!("\u{a2}".chars().count(), 1);
+        assert_eq!("\u{3c0}".chars().count(), 1);
+        assert_eq!("\u{2620}".chars().count(), 1);
+        assert_eq!("\u{1d11e}".chars().count(), 1);
+        assert_eq!("ประเทศไทย中华Việt Nam".chars().count(), 19);
+
+        assert_eq!("hello".width(false), 10);
+        assert_eq!("hello".width(true), 10);
+        assert_eq!("\0\0\0\0\0".width(false), 0);
+        assert_eq!("\0\0\0\0\0".width(true), 0);
+        assert_eq!("".width(false), 0);
+        assert_eq!("".width(true), 0);
+        assert_eq!("\u{2081}\u{2082}\u{2083}\u{2084}".width(false), 4);
+        assert_eq!("\u{2081}\u{2082}\u{2083}\u{2084}".width(true), 8);
     }
 
     #[test]
     fn test_find() {
-        assert_eq!("hello".find('l'), Some(2u));
-        assert_eq!("hello".find(|c:char| c == 'o'), Some(4u));
+        assert_eq!("hello".find('l'), Some(2));
+        assert_eq!("hello".find(|c:char| c == 'o'), Some(4));
         assert!("hello".find('x').is_none());
         assert!("hello".find(|c:char| c == 'x').is_none());
-        assert_eq!("ประเทศไทย中华Việt Nam".find('华'), Some(30u));
-        assert_eq!("ประเทศไทย中华Việt Nam".find(|c: char| c == '华'), Some(30u));
+        assert_eq!("ประเทศไทย中华Việt Nam".find('华'), Some(30));
+        assert_eq!("ประเทศไทย中华Việt Nam".find(|c: char| c == '华'), Some(30));
     }
 
     #[test]
     fn test_rfind() {
-        assert_eq!("hello".rfind('l'), Some(3u));
-        assert_eq!("hello".rfind(|c:char| c == 'o'), Some(4u));
+        assert_eq!("hello".rfind('l'), Some(3));
+        assert_eq!("hello".rfind(|c:char| c == 'o'), Some(4));
         assert!("hello".rfind('x').is_none());
         assert!("hello".rfind(|c:char| c == 'x').is_none());
-        assert_eq!("ประเทศไทย中华Việt Nam".rfind('华'), Some(30u));
-        assert_eq!("ประเทศไทย中华Việt Nam".rfind(|c: char| c == '华'), Some(30u));
+        assert_eq!("ประเทศไทย中华Việt Nam".rfind('华'), Some(30));
+        assert_eq!("ประเทศไทย中华Việt Nam".rfind(|c: char| c == '华'), Some(30));
     }
 
     #[test]
@@ -1424,37 +1424,37 @@ fn test_into_bytes() {
     #[test]
     fn test_find_str() {
         // byte positions
-        assert_eq!("".find_str(""), Some(0u));
+        assert_eq!("".find_str(""), Some(0));
         assert!("banana".find_str("apple pie").is_none());
 
         let data = "abcabc";
-        assert_eq!(data[0u..6u].find_str("ab"), Some(0u));
-        assert_eq!(data[2u..6u].find_str("ab"), Some(3u - 2u));
-        assert!(data[2u..4u].find_str("ab").is_none());
+        assert_eq!(data[0..6].find_str("ab"), Some(0));
+        assert_eq!(data[2..6].find_str("ab"), Some(3 - 2));
+        assert!(data[2..4].find_str("ab").is_none());
 
         let string = "ประเทศไทย中华Việt Nam";
         let mut data = String::from_str(string);
         data.push_str(string);
         assert!(data.find_str("ไท华").is_none());
-        assert_eq!(data[0u..43u].find_str(""), Some(0u));
-        assert_eq!(data[6u..43u].find_str(""), Some(6u - 6u));
+        assert_eq!(data[0..43].find_str(""), Some(0));
+        assert_eq!(data[6..43].find_str(""), Some(6 - 6));
 
-        assert_eq!(data[0u..43u].find_str("ประ"), Some( 0u));
-        assert_eq!(data[0u..43u].find_str("ทศไ"), Some(12u));
-        assert_eq!(data[0u..43u].find_str("ย中"), Some(24u));
-        assert_eq!(data[0u..43u].find_str("iệt"), Some(34u));
-        assert_eq!(data[0u..43u].find_str("Nam"), Some(40u));
+        assert_eq!(data[0..43].find_str("ประ"), Some( 0));
+        assert_eq!(data[0..43].find_str("ทศไ"), Some(12));
+        assert_eq!(data[0..43].find_str("ย中"), Some(24));
+        assert_eq!(data[0..43].find_str("iệt"), Some(34));
+        assert_eq!(data[0..43].find_str("Nam"), Some(40));
 
-        assert_eq!(data[43u..86u].find_str("ประ"), Some(43u - 43u));
-        assert_eq!(data[43u..86u].find_str("ทศไ"), Some(55u - 43u));
-        assert_eq!(data[43u..86u].find_str("ย中"), Some(67u - 43u));
-        assert_eq!(data[43u..86u].find_str("iệt"), Some(77u - 43u));
-        assert_eq!(data[43u..86u].find_str("Nam"), Some(83u - 43u));
+        assert_eq!(data[43..86].find_str("ประ"), Some(43 - 43));
+        assert_eq!(data[43..86].find_str("ทศไ"), Some(55 - 43));
+        assert_eq!(data[43..86].find_str("ย中"), Some(67 - 43));
+        assert_eq!(data[43..86].find_str("iệt"), Some(77 - 43));
+        assert_eq!(data[43..86].find_str("Nam"), Some(83 - 43));
     }
 
     #[test]
     fn test_slice_chars() {
-        fn t(a: &str, b: &str, start: uint) {
+        fn t(a: &str, b: &str, start: usize) {
             assert_eq!(a.slice_chars(start, start + b.chars().count()), b);
         }
         t("", "", 0);
@@ -1527,7 +1527,7 @@ fn test_unsafe_slice() {
         assert_eq!("bc", unsafe {"abc".slice_unchecked(1, 3)});
         assert_eq!("", unsafe {"abc".slice_unchecked(1, 1)});
         fn a_million_letter_a() -> String {
-            let mut i = 0u;
+            let mut i = 0;
             let mut rs = String::new();
             while i < 100000 {
                 rs.push_str("aaaaaaaaaa");
@@ -1536,7 +1536,7 @@ fn a_million_letter_a() -> String {
             rs
         }
         fn half_a_million_letter_a() -> String {
-            let mut i = 0u;
+            let mut i = 0;
             let mut rs = String::new();
             while i < 100000 {
                 rs.push_str("aaaaa");
@@ -1547,7 +1547,7 @@ fn half_a_million_letter_a() -> String {
         let letters = a_million_letter_a();
         assert!(half_a_million_letter_a() ==
             unsafe {String::from_str(letters.slice_unchecked(
-                                     0u,
+                                     0,
                                      500000))});
     }
 
@@ -1644,7 +1644,7 @@ fn test_slice() {
         assert_eq!("华", data.slice(30, 33));
 
         fn a_million_letter_x() -> String {
-            let mut i = 0u;
+            let mut i = 0;
             let mut rs = String::new();
             while i < 100000 {
                 rs.push_str("华华华华华华华华华华");
@@ -1653,7 +1653,7 @@ fn a_million_letter_x() -> String {
             rs
         }
         fn half_a_million_letter_x() -> String {
-            let mut i = 0u;
+            let mut i = 0;
             let mut rs = String::new();
             while i < 100000 {
                 rs.push_str("华华华华华");
@@ -1663,23 +1663,23 @@ fn half_a_million_letter_x() -> String {
         }
         let letters = a_million_letter_x();
         assert!(half_a_million_letter_x() ==
-            String::from_str(letters.slice(0u, 3u * 500000u)));
+            String::from_str(letters.slice(0, 3 * 500000)));
     }
 
     #[test]
     fn test_slice_2() {
         let ss = "中华Việt Nam";
 
-        assert_eq!("华", ss.slice(3u, 6u));
-        assert_eq!("Việt Nam", ss.slice(6u, 16u));
+        assert_eq!("华", ss.slice(3, 6));
+        assert_eq!("Việt Nam", ss.slice(6, 16));
 
-        assert_eq!("ab", "abc".slice(0u, 2u));
-        assert_eq!("bc", "abc".slice(1u, 3u));
-        assert_eq!("", "abc".slice(1u, 1u));
+        assert_eq!("ab", "abc".slice(0, 2));
+        assert_eq!("bc", "abc".slice(1, 3));
+        assert_eq!("", "abc".slice(1, 1));
 
-        assert_eq!("中", ss.slice(0u, 3u));
-        assert_eq!("华V", ss.slice(3u, 7u));
-        assert_eq!("", ss.slice(3u, 3u));
+        assert_eq!("中", ss.slice(0, 3));
+        assert_eq!("华V", ss.slice(3, 7));
+        assert_eq!("", ss.slice(3, 3));
         /*0: 中
           3: 华
           6: V
@@ -1695,7 +1695,7 @@ fn test_slice_2() {
     #[test]
     #[should_fail]
     fn test_slice_fail() {
-        "中华Việt Nam".slice(0u, 2u);
+        "中华Việt Nam".slice(0, 2);
     }
 
     #[test]
@@ -1961,9 +1961,9 @@ fn vec_str_conversions() {
 
         let v: Vec<u8> = s1.as_bytes().to_vec();
         let s2: String = String::from_str(from_utf8(&v).unwrap());
-        let mut i: uint = 0u;
-        let n1: uint = s1.len();
-        let n2: uint = v.len();
+        let mut i = 0;
+        let n1 = s1.len();
+        let n2 = v.len();
         assert_eq!(n1, n2);
         while i < n1 {
             let a: u8 = s1.as_bytes()[i];
@@ -1971,7 +1971,7 @@ fn vec_str_conversions() {
             debug!("{}", a);
             debug!("{}", b);
             assert_eq!(a, b);
-            i += 1u;
+            i += 1;
         }
     }
 
@@ -2093,7 +2093,7 @@ fn test_iterator() {
         let v = ['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a','m'];
 
         let mut pos = 0;
-        let mut it = s.chars();
+        let it = s.chars();
 
         for c in it {
             assert_eq!(c, v[pos]);
@@ -2108,7 +2108,7 @@ fn test_rev_iterator() {
         let v = ['m', 'a', 'N', ' ', 't', 'ệ','i','V','华','中','ย','ท','ไ','ศ'];
 
         let mut pos = 0;
-        let mut it = s.chars().rev();
+        let it = s.chars().rev();
 
         for c in it {
             assert_eq!(c, v[pos]);
@@ -2188,7 +2188,7 @@ fn test_char_indicesator() {
         let v = ['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a','m'];
 
         let mut pos = 0;
-        let mut it = s.char_indices();
+        let it = s.char_indices();
 
         for c in it {
             assert_eq!(c, (p[pos], v[pos]));
@@ -2205,7 +2205,7 @@ fn test_char_indices_revator() {
         let v = ['m', 'a', 'N', ' ', 't', 'ệ','i','V','华','中','ย','ท','ไ','ศ'];
 
         let mut pos = 0;
-        let mut it = s.char_indices().rev();
+        let it = s.char_indices().rev();
 
         for c in it {
             assert_eq!(c, (p[pos], v[pos]));
@@ -2725,11 +2725,11 @@ fn test_graphemes() {
 
         // test the indices iterators
         let s = "a̐éö̲\r\n";
-        let gr_inds = s.grapheme_indices(true).collect::<Vec<(uint, &str)>>();
-        let b: &[_] = &[(0u, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
+        let gr_inds = s.grapheme_indices(true).collect::<Vec<(usize, &str)>>();
+        let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
         assert_eq!(gr_inds, b);
-        let gr_inds = s.grapheme_indices(true).rev().collect::<Vec<(uint, &str)>>();
-        let b: &[_] = &[(11, "\r\n"), (6, "ö̲"), (3, "é"), (0u, "a̐")];
+        let gr_inds = s.grapheme_indices(true).rev().collect::<Vec<(usize, &str)>>();
+        let b: &[_] = &[(11, "\r\n"), (6, "ö̲"), (3, "é"), (0, "a̐")];
         assert_eq!(gr_inds, b);
         let mut gr_inds_iter = s.grapheme_indices(true);
         {
@@ -2785,7 +2785,7 @@ fn t<S: Default + Str>() {
 
     #[test]
     fn test_str_container() {
-        fn sum_len(v: &[&str]) -> uint {
+        fn sum_len(v: &[&str]) -> usize {
             v.iter().map(|x| x.len()).sum()
         }
 
index a96ab40dd708fef1dfd30ea331b5eedd7ca5cd57..e3db8d04d4aba4f54d6606e264d5aef85b4a7b12 100644 (file)
@@ -80,7 +80,7 @@ pub fn new() -> String {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(capacity: uint) -> String {
+    pub fn with_capacity(capacity: usize) -> String {
         String {
             vec: Vec::with_capacity(capacity),
         }
@@ -157,10 +157,10 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> CowString<'a> {
         static TAG_CONT_U8: u8 = 128u8;
         static REPLACEMENT: &'static [u8] = b"\xEF\xBF\xBD"; // U+FFFD in UTF-8
         let total = v.len();
-        fn unsafe_get(xs: &[u8], i: uint) -> u8 {
+        fn unsafe_get(xs: &[u8], i: usize) -> u8 {
             unsafe { *xs.get_unchecked(i) }
         }
-        fn safe_get(xs: &[u8], i: uint, total: uint) -> u8 {
+        fn safe_get(xs: &[u8], i: usize, total: usize) -> u8 {
             if i >= total {
                 0
             } else {
@@ -319,7 +319,7 @@ pub fn from_utf16_lossy(v: &[u16]) -> String {
     /// * We assume that the `Vec` contains valid UTF-8.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub unsafe fn from_raw_parts(buf: *mut u8, length: uint, capacity: uint) -> String {
+    pub unsafe fn from_raw_parts(buf: *mut u8, length: usize, capacity: usize) -> String {
         String {
             vec: Vec::from_raw_parts(buf, length, capacity),
         }
@@ -375,7 +375,7 @@ pub fn push_str(&mut self, string: &str) {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self.vec.capacity()
     }
 
@@ -385,7 +385,7 @@ pub fn capacity(&self) -> uint {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -396,7 +396,7 @@ pub fn capacity(&self) -> uint {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve(&mut self, additional: uint) {
+    pub fn reserve(&mut self, additional: usize) {
         self.vec.reserve(additional)
     }
 
@@ -410,7 +410,7 @@ pub fn reserve(&mut self, additional: uint) {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -421,7 +421,7 @@ pub fn reserve(&mut self, additional: uint) {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_exact(&mut self, additional: uint) {
+    pub fn reserve_exact(&mut self, additional: usize) {
         self.vec.reserve_exact(additional)
     }
 
@@ -508,7 +508,7 @@ pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn truncate(&mut self, new_len: uint) {
+    pub fn truncate(&mut self, new_len: usize) {
         assert!(self.is_char_boundary(new_len));
         self.vec.truncate(new_len)
     }
@@ -563,7 +563,7 @@ pub fn pop(&mut self) -> Option<char> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn remove(&mut self, idx: uint) -> char {
+    pub fn remove(&mut self, idx: usize) -> char {
         let len = self.len();
         assert!(idx <= len);
 
@@ -590,7 +590,7 @@ pub fn remove(&mut self, idx: uint) -> char {
     /// this function will panic.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn insert(&mut self, idx: uint, ch: char) {
+    pub fn insert(&mut self, idx: usize, ch: char) {
         let len = self.len();
         assert!(idx <= len);
         assert!(self.is_char_boundary(idx));
@@ -641,7 +641,7 @@ pub unsafe fn as_mut_vec<'a>(&'a mut self) -> &'a mut Vec<u8> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { self.vec.len() }
+    pub fn len(&self) -> usize { self.vec.len() }
 
     /// Returns true if the string contains no bytes
     ///
@@ -854,26 +854,26 @@ fn add(mut self, other: &str) -> String {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl ops::Index<ops::Range<uint>> for String {
+impl ops::Index<ops::Range<usize>> for String {
     type Output = str;
     #[inline]
-    fn index(&self, index: &ops::Range<uint>) -> &str {
+    fn index(&self, index: &ops::Range<usize>) -> &str {
         &self[][*index]
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl ops::Index<ops::RangeTo<uint>> for String {
+impl ops::Index<ops::RangeTo<usize>> for String {
     type Output = str;
     #[inline]
-    fn index(&self, index: &ops::RangeTo<uint>) -> &str {
+    fn index(&self, index: &ops::RangeTo<usize>) -> &str {
         &self[][*index]
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl ops::Index<ops::RangeFrom<uint>> for String {
+impl ops::Index<ops::RangeFrom<usize>> for String {
     type Output = str;
     #[inline]
-    fn index(&self, index: &ops::RangeFrom<uint>) -> &str {
+    fn index(&self, index: &ops::RangeFrom<usize>) -> &str {
         &self[][*index]
     }
 }
@@ -1298,7 +1298,7 @@ fn test_slicing() {
     fn test_simple_types() {
         assert_eq!(1.to_string(), "1");
         assert_eq!((-1).to_string(), "-1");
-        assert_eq!(200u.to_string(), "200");
+        assert_eq!(200.to_string(), "200");
         assert_eq!(2u8.to_string(), "2");
         assert_eq!(true.to_string(), "true");
         assert_eq!(false.to_string(), "false");
@@ -1307,7 +1307,7 @@ fn test_simple_types() {
 
     #[test]
     fn test_vectors() {
-        let x: Vec<int> = vec![];
+        let x: Vec<i32> = vec![];
         assert_eq!(format!("{:?}", x), "[]");
         assert_eq!(format!("{:?}", vec![1]), "[1]");
         assert_eq!(format!("{:?}", vec![1, 2, 3]), "[1, 2, 3]");
index 8218469d6afb58e637e5c0e192192a993c8fc773..f14b34bc2153bebba75768d78e84c0a647e908b9 100644 (file)
@@ -66,7 +66,7 @@
 use core::ptr;
 use core::raw::Slice as RawSlice;
 use core::slice;
-use core::uint;
+use core::usize;
 
 /// A growable list type, written `Vec<T>` but pronounced 'vector.'
 ///
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Vec<T> {
     ptr: NonZero<*mut T>,
-    len: uint,
-    cap: uint,
+    len: usize,
+    cap: usize,
 }
 
 unsafe impl<T: Send> Send for Vec<T> { }
@@ -196,9 +196,9 @@ pub fn new() -> Vec<T> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(capacity: uint) -> Vec<T> {
+    pub fn with_capacity(capacity: usize) -> Vec<T> {
         if mem::size_of::<T>() == 0 {
-            Vec { ptr: unsafe { NonZero::new(EMPTY as *mut T) }, len: 0, cap: uint::MAX }
+            Vec { ptr: unsafe { NonZero::new(EMPTY as *mut T) }, len: 0, cap: usize::MAX }
         } else if capacity == 0 {
             Vec::new()
         } else {
@@ -245,8 +245,8 @@ pub fn with_capacity(capacity: uint) -> Vec<T> {
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub unsafe fn from_raw_parts(ptr: *mut T, length: uint,
-                                 capacity: uint) -> Vec<T> {
+    pub unsafe fn from_raw_parts(ptr: *mut T, length: usize,
+                                 capacity: usize) -> Vec<T> {
         Vec { ptr: NonZero::new(ptr), len: length, cap: capacity }
     }
 
@@ -258,7 +258,7 @@ pub unsafe fn from_raw_parts(ptr: *mut T, length: uint,
     #[inline]
     #[unstable(feature = "collections",
                reason = "may be better expressed via composition")]
-    pub unsafe fn from_raw_buf(ptr: *const T, elts: uint) -> Vec<T> {
+    pub unsafe fn from_raw_buf(ptr: *const T, elts: usize) -> Vec<T> {
         let mut dst = Vec::with_capacity(elts);
         dst.set_len(elts);
         ptr::copy_nonoverlapping_memory(dst.as_mut_ptr(), ptr, elts);
@@ -276,7 +276,7 @@ pub unsafe fn from_raw_buf(ptr: *const T, elts: uint) -> Vec<T> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self.cap
     }
 
@@ -285,7 +285,7 @@ pub fn capacity(&self) -> uint {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -295,9 +295,9 @@ pub fn capacity(&self) -> uint {
     /// assert!(vec.capacity() >= 11);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve(&mut self, additional: uint) {
+    pub fn reserve(&mut self, additional: usize) {
         if self.cap - self.len < additional {
-            let err_msg = "Vec::reserve: `uint` overflow";
+            let err_msg = "Vec::reserve: `usize` overflow";
             let new_cap = self.len.checked_add(additional).expect(err_msg)
                 .checked_next_power_of_two().expect(err_msg);
             self.grow_capacity(new_cap);
@@ -314,7 +314,7 @@ pub fn reserve(&mut self, additional: uint) {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     ///
     /// # Examples
     ///
@@ -324,10 +324,10 @@ pub fn reserve(&mut self, additional: uint) {
     /// assert!(vec.capacity() >= 11);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_exact(&mut self, additional: uint) {
+    pub fn reserve_exact(&mut self, additional: usize) {
         if self.cap - self.len < additional {
             match self.len.checked_add(additional) {
-                None => panic!("Vec::reserve: `uint` overflow"),
+                None => panic!("Vec::reserve: `usize` overflow"),
                 Some(new_cap) => self.grow_capacity(new_cap)
             }
         }
@@ -401,7 +401,7 @@ pub fn into_boxed_slice(mut self) -> Box<[T]> {
     /// assert_eq!(vec, vec![1, 2]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn truncate(&mut self, len: uint) {
+    pub fn truncate(&mut self, len: usize) {
         unsafe {
             // drop any extra elements
             while len < self.len {
@@ -455,7 +455,7 @@ pub fn into_iter(self) -> IntoIter<T> {
             let cap = self.cap;
             let begin = ptr as *const T;
             let end = if mem::size_of::<T>() == 0 {
-                (ptr as uint + self.len()) as *const T
+                (ptr as usize + self.len()) as *const T
             } else {
                 ptr.offset(self.len() as int) as *const T
             };
@@ -480,7 +480,7 @@ pub fn into_iter(self) -> IntoIter<T> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub unsafe fn set_len(&mut self, len: uint) {
+    pub unsafe fn set_len(&mut self, len: usize) {
         self.len = len;
     }
 
@@ -506,7 +506,7 @@ pub unsafe fn set_len(&mut self, len: uint) {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn swap_remove(&mut self, index: uint) -> T {
+    pub fn swap_remove(&mut self, index: usize) -> T {
         let length = self.len();
         self.swap(index, length - 1);
         self.pop().unwrap()
@@ -530,7 +530,7 @@ pub fn swap_remove(&mut self, index: uint) -> T {
     /// assert_eq!(vec, vec![1, 4, 2, 3, 5]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn insert(&mut self, index: uint, element: T) {
+    pub fn insert(&mut self, index: usize, element: T) {
         let len = self.len();
         assert!(index <= len);
         // space for the new element
@@ -566,7 +566,7 @@ pub fn insert(&mut self, index: uint, element: T) {
     /// assert_eq!(v, vec![1, 3]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn remove(&mut self, index: uint) -> T {
+    pub fn remove(&mut self, index: usize) -> T {
         let len = self.len();
         assert!(index < len);
         unsafe { // infallible
@@ -602,11 +602,11 @@ pub fn remove(&mut self, index: uint) -> T {
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn retain<F>(&mut self, mut f: F) where F: FnMut(&T) -> bool {
         let len = self.len();
-        let mut del = 0u;
+        let mut del = 0;
         {
             let v = &mut **self;
 
-            for i in 0u..len {
+            for i in 0..len {
                 if !f(&v[i]) {
                     del += 1;
                 } else if del > 0 {
@@ -623,7 +623,7 @@ pub fn retain<F>(&mut self, mut f: F) where F: FnMut(&T) -> bool {
     ///
     /// # Panics
     ///
-    /// Panics if the number of elements in the vector overflows a `uint`.
+    /// Panics if the number of elements in the vector overflows a `usize`.
     ///
     /// # Examples
     ///
@@ -687,7 +687,7 @@ pub fn pop(&mut self) -> Option<T> {
     ///
     /// # Panics
     ///
-    /// Panics if the number of elements in the vector overflows a `uint`.
+    /// Panics if the number of elements in the vector overflows a `usize`.
     ///
     /// # Examples
     /// ```rust
@@ -741,7 +741,7 @@ pub fn drain<'a>(&'a mut self) -> Drain<'a, T> {
         unsafe {
             let begin = *self.ptr as *const T;
             let end = if mem::size_of::<T>() == 0 {
-                (*self.ptr as uint + self.len()) as *const T
+                (*self.ptr as usize + self.len()) as *const T
             } else {
                 (*self.ptr).offset(self.len() as int) as *const T
             };
@@ -781,7 +781,7 @@ pub fn clear(&mut self) {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { self.len }
+    pub fn len(&self) -> usize { self.len }
 
     /// Returns `true` if the vector contains no elements.
     ///
@@ -808,7 +808,7 @@ pub fn is_empty(&self) -> bool { self.len() == 0 }
     /// # Examples
     ///
     /// ```
-    /// let v = vec![0u, 1, 2];
+    /// let v = vec![0, 1, 2];
     /// let w = v.map_in_place(|i| i + 3);
     /// assert_eq!(w.as_slice(), [3, 4, 5].as_slice());
     ///
@@ -850,7 +850,7 @@ pub fn map_in_place<U, F>(self, mut f: F) -> Vec<U> where F: FnMut(T) -> U {
             //        After `array.offset(offset)`: 0x9.
             //        (0x1 + 0x8 = 0x1 - 0x8)
             //
-            // 2) If the size of the elements in the vector is >1, the `uint` ->
+            // 2) If the size of the elements in the vector is >1, the `usize` ->
             //    `int` conversion can't overflow.
             let offset = vec.len() as int;
             let start = vec.as_mut_ptr();
@@ -977,8 +977,8 @@ pub fn map_in_place<U, F>(self, mut f: F) -> Vec<U> where F: FnMut(T) -> U {
                     let u = f(t);
 
                     // Forget the `U` and increment `num_u`. This increment
-                    // cannot overflow the `uint` as we only do this for a
-                    // number of times that fits into a `uint` (and start with
+                    // cannot overflow the `usize` as we only do this for a
+                    // number of times that fits into a `usize` (and start with
                     // `0`). Again, we should not panic between these steps.
                     mem::forget(u);
                     pv.num_u += 1;
@@ -1052,7 +1052,7 @@ impl<T: Clone> Vec<T> {
     /// ```
     #[unstable(feature = "collections",
                reason = "matches collection reform specification; waiting for dust to settle")]
-    pub fn resize(&mut self, new_len: uint, value: T) {
+    pub fn resize(&mut self, new_len: usize, value: T) {
         let len = self.len();
 
         if new_len > len {
@@ -1205,7 +1205,7 @@ impl<T> Vec<T> {
     ///
     /// If the capacity for `self` is already equal to or greater than the
     /// requested capacity, then no action is taken.
-    fn grow_capacity(&mut self, capacity: uint) {
+    fn grow_capacity(&mut self, capacity: usize) {
         if mem::size_of::<T>() == 0 { return }
 
         if capacity > self.cap {
@@ -1223,7 +1223,7 @@ fn grow_capacity(&mut self, capacity: uint) {
 
 // FIXME: #13996: need a way to mark the return value as `noalias`
 #[inline(never)]
-unsafe fn alloc_or_realloc<T>(ptr: *mut T, old_size: uint, size: uint) -> *mut T {
+unsafe fn alloc_or_realloc<T>(ptr: *mut T, old_size: usize, size: usize) -> *mut T {
     if old_size == 0 {
         allocate(size, mem::min_align_of::<T>()) as *mut T
     } else {
@@ -1232,7 +1232,7 @@ unsafe fn alloc_or_realloc<T>(ptr: *mut T, old_size: uint, size: uint) -> *mut T
 }
 
 #[inline]
-unsafe fn dealloc<T>(ptr: *mut T, len: uint) {
+unsafe fn dealloc<T>(ptr: *mut T, len: usize) {
     if mem::size_of::<T>() != 0 {
         deallocate(ptr as *mut u8,
                    len * mem::size_of::<T>(),
@@ -1274,22 +1274,22 @@ fn hash(&self, state: &mut S) {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> Index<uint> for Vec<T> {
+impl<T> Index<usize> for Vec<T> {
     type Output = T;
 
     #[inline]
-    fn index<'a>(&'a self, index: &uint) -> &'a T {
+    fn index<'a>(&'a self, index: &usize) -> &'a T {
         // NB built-in indexing via `&[T]`
         &(**self)[*index]
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> IndexMut<uint> for Vec<T> {
+impl<T> IndexMut<usize> for Vec<T> {
     type Output = T;
 
     #[inline]
-    fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut T {
+    fn index_mut<'a>(&'a mut self, index: &usize) -> &'a mut T {
         // NB built-in indexing via `&mut [T]`
         &mut (**self)[*index]
     }
@@ -1297,26 +1297,26 @@ fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut T {
 
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::Index<ops::Range<uint>> for Vec<T> {
+impl<T> ops::Index<ops::Range<usize>> for Vec<T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::Range<uint>) -> &[T] {
+    fn index(&self, index: &ops::Range<usize>) -> &[T] {
         Index::index(&**self, index)
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::Index<ops::RangeTo<uint>> for Vec<T> {
+impl<T> ops::Index<ops::RangeTo<usize>> for Vec<T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::RangeTo<uint>) -> &[T] {
+    fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
         Index::index(&**self, index)
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::Index<ops::RangeFrom<uint>> for Vec<T> {
+impl<T> ops::Index<ops::RangeFrom<usize>> for Vec<T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::RangeFrom<uint>) -> &[T] {
+    fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
         Index::index(&**self, index)
     }
 }
@@ -1330,26 +1330,26 @@ fn index(&self, _index: &ops::RangeFull) -> &[T] {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::IndexMut<ops::Range<uint>> for Vec<T> {
+impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {
     type Output = [T];
     #[inline]
-    fn index_mut(&mut self, index: &ops::Range<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::IndexMut<ops::RangeTo<uint>> for Vec<T> {
+impl<T> ops::IndexMut<ops::RangeTo<usize>> for Vec<T> {
     type Output = [T];
     #[inline]
-    fn index_mut(&mut self, index: &ops::RangeTo<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::IndexMut<ops::RangeFrom<uint>> for Vec<T> {
+impl<T> ops::IndexMut<ops::RangeFrom<usize>> for Vec<T> {
     type Output = [T];
     #[inline]
-    fn index_mut(&mut self, index: &ops::RangeFrom<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
     }
 }
@@ -1609,7 +1609,7 @@ fn into_cow(self) -> CowVec<'a, T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct IntoIter<T> {
     allocation: *mut T, // the block of memory allocated for the vector
-    cap: uint, // the capacity of the vector
+    cap: usize, // the capacity of the vector
     ptr: *const T,
     end: *const T
 }
@@ -1645,7 +1645,7 @@ fn next<'a>(&'a mut self) -> Option<T> {
                     // purposefully don't use 'ptr.offset' because for
                     // vectors with 0-size elements this would return the
                     // same pointer.
-                    self.ptr = mem::transmute(self.ptr as uint + 1);
+                    self.ptr = mem::transmute(self.ptr as usize + 1);
 
                     // Use a non-null pointer value
                     Some(ptr::read(mem::transmute(1u)))
@@ -1660,8 +1660,8 @@ fn next<'a>(&'a mut self) -> Option<T> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
-        let diff = (self.end as uint) - (self.ptr as uint);
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        let diff = (self.end as usize) - (self.ptr as usize);
         let size = mem::size_of::<T>();
         let exact = diff / (if size == 0 {1} else {size});
         (exact, Some(exact))
@@ -1678,7 +1678,7 @@ fn next_back<'a>(&'a mut self) -> Option<T> {
             } else {
                 if mem::size_of::<T>() == 0 {
                     // See above for why 'ptr.offset' isn't used
-                    self.end = mem::transmute(self.end as uint - 1);
+                    self.end = mem::transmute(self.end as usize - 1);
 
                     // Use a non-null pointer value
                     Some(ptr::read(mem::transmute(1u)))
@@ -1733,7 +1733,7 @@ fn next(&mut self) -> Option<T> {
                     // purposefully don't use 'ptr.offset' because for
                     // vectors with 0-size elements this would return the
                     // same pointer.
-                    self.ptr = mem::transmute(self.ptr as uint + 1);
+                    self.ptr = mem::transmute(self.ptr as usize + 1);
 
                     // Use a non-null pointer value
                     Some(ptr::read(mem::transmute(1u)))
@@ -1748,8 +1748,8 @@ fn next(&mut self) -> Option<T> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
-        let diff = (self.end as uint) - (self.ptr as uint);
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        let diff = (self.end as usize) - (self.ptr as usize);
         let size = mem::size_of::<T>();
         let exact = diff / (if size == 0 {1} else {size});
         (exact, Some(exact))
@@ -1766,7 +1766,7 @@ fn next_back(&mut self) -> Option<T> {
             } else {
                 if mem::size_of::<T>() == 0 {
                     // See above for why 'ptr.offset' isn't used
-                    self.end = mem::transmute(self.end as uint - 1);
+                    self.end = mem::transmute(self.end as usize - 1);
 
                     // Use a non-null pointer value
                     Some(ptr::read(mem::transmute(1u)))
@@ -1862,8 +1862,8 @@ struct PartialVecNonZeroSized<T,U> {
 /// When the destructor of this struct runs, all `num_t` `T`s and `num_u` `U`s
 /// are destructed.
 struct PartialVecZeroSized<T,U> {
-    num_t: uint,
-    num_u: uint,
+    num_t: usize,
+    num_u: usize,
     marker_t: InvariantType<T>,
     marker_u: InvariantType<U>,
 }
@@ -1920,7 +1920,7 @@ mod tests {
     use super::as_vec;
 
     struct DropCounter<'a> {
-        count: &'a mut int
+        count: &'a mut u32
     }
 
     #[unsafe_destructor]
@@ -1949,7 +1949,7 @@ fn test_as_vec_dtor() {
 
     #[test]
     fn test_small_vec_struct() {
-        assert!(size_of::<Vec<u8>>() == size_of::<uint>() * 3);
+        assert!(size_of::<Vec<u8>>() == size_of::<usize>() * 3);
     }
 
     #[test]
@@ -2020,7 +2020,7 @@ fn test_extend() {
 
     #[test]
     fn test_slice_from_mut() {
-        let mut values = vec![1u8,2,3,4,5];
+        let mut values = vec![1, 2, 3, 4, 5];
         {
             let slice = &mut values[2 ..];
             assert!(slice == [3, 4, 5]);
@@ -2034,7 +2034,7 @@ fn test_slice_from_mut() {
 
     #[test]
     fn test_slice_to_mut() {
-        let mut values = vec![1u8,2,3,4,5];
+        let mut values = vec![1, 2, 3, 4, 5];
         {
             let slice = &mut values[.. 2];
             assert!(slice == [1, 2]);
@@ -2048,7 +2048,7 @@ fn test_slice_to_mut() {
 
     #[test]
     fn test_split_at_mut() {
-        let mut values = vec![1u8,2,3,4,5];
+        let mut values = vec![1, 2, 3, 4, 5];
         {
             let (left, right) = values.split_at_mut(2);
             {
@@ -2068,12 +2068,12 @@ fn test_split_at_mut() {
             }
         }
 
-        assert!(values == vec![2u8, 3, 5, 6, 7]);
+        assert!(values == vec![2, 3, 5, 6, 7]);
     }
 
     #[test]
     fn test_clone() {
-        let v: Vec<int> = vec!();
+        let v: Vec<i32> = vec![];
         let w = vec!(1, 2, 3);
 
         assert_eq!(v, v.clone());
@@ -2108,9 +2108,9 @@ fn test_clone_from() {
 
     #[test]
     fn test_retain() {
-        let mut vec = vec![1u, 2, 3, 4];
+        let mut vec = vec![1, 2, 3, 4];
         vec.retain(|&x| x % 2 == 0);
-        assert!(vec == vec![2u, 4]);
+        assert!(vec == vec![2, 4]);
     }
 
     #[test]
@@ -2169,20 +2169,20 @@ fn test_unsafe_ptrs() {
             // Test on-stack copy-from-buf.
             let a = [1, 2, 3];
             let ptr = a.as_ptr();
-            let b = Vec::from_raw_buf(ptr, 3u);
+            let b = Vec::from_raw_buf(ptr, 3);
             assert_eq!(b, vec![1, 2, 3]);
 
             // Test on-heap copy-from-buf.
             let c = vec![1, 2, 3, 4, 5];
             let ptr = c.as_ptr();
-            let d = Vec::from_raw_buf(ptr, 5u);
+            let d = Vec::from_raw_buf(ptr, 5);
             assert_eq!(d, vec![1, 2, 3, 4, 5]);
         }
     }
 
     #[test]
     fn test_vec_truncate_drop() {
-        static mut drops: uint = 0;
+        static mut drops: u32 = 0;
         struct Elem(int);
         impl Drop for Elem {
             fn drop(&mut self) {
@@ -2201,7 +2201,7 @@ fn drop(&mut self) {
     #[test]
     #[should_fail]
     fn test_vec_truncate_fail() {
-        struct BadElem(int);
+        struct BadElem(i32);
         impl Drop for BadElem {
             fn drop(&mut self) {
                 let BadElem(ref mut x) = *self;
@@ -2217,62 +2217,62 @@ fn drop(&mut self) {
 
     #[test]
     fn test_index() {
-        let vec = vec!(1, 2, 3);
+        let vec = vec![1, 2, 3];
         assert!(vec[1] == 2);
     }
 
     #[test]
     #[should_fail]
     fn test_index_out_of_bounds() {
-        let vec = vec!(1, 2, 3);
+        let vec = vec![1, 2, 3];
         let _ = vec[3];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_1() {
-        let x: Vec<int> = vec![1, 2, 3, 4, 5];
+        let x = vec![1, 2, 3, 4, 5];
         &x[-1..];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_2() {
-        let x: Vec<int> = vec![1, 2, 3, 4, 5];
+        let x = vec![1, 2, 3, 4, 5];
         &x[..6];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_3() {
-        let x: Vec<int> = vec![1, 2, 3, 4, 5];
+        let x = vec![1, 2, 3, 4, 5];
         &x[-1..4];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_4() {
-        let x: Vec<int> = vec![1, 2, 3, 4, 5];
+        let x = vec![1, 2, 3, 4, 5];
         &x[1..6];
     }
 
     #[test]
     #[should_fail]
     fn test_slice_out_of_bounds_5() {
-        let x: Vec<int> = vec![1, 2, 3, 4, 5];
+        let x = vec![1, 2, 3, 4, 5];
         &x[3..2];
     }
 
     #[test]
     #[should_fail]
     fn test_swap_remove_empty() {
-        let mut vec: Vec<uint> = vec!();
+        let mut vec= Vec::<i32>::new();
         vec.swap_remove(0);
     }
 
     #[test]
     fn test_move_iter_unwrap() {
-        let mut vec: Vec<uint> = Vec::with_capacity(7);
+        let mut vec = Vec::with_capacity(7);
         vec.push(1);
         vec.push(2);
         let ptr = vec.as_ptr();
@@ -2285,14 +2285,14 @@ fn test_move_iter_unwrap() {
     #[test]
     #[should_fail]
     fn test_map_in_place_incompatible_types_fail() {
-        let v = vec![0u, 1, 2];
+        let v = vec![0, 1, 2];
         v.map_in_place(|_| ());
     }
 
     #[test]
     fn test_map_in_place() {
-        let v = vec![0u, 1, 2];
-        assert_eq!(v.map_in_place(|i: uint| i as int - 1), [-1, 0, 1]);
+        let v = vec![0, 1, 2];
+        assert_eq!(v.map_in_place(|i: u32| i as i32 - 1), [-1, 0, 1]);
     }
 
     #[test]
@@ -2318,7 +2318,7 @@ fn drop(&mut self) {
                 DROP_COUNTER.fetch_add(1, Ordering::Relaxed);
             }
         }
-        const NUM_ELEMENTS: uint = 2;
+        const NUM_ELEMENTS: usize = 2;
         static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
 
         let v = repeat(Nothing).take(NUM_ELEMENTS).collect::<Vec<_>>();
@@ -2334,7 +2334,7 @@ fn drop(&mut self) {
     #[test]
     fn test_move_items() {
         let vec = vec![1, 2, 3];
-        let mut vec2 : Vec<i32> = vec![];
+        let mut vec2 = vec![];
         for i in vec {
             vec2.push(i);
         }
@@ -2344,7 +2344,7 @@ fn test_move_items() {
     #[test]
     fn test_move_items_reverse() {
         let vec = vec![1, 2, 3];
-        let mut vec2 : Vec<i32> = vec![];
+        let mut vec2 = vec![];
         for i in vec.into_iter().rev() {
             vec2.push(i);
         }
@@ -2354,7 +2354,7 @@ fn test_move_items_reverse() {
     #[test]
     fn test_move_items_zero_sized() {
         let vec = vec![(), (), ()];
-        let mut vec2 : Vec<()> = vec![];
+        let mut vec2 = vec![];
         for i in vec {
             vec2.push(i);
         }
@@ -2364,7 +2364,7 @@ fn test_move_items_zero_sized() {
     #[test]
     fn test_drain_items() {
         let mut vec = vec![1, 2, 3];
-        let mut vec2: Vec<i32> = vec![];
+        let mut vec2 = vec![];
         for i in vec.drain() {
             vec2.push(i);
         }
@@ -2375,18 +2375,18 @@ fn test_drain_items() {
     #[test]
     fn test_drain_items_reverse() {
         let mut vec = vec![1, 2, 3];
-        let mut vec2: Vec<i32> = vec![];
+        let mut vec2 = vec![];
         for i in vec.drain().rev() {
             vec2.push(i);
         }
         assert_eq!(vec, []);
-        assert_eq!(vec2, [ 3, 2, 1 ]);
+        assert_eq!(vec2, [3, 2, 1]);
     }
 
     #[test]
     fn test_drain_items_zero_sized() {
         let mut vec = vec![(), (), ()];
-        let mut vec2: Vec<()> = vec![];
+        let mut vec2 = vec![];
         for i in vec.drain() {
             vec2.push(i);
         }
@@ -2396,9 +2396,9 @@ fn test_drain_items_zero_sized() {
 
     #[test]
     fn test_into_boxed_slice() {
-        let xs = vec![1u, 2, 3];
+        let xs = vec![1, 2, 3];
         let ys = xs.into_boxed_slice();
-        assert_eq!(ys, [1u, 2, 3]);
+        assert_eq!(ys, [1, 2, 3]);
     }
 
     #[test]
@@ -2421,17 +2421,17 @@ fn test_split_off() {
     #[bench]
     fn bench_new(b: &mut Bencher) {
         b.iter(|| {
-            let v: Vec<uint> = Vec::new();
+            let v: Vec<u32> = Vec::new();
             assert_eq!(v.len(), 0);
             assert_eq!(v.capacity(), 0);
         })
     }
 
-    fn do_bench_with_capacity(b: &mut Bencher, src_len: uint) {
+    fn do_bench_with_capacity(b: &mut Bencher, src_len: usize) {
         b.bytes = src_len as u64;
 
         b.iter(|| {
-            let v: Vec<uint> = Vec::with_capacity(src_len);
+            let v: Vec<u32> = Vec::with_capacity(src_len);
             assert_eq!(v.len(), 0);
             assert_eq!(v.capacity(), src_len);
         })
@@ -2457,7 +2457,7 @@ fn bench_with_capacity_1000(b: &mut Bencher) {
         do_bench_with_capacity(b, 1000)
     }
 
-    fn do_bench_from_fn(b: &mut Bencher, src_len: uint) {
+    fn do_bench_from_fn(b: &mut Bencher, src_len: usize) {
         b.bytes = src_len as u64;
 
         b.iter(|| {
@@ -2487,11 +2487,11 @@ fn bench_from_fn_1000(b: &mut Bencher) {
         do_bench_from_fn(b, 1000)
     }
 
-    fn do_bench_from_elem(b: &mut Bencher, src_len: uint) {
+    fn do_bench_from_elem(b: &mut Bencher, src_len: usize) {
         b.bytes = src_len as u64;
 
         b.iter(|| {
-            let dst: Vec<uint> = repeat(5).take(src_len).collect();
+            let dst: Vec<usize> = repeat(5).take(src_len).collect();
             assert_eq!(dst.len(), src_len);
             assert!(dst.iter().all(|x| *x == 5));
         })
@@ -2517,8 +2517,8 @@ fn bench_from_elem_1000(b: &mut Bencher) {
         do_bench_from_elem(b, 1000)
     }
 
-    fn do_bench_from_slice(b: &mut Bencher, src_len: uint) {
-        let src: Vec<uint> = FromIterator::from_iter(0..src_len);
+    fn do_bench_from_slice(b: &mut Bencher, src_len: usize) {
+        let src: Vec<_> = FromIterator::from_iter(0..src_len);
 
         b.bytes = src_len as u64;
 
@@ -2549,13 +2549,13 @@ fn bench_from_slice_1000(b: &mut Bencher) {
         do_bench_from_slice(b, 1000)
     }
 
-    fn do_bench_from_iter(b: &mut Bencher, src_len: uint) {
-        let src: Vec<uint> = FromIterator::from_iter(0..src_len);
+    fn do_bench_from_iter(b: &mut Bencher, src_len: usize) {
+        let src: Vec<_> = FromIterator::from_iter(0..src_len);
 
         b.bytes = src_len as u64;
 
         b.iter(|| {
-            let dst: Vec<uint> = FromIterator::from_iter(src.clone().into_iter());
+            let dst: Vec<_> = FromIterator::from_iter(src.clone().into_iter());
             assert_eq!(dst.len(), src_len);
             assert!(dst.iter().enumerate().all(|(i, x)| i == *x));
         });
@@ -2581,9 +2581,9 @@ fn bench_from_iter_1000(b: &mut Bencher) {
         do_bench_from_iter(b, 1000)
     }
 
-    fn do_bench_extend(b: &mut Bencher, dst_len: uint, src_len: uint) {
-        let dst: Vec<uint> = FromIterator::from_iter(0..dst_len);
-        let src: Vec<uint> = FromIterator::from_iter(dst_len..dst_len + src_len);
+    fn do_bench_extend(b: &mut Bencher, dst_len: usize, src_len: usize) {
+        let dst: Vec<_> = FromIterator::from_iter(0..dst_len);
+        let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
 
         b.bytes = src_len as u64;
 
@@ -2630,9 +2630,9 @@ fn bench_extend_1000_1000(b: &mut Bencher) {
         do_bench_extend(b, 1000, 1000)
     }
 
-    fn do_bench_push_all(b: &mut Bencher, dst_len: uint, src_len: uint) {
-        let dst: Vec<uint> = FromIterator::from_iter(0..dst_len);
-        let src: Vec<uint> = FromIterator::from_iter(dst_len..dst_len + src_len);
+    fn do_bench_push_all(b: &mut Bencher, dst_len: usize, src_len: usize) {
+        let dst: Vec<_> = FromIterator::from_iter(0..dst_len);
+        let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
 
         b.bytes = src_len as u64;
 
@@ -2679,9 +2679,9 @@ fn bench_push_all_1000_1000(b: &mut Bencher) {
         do_bench_push_all(b, 1000, 1000)
     }
 
-    fn do_bench_push_all_move(b: &mut Bencher, dst_len: uint, src_len: uint) {
-        let dst: Vec<uint> = FromIterator::from_iter(0u..dst_len);
-        let src: Vec<uint> = FromIterator::from_iter(dst_len..dst_len + src_len);
+    fn do_bench_push_all_move(b: &mut Bencher, dst_len: usize, src_len: usize) {
+        let dst: Vec<_> = FromIterator::from_iter(0..dst_len);
+        let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
 
         b.bytes = src_len as u64;
 
@@ -2728,8 +2728,8 @@ fn bench_push_all_move_1000_1000(b: &mut Bencher) {
         do_bench_push_all_move(b, 1000, 1000)
     }
 
-    fn do_bench_clone(b: &mut Bencher, src_len: uint) {
-        let src: Vec<uint> = FromIterator::from_iter(0..src_len);
+    fn do_bench_clone(b: &mut Bencher, src_len: usize) {
+        let src: Vec<usize> = FromIterator::from_iter(0..src_len);
 
         b.bytes = src_len as u64;
 
@@ -2760,9 +2760,9 @@ fn bench_clone_1000(b: &mut Bencher) {
         do_bench_clone(b, 1000)
     }
 
-    fn do_bench_clone_from(b: &mut Bencher, times: uint, dst_len: uint, src_len: uint) {
-        let dst: Vec<uint> = FromIterator::from_iter(0..src_len);
-        let src: Vec<uint> = FromIterator::from_iter(dst_len..dst_len + src_len);
+    fn do_bench_clone_from(b: &mut Bencher, times: usize, dst_len: usize, src_len: usize) {
+        let dst: Vec<_> = FromIterator::from_iter(0..src_len);
+        let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
 
         b.bytes = (times * src_len) as u64;
 
index abcf358a1926c00baee9db9d8f8d8042da941603..08511ae3e27cf0099de210400b4de3842cfc7578 100644 (file)
@@ -29,8 +29,6 @@
 use {vec, slice};
 use vec::Vec;
 
-// FIXME(conventions): capacity management???
-
 /// A map optimized for small integer keys.
 ///
 /// # Examples
@@ -117,7 +115,7 @@ impl<S: Writer + Hasher, V: Hash<S>> Hash<S> for VecMap<V> {
     fn hash(&self, state: &mut S) {
         // In order to not traverse the `VecMap` twice, count the elements
         // during iteration.
-        let mut count: uint = 0;
+        let mut count: usize = 0;
         for elt in self {
             elt.hash(state);
             count += 1;
@@ -148,7 +146,7 @@ pub fn new() -> VecMap<V> { VecMap { v: vec![] } }
     /// let mut map: VecMap<&str> = VecMap::with_capacity(10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(capacity: uint) -> VecMap<V> {
+    pub fn with_capacity(capacity: usize) -> VecMap<V> {
         VecMap { v: Vec::with_capacity(capacity) }
     }
 
@@ -164,7 +162,7 @@ pub fn with_capacity(capacity: uint) -> VecMap<V> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self.v.capacity()
     }
 
@@ -183,7 +181,7 @@ pub fn capacity(&self) -> uint {
     /// assert!(map.capacity() >= 10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_len(&mut self, len: uint) {
+    pub fn reserve_len(&mut self, len: usize) {
         let cur_len = self.v.len();
         if len >= cur_len {
             self.v.reserve(len - cur_len);
@@ -207,7 +205,7 @@ pub fn reserve_len(&mut self, len: uint) {
     /// assert!(map.capacity() >= 10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve_len_exact(&mut self, len: uint) {
+    pub fn reserve_len_exact(&mut self, len: usize) {
         let cur_len = self.v.len();
         if len >= cur_len {
             self.v.reserve_exact(len - cur_len);
@@ -215,11 +213,11 @@ pub fn reserve_len_exact(&mut self, len: uint) {
     }
 
     /// Returns an iterator visiting all keys in ascending order of the keys.
-    /// The iterator's element type is `uint`.
+    /// The iterator's element type is `usize`.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn keys<'r>(&'r self) -> Keys<'r, V> {
         fn first<A, B>((a, _): (A, B)) -> A { a }
-        let first: fn((uint, &'r V)) -> uint = first; // coerce to fn pointer
+        let first: fn((usize, &'r V)) -> usize = first; // coerce to fn pointer
 
         Keys { iter: self.iter().map(first) }
     }
@@ -229,13 +227,13 @@ fn first<A, B>((a, _): (A, B)) -> A { a }
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn values<'r>(&'r self) -> Values<'r, V> {
         fn second<A, B>((_, b): (A, B)) -> B { b }
-        let second: fn((uint, &'r V)) -> &'r V = second; // coerce to fn pointer
+        let second: fn((usize, &'r V)) -> &'r V = second; // coerce to fn pointer
 
         Values { iter: self.iter().map(second) }
     }
 
     /// Returns an iterator visiting all key-value pairs in ascending order of the keys.
-    /// The iterator's element type is `(uint, &'r V)`.
+    /// The iterator's element type is `(usize, &'r V)`.
     ///
     /// # Examples
     ///
@@ -263,7 +261,7 @@ pub fn iter<'r>(&'r self) -> Iter<'r, V> {
 
     /// Returns an iterator visiting all key-value pairs in ascending order of the keys,
     /// with mutable references to the values.
-    /// The iterator's element type is `(uint, &'r mut V)`.
+    /// The iterator's element type is `(usize, &'r mut V)`.
     ///
     /// # Examples
     ///
@@ -294,7 +292,7 @@ pub fn iter_mut<'r>(&'r mut self) -> IterMut<'r, V> {
 
     /// Returns an iterator visiting all key-value pairs in ascending order of
     /// the keys, consuming the original `VecMap`.
-    /// The iterator's element type is `(uint, &'r V)`.
+    /// The iterator's element type is `(usize, &'r V)`.
     ///
     /// # Examples
     ///
@@ -306,23 +304,23 @@ pub fn iter_mut<'r>(&'r mut self) -> IterMut<'r, V> {
     /// map.insert(3, "c");
     /// map.insert(2, "b");
     ///
-    /// let vec: Vec<(uint, &str)> = map.into_iter().collect();
+    /// let vec: Vec<(usize, &str)> = map.into_iter().collect();
     ///
     /// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_iter(self) -> IntoIter<V> {
-        fn filter<A>((i, v): (uint, Option<A>)) -> Option<(uint, A)> {
+        fn filter<A>((i, v): (usize, Option<A>)) -> Option<(usize, A)> {
             v.map(|v| (i, v))
         }
-        let filter: fn((uint, Option<V>)) -> Option<(uint, V)> = filter; // coerce to fn ptr
+        let filter: fn((usize, Option<V>)) -> Option<(usize, V)> = filter; // coerce to fn ptr
 
         IntoIter { iter: self.v.into_iter().enumerate().filter_map(filter) }
     }
 
     /// Returns an iterator visiting all key-value pairs in ascending order of
     /// the keys, emptying (but not consuming) the original `VecMap`.
-    /// The iterator's element type is `(uint, &'r V)`. Keeps the allocated memory for reuse.
+    /// The iterator's element type is `(usize, &'r V)`. Keeps the allocated memory for reuse.
     ///
     /// # Examples
     ///
@@ -334,17 +332,17 @@ fn filter<A>((i, v): (uint, Option<A>)) -> Option<(uint, A)> {
     /// map.insert(3, "c");
     /// map.insert(2, "b");
     ///
-    /// let vec: Vec<(uint, &str)> = map.drain().collect();
+    /// let vec: Vec<(usize, &str)> = map.drain().collect();
     ///
     /// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
     /// ```
     #[unstable(feature = "collections",
                reason = "matches collection reform specification, waiting for dust to settle")]
     pub fn drain<'a>(&'a mut self) -> Drain<'a, V> {
-        fn filter<A>((i, v): (uint, Option<A>)) -> Option<(uint, A)> {
+        fn filter<A>((i, v): (usize, Option<A>)) -> Option<(usize, A)> {
             v.map(|v| (i, v))
         }
-        let filter: fn((uint, Option<V>)) -> Option<(uint, V)> = filter; // coerce to fn ptr
+        let filter: fn((usize, Option<V>)) -> Option<(usize, V)> = filter; // coerce to fn ptr
 
         Drain { iter: self.v.drain().enumerate().filter_map(filter) }
     }
@@ -362,7 +360,7 @@ fn filter<A>((i, v): (uint, Option<A>)) -> Option<(uint, A)> {
     /// assert_eq!(a.len(), 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint {
+    pub fn len(&self) -> usize {
         self.v.iter().filter(|elt| elt.is_some()).count()
     }
 
@@ -411,7 +409,7 @@ pub fn clear(&mut self) { self.v.clear() }
     /// assert_eq!(map.get(&2), None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn get(&self, key: &uint) -> Option<&V> {
+    pub fn get(&self, key: &usize) -> Option<&V> {
         if *key < self.v.len() {
             match self.v[*key] {
               Some(ref value) => Some(value),
@@ -436,7 +434,7 @@ pub fn get(&self, key: &uint) -> Option<&V> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn contains_key(&self, key: &uint) -> bool {
+    pub fn contains_key(&self, key: &usize) -> bool {
         self.get(key).is_some()
     }
 
@@ -456,7 +454,7 @@ pub fn contains_key(&self, key: &uint) -> bool {
     /// assert_eq!(map[1], "b");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn get_mut(&mut self, key: &uint) -> Option<&mut V> {
+    pub fn get_mut(&mut self, key: &usize) -> Option<&mut V> {
         if *key < self.v.len() {
             match *(&mut self.v[*key]) {
               Some(ref mut value) => Some(value),
@@ -484,7 +482,7 @@ pub fn get_mut(&mut self, key: &uint) -> Option<&mut V> {
     /// assert_eq!(map[37], "c");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn insert(&mut self, key: uint, value: V) -> Option<V> {
+    pub fn insert(&mut self, key: usize, value: V) -> Option<V> {
         let len = self.v.len();
         if len <= key {
             self.v.extend((0..key - len + 1).map(|_| None));
@@ -506,7 +504,7 @@ pub fn insert(&mut self, key: uint, value: V) -> Option<V> {
     /// assert_eq!(map.remove(&1), None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn remove(&mut self, key: &uint) -> Option<V> {
+    pub fn remove(&mut self, key: &usize) -> Option<V> {
         if *key >= self.v.len() {
             return None;
         }
@@ -669,8 +667,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<V> FromIterator<(uint, V)> for VecMap<V> {
-    fn from_iter<Iter: Iterator<Item=(uint, V)>>(iter: Iter) -> VecMap<V> {
+impl<V> FromIterator<(usize, V)> for VecMap<V> {
+    fn from_iter<Iter: Iterator<Item=(usize, V)>>(iter: Iter) -> VecMap<V> {
         let mut map = VecMap::new();
         map.extend(iter);
         map
@@ -702,29 +700,29 @@ fn into_iter(mut self) -> IterMut<'a, T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<V> Extend<(uint, V)> for VecMap<V> {
-    fn extend<Iter: Iterator<Item=(uint, V)>>(&mut self, iter: Iter) {
+impl<V> Extend<(usize, V)> for VecMap<V> {
+    fn extend<Iter: Iterator<Item=(usize, V)>>(&mut self, iter: Iter) {
         for (k, v) in iter {
             self.insert(k, v);
         }
     }
 }
 
-impl<V> Index<uint> for VecMap<V> {
+impl<V> Index<usize> for VecMap<V> {
     type Output = V;
 
     #[inline]
-    fn index<'a>(&'a self, i: &uint) -> &'a V {
+    fn index<'a>(&'a self, i: &usize) -> &'a V {
         self.get(i).expect("key not present")
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<V> IndexMut<uint> for VecMap<V> {
+impl<V> IndexMut<usize> for VecMap<V> {
     type Output = V;
 
     #[inline]
-    fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut V {
+    fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut V {
         self.get_mut(i).expect("key not present")
     }
 }
@@ -757,7 +755,7 @@ fn next(&mut self) -> Option<$elem> {
             }
 
             #[inline]
-            fn size_hint(&self) -> (uint, Option<uint>) {
+            fn size_hint(&self) -> (usize, Option<usize>) {
                 (0, Some(self.back - self.front))
             }
         }
@@ -794,8 +792,8 @@ fn next_back(&mut self) -> Option<$elem> {
 /// An iterator over the key-value pairs of a map.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Iter<'a, V:'a> {
-    front: uint,
-    back: uint,
+    front: usize,
+    back: usize,
     iter: slice::Iter<'a, Option<V>>
 }
 
@@ -810,25 +808,25 @@ fn clone(&self) -> Iter<'a, V> {
     }
 }
 
-iterator! { impl Iter -> (uint, &'a V), as_ref }
-double_ended_iterator! { impl Iter -> (uint, &'a V), as_ref }
+iterator! { impl Iter -> (usize, &'a V), as_ref }
+double_ended_iterator! { impl Iter -> (usize, &'a V), as_ref }
 
 /// An iterator over the key-value pairs of a map, with the
 /// values being mutable.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct IterMut<'a, V:'a> {
-    front: uint,
-    back: uint,
+    front: usize,
+    back: usize,
     iter: slice::IterMut<'a, Option<V>>
 }
 
-iterator! { impl IterMut -> (uint, &'a mut V), as_mut }
-double_ended_iterator! { impl IterMut -> (uint, &'a mut V), as_mut }
+iterator! { impl IterMut -> (usize, &'a mut V), as_mut }
+double_ended_iterator! { impl IterMut -> (usize, &'a mut V), as_mut }
 
 /// An iterator over the keys of a map.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Keys<'a, V: 'a> {
-    iter: Map<Iter<'a, V>, fn((uint, &'a V)) -> uint>
+    iter: Map<Iter<'a, V>, fn((usize, &'a V)) -> usize>
 }
 
 // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
@@ -843,7 +841,7 @@ fn clone(&self) -> Keys<'a, V> {
 /// An iterator over the values of a map.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Values<'a, V: 'a> {
-    iter: Map<Iter<'a, V>, fn((uint, &'a V)) -> &'a V>
+    iter: Map<Iter<'a, V>, fn((usize, &'a V)) -> &'a V>
 }
 
 // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
@@ -860,39 +858,39 @@ fn clone(&self) -> Values<'a, V> {
 pub struct IntoIter<V> {
     iter: FilterMap<
     Enumerate<vec::IntoIter<Option<V>>>,
-    fn((uint, Option<V>)) -> Option<(uint, V)>>
+    fn((usize, Option<V>)) -> Option<(usize, V)>>
 }
 
 #[unstable(feature = "collections")]
 pub struct Drain<'a, V> {
     iter: FilterMap<
     Enumerate<vec::Drain<'a, Option<V>>>,
-    fn((uint, Option<V>)) -> Option<(uint, V)>>
+    fn((usize, Option<V>)) -> Option<(usize, V)>>
 }
 
 #[unstable(feature = "collections")]
 impl<'a, V> Iterator for Drain<'a, V> {
-    type Item = (uint, V);
+    type Item = (usize, V);
 
-    fn next(&mut self) -> Option<(uint, V)> { self.iter.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn next(&mut self) -> Option<(usize, V)> { self.iter.next() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 
 #[unstable(feature = "collections")]
 impl<'a, V> DoubleEndedIterator for Drain<'a, V> {
-    fn next_back(&mut self) -> Option<(uint, V)> { self.iter.next_back() }
+    fn next_back(&mut self) -> Option<(usize, V)> { self.iter.next_back() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, V> Iterator for Keys<'a, V> {
-    type Item = uint;
+    type Item = usize;
 
-    fn next(&mut self) -> Option<uint> { self.iter.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn next(&mut self) -> Option<usize> { self.iter.next() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, V> DoubleEndedIterator for Keys<'a, V> {
-    fn next_back(&mut self) -> Option<uint> { self.iter.next_back() }
+    fn next_back(&mut self) -> Option<usize> { self.iter.next_back() }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -900,7 +898,7 @@ impl<'a, V> Iterator for Values<'a, V> {
     type Item = &'a V;
 
     fn next(&mut self) -> Option<(&'a V)> { self.iter.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, V> DoubleEndedIterator for Values<'a, V> {
@@ -909,14 +907,14 @@ fn next_back(&mut self) -> Option<(&'a V)> { self.iter.next_back() }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<V> Iterator for IntoIter<V> {
-    type Item = (uint, V);
+    type Item = (usize, V);
 
-    fn next(&mut self) -> Option<(uint, V)> { self.iter.next() }
-    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+    fn next(&mut self) -> Option<(usize, V)> { self.iter.next() }
+    fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<V> DoubleEndedIterator for IntoIter<V> {
-    fn next_back(&mut self) -> Option<(uint, V)> { self.iter.next_back() }
+    fn next_back(&mut self) -> Option<(usize, V)> { self.iter.next_back() }
 }
 
 #[cfg(test)]
@@ -990,7 +988,7 @@ fn test_keys() {
         map.insert(1, 'a');
         map.insert(2, 'b');
         map.insert(3, 'c');
-        let keys = map.keys().collect::<Vec<uint>>();
+        let keys: Vec<_> = map.keys().collect();
         assert_eq!(keys.len(), 3);
         assert!(keys.contains(&1));
         assert!(keys.contains(&2));
@@ -1003,7 +1001,7 @@ fn test_values() {
         map.insert(1, 'a');
         map.insert(2, 'b');
         map.insert(3, 'c');
-        let values = map.values().map(|&v| v).collect::<Vec<char>>();
+        let values: Vec<_> = map.values().cloned().collect();
         assert_eq!(values.len(), 3);
         assert!(values.contains(&'a'));
         assert!(values.contains(&'b'));
@@ -1137,7 +1135,7 @@ fn test_drain_iterator() {
         map.insert(3, "c");
         map.insert(2, "b");
 
-        let vec: Vec<(usize, &str)> = map.drain().collect();
+        let vec: Vec<_> = map.drain().collect();
 
         assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
         assert_eq!(map.len(), 0);
@@ -1146,7 +1144,7 @@ fn test_drain_iterator() {
     #[test]
     fn test_show() {
         let mut map = VecMap::new();
-        let empty = VecMap::<int>::new();
+        let empty = VecMap::<i32>::new();
 
         map.insert(1, 2);
         map.insert(3, 4);
@@ -1195,7 +1193,7 @@ fn test_lt() {
         let mut b = VecMap::new();
 
         assert!(!(a < b) && !(b < a));
-        assert!(b.insert(2u, 5).is_none());
+        assert!(b.insert(2, 5).is_none());
         assert!(a < b);
         assert!(a.insert(2, 7).is_none());
         assert!(!(a < b) && b < a);
@@ -1213,7 +1211,7 @@ fn test_ord() {
         let mut b = VecMap::new();
 
         assert!(a <= b && a >= b);
-        assert!(a.insert(1u, 1).is_none());
+        assert!(a.insert(1, 1).is_none());
         assert!(a > b && a >= b);
         assert!(b < a && b <= a);
         assert!(b.insert(2, 2).is_none());
@@ -1245,9 +1243,9 @@ fn test_hash() {
 
     #[test]
     fn test_from_iter() {
-        let xs: Vec<(uint, char)> = vec![(1u, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')];
+        let xs = vec![(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')];
 
-        let map: VecMap<char> = xs.iter().map(|&x| x).collect();
+        let map: VecMap<_> = xs.iter().cloned().collect();
 
         for &(k, v) in &xs {
             assert_eq!(map.get(&k), Some(&v));
@@ -1256,7 +1254,7 @@ fn test_from_iter() {
 
     #[test]
     fn test_index() {
-        let mut map: VecMap<int> = VecMap::new();
+        let mut map = VecMap::new();
 
         map.insert(1, 2);
         map.insert(2, 1);
@@ -1268,7 +1266,7 @@ fn test_index() {
     #[test]
     #[should_fail]
     fn test_index_nonexistent() {
-        let mut map: VecMap<int> = VecMap::new();
+        let mut map = VecMap::new();
 
         map.insert(1, 2);
         map.insert(2, 1);
@@ -1281,7 +1279,7 @@ fn test_index_nonexistent() {
     fn test_entry(){
         let xs = [(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)];
 
-        let mut map: VecMap<i32> = xs.iter().map(|&x| x).collect();
+        let mut map: VecMap<_> = xs.iter().cloned().collect();
 
         // Existing key (insert)
         match map.entry(1) {
@@ -1337,7 +1335,7 @@ mod bench {
 
     #[bench]
     pub fn insert_rand_100(b: &mut Bencher) {
-        let mut m : VecMap<uint> = VecMap::new();
+        let mut m = VecMap::new();
         insert_rand_n(100, &mut m, b,
                       |m, i| { m.insert(i, 1); },
                       |m, i| { m.remove(&i); });
@@ -1345,7 +1343,7 @@ pub fn insert_rand_100(b: &mut Bencher) {
 
     #[bench]
     pub fn insert_rand_10_000(b: &mut Bencher) {
-        let mut m : VecMap<uint> = VecMap::new();
+        let mut m = VecMap::new();
         insert_rand_n(10_000, &mut m, b,
                       |m, i| { m.insert(i, 1); },
                       |m, i| { m.remove(&i); });
@@ -1354,7 +1352,7 @@ pub fn insert_rand_10_000(b: &mut Bencher) {
     // Insert seq
     #[bench]
     pub fn insert_seq_100(b: &mut Bencher) {
-        let mut m : VecMap<uint> = VecMap::new();
+        let mut m = VecMap::new();
         insert_seq_n(100, &mut m, b,
                      |m, i| { m.insert(i, 1); },
                      |m, i| { m.remove(&i); });
@@ -1362,7 +1360,7 @@ pub fn insert_seq_100(b: &mut Bencher) {
 
     #[bench]
     pub fn insert_seq_10_000(b: &mut Bencher) {
-        let mut m : VecMap<uint> = VecMap::new();
+        let mut m = VecMap::new();
         insert_seq_n(10_000, &mut m, b,
                      |m, i| { m.insert(i, 1); },
                      |m, i| { m.remove(&i); });
@@ -1371,7 +1369,7 @@ pub fn insert_seq_10_000(b: &mut Bencher) {
     // Find rand
     #[bench]
     pub fn find_rand_100(b: &mut Bencher) {
-        let mut m : VecMap<uint> = VecMap::new();
+        let mut m = VecMap::new();
         find_rand_n(100, &mut m, b,
                     |m, i| { m.insert(i, 1); },
                     |m, i| { m.get(&i); });
@@ -1379,7 +1377,7 @@ pub fn find_rand_100(b: &mut Bencher) {
 
     #[bench]
     pub fn find_rand_10_000(b: &mut Bencher) {
-        let mut m : VecMap<uint> = VecMap::new();
+        let mut m = VecMap::new();
         find_rand_n(10_000, &mut m, b,
                     |m, i| { m.insert(i, 1); },
                     |m, i| { m.get(&i); });
@@ -1388,7 +1386,7 @@ pub fn find_rand_10_000(b: &mut Bencher) {
     // Find seq
     #[bench]
     pub fn find_seq_100(b: &mut Bencher) {
-        let mut m : VecMap<uint> = VecMap::new();
+        let mut m = VecMap::new();
         find_seq_n(100, &mut m, b,
                    |m, i| { m.insert(i, 1); },
                    |m, i| { m.get(&i); });
@@ -1396,7 +1394,7 @@ pub fn find_seq_100(b: &mut Bencher) {
 
     #[bench]
     pub fn find_seq_10_000(b: &mut Bencher) {
-        let mut m : VecMap<uint> = VecMap::new();
+        let mut m = VecMap::new();
         find_seq_n(10_000, &mut m, b,
                    |m, i| { m.insert(i, 1); },
                    |m, i| { m.get(&i); });
index 6964a0b9db8178af441144882a088286f6d66537..bacb0f3fa71764b6848bff19938b37dee136c18e 100644 (file)
@@ -1591,10 +1591,10 @@ pub fn region_existential_bound<'tcx>(r: ty::Region) -> ExistentialBounds<'tcx>
 }
 
 impl CLike for BuiltinBound {
-    fn to_uint(&self) -> uint {
+    fn to_usize(&self) -> uint {
         *self as uint
     }
-    fn from_uint(v: uint) -> BuiltinBound {
+    fn from_usize(v: uint) -> BuiltinBound {
         unsafe { mem::transmute(v) }
     }
 }
index be7abfe6aca3b7a8038fdac57c4590877c1684b6..53d3b069467d348e6ecc76c9509641758c944d52 100644 (file)
@@ -136,7 +136,7 @@ impl<
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
         let mut bits = 0;
         for item in self {
-            bits |= item.to_uint();
+            bits |= item.to_usize();
         }
         s.emit_uint(bits)
     }
@@ -150,7 +150,7 @@ fn decode<D: Decoder>(d: &mut D) -> Result<EnumSet<T>, D::Error> {
         let mut set = EnumSet::new();
         for bit in 0..uint::BITS {
             if bits & (1 << bit) != 0 {
-                set.insert(CLike::from_uint(1 << bit));
+                set.insert(CLike::from_usize(1 << bit));
             }
         }
         Ok(set)
index ce02648b8f29d884a389185115f02e46302cc362..ca506e8c36f50a7111063c15c152eacd226f25e1 100644 (file)
@@ -21,7 +21,7 @@ fn new_drop(b : &mut Bencher) {
     use super::map::HashMap;
 
     b.iter(|| {
-        let m : HashMap<int, int> = HashMap::new();
+        let m : HashMap<i32, i32> = HashMap::new();
         assert_eq!(m.len(), 0);
     })
 }
index 63270610472485cc708a04200fd758aa3f180919..e1a8c8fd7038fc21ad4f6c0b48a33ac200dde57c 100644 (file)
@@ -45,9 +45,9 @@
 };
 use super::state::HashState;
 
-const INITIAL_LOG2_CAP: uint = 5;
+const INITIAL_LOG2_CAP: usize = 5;
 #[unstable(feature = "std_misc")]
-pub const INITIAL_CAPACITY: uint = 1 << INITIAL_LOG2_CAP; // 2^5
+pub const INITIAL_CAPACITY: usize = 1 << INITIAL_LOG2_CAP; // 2^5
 
 /// The default behavior of HashMap implements a load factor of 90.9%.
 /// This behavior is characterized by the following condition:
@@ -62,7 +62,7 @@ fn new() -> DefaultResizePolicy {
     }
 
     #[inline]
-    fn min_capacity(&self, usable_size: uint) -> uint {
+    fn min_capacity(&self, usable_size: usize) -> usize {
         // Here, we are rephrasing the logic by specifying the lower limit
         // on capacity:
         //
@@ -72,7 +72,7 @@ fn min_capacity(&self, usable_size: uint) -> uint {
 
     /// An inverse of `min_capacity`, approximately.
     #[inline]
-    fn usable_capacity(&self, cap: uint) -> uint {
+    fn usable_capacity(&self, cap: usize) -> usize {
         // As the number of entries approaches usable capacity,
         // min_capacity(size) must be smaller than the internal capacity,
         // so that the map is not resized:
@@ -369,7 +369,7 @@ fn pop_internal<K, V>(starting_bucket: FullBucketMut<K, V>) -> (K, V) {
 ///
 /// `hash`, `k`, and `v` are the elements to "robin hood" into the hashtable.
 fn robin_hood<'a, K: 'a, V: 'a>(mut bucket: FullBucketMut<'a, K, V>,
-                        mut ib: uint,
+                        mut ib: usize,
                         mut hash: SafeHash,
                         mut k: K,
                         mut v: V)
@@ -515,7 +515,7 @@ pub fn new() -> HashMap<K, V, RandomState> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(capacity: uint) -> HashMap<K, V, RandomState> {
+    pub fn with_capacity(capacity: usize) -> HashMap<K, V, RandomState> {
         HashMap::with_capacity_and_hash_state(capacity, Default::default())
     }
 }
@@ -569,7 +569,7 @@ pub fn with_hash_state(hash_state: S) -> HashMap<K, V, S> {
     /// ```
     #[inline]
     #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
-    pub fn with_capacity_and_hash_state(capacity: uint, hash_state: S)
+    pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
                                         -> HashMap<K, V, S> {
         let resize_policy = DefaultResizePolicy::new();
         let min_cap = max(INITIAL_CAPACITY, resize_policy.min_capacity(capacity));
@@ -593,7 +593,7 @@ pub fn with_capacity_and_hash_state(capacity: uint, hash_state: S)
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self.resize_policy.usable_capacity(self.table.capacity())
     }
 
@@ -603,7 +603,7 @@ pub fn capacity(&self) -> uint {
     ///
     /// # Panics
     ///
-    /// Panics if the new allocation size overflows `uint`.
+    /// Panics if the new allocation size overflows `usize`.
     ///
     /// # Example
     ///
@@ -613,7 +613,7 @@ pub fn capacity(&self) -> uint {
     /// map.reserve(10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve(&mut self, additional: uint) {
+    pub fn reserve(&mut self, additional: usize) {
         let new_size = self.len().checked_add(additional).expect("capacity overflow");
         let min_cap = self.resize_policy.min_capacity(new_size);
 
@@ -631,7 +631,7 @@ pub fn reserve(&mut self, additional: uint) {
     ///   1) Make sure the new capacity is enough for all the elements, accounting
     ///      for the load factor.
     ///   2) Ensure new_capacity is a power of two or zero.
-    fn resize(&mut self, new_capacity: uint) {
+    fn resize(&mut self, new_capacity: usize) {
         assert!(self.table.size() <= new_capacity);
         assert!(new_capacity.is_power_of_two() || new_capacity == 0);
 
@@ -793,7 +793,7 @@ fn insert_or_replace_with<'a, F>(&'a mut self,
 
             if (ib as int) < robin_ib {
                 // Found a luckier bucket than me. Better steal his spot.
-                return robin_hood(bucket, robin_ib as uint, hash, k, v);
+                return robin_hood(bucket, robin_ib as usize, hash, k, v);
             }
 
             probe = bucket.next();
@@ -953,7 +953,7 @@ pub fn entry<'a>(&'a mut self, key: K) -> Entry<'a, K, V>
     /// assert_eq!(a.len(), 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { self.table.size() }
+    pub fn len(&self) -> usize { self.table.size() }
 
     /// Returns true if the map contains no elements.
     ///
@@ -1188,7 +1188,7 @@ fn search_entry_hashed<'a, K: Eq, V>(table: &'a mut RawTable<K,V>, hash: SafeHas
             return Vacant(VacantEntry {
                 hash: hash,
                 key: k,
-                elem: NeqElem(bucket, robin_ib as uint),
+                elem: NeqElem(bucket, robin_ib as usize),
             });
         }
 
@@ -1371,7 +1371,7 @@ pub enum Entry<'a, K: 'a, V: 'a> {
 enum VacantEntryState<K, V, M> {
     /// The index is occupied, but the key to insert has precedence,
     /// and will kick the current one out on insertion.
-    NeqElem(FullBucket<K, V, M>, uint),
+    NeqElem(FullBucket<K, V, M>, usize),
     /// The index is genuinely vacant.
     NoElem(EmptyBucket<K, V, M>),
 }
@@ -1674,11 +1674,11 @@ fn test_insert() {
 
     #[derive(Hash, PartialEq, Eq)]
     struct Dropable {
-        k: uint
+        k: usize
     }
 
     impl Dropable {
-        fn new(k: uint) -> Dropable {
+        fn new(k: usize) -> Dropable {
             DROP_VECTOR.with(|slot| {
                 slot.borrow_mut()[k] += 1;
             });
@@ -1711,24 +1711,24 @@ fn test_drops() {
             let mut m = HashMap::new();
 
             DROP_VECTOR.with(|v| {
-                for i in 0u..200 {
+                for i in 0..200 {
                     assert_eq!(v.borrow()[i], 0);
                 }
             });
 
-            for i in 0u..100 {
+            for i in 0..100 {
                 let d1 = Dropable::new(i);
                 let d2 = Dropable::new(i+100);
                 m.insert(d1, d2);
             }
 
             DROP_VECTOR.with(|v| {
-                for i in 0u..200 {
+                for i in 0..200 {
                     assert_eq!(v.borrow()[i], 1);
                 }
             });
 
-            for i in 0u..50 {
+            for i in 0..50 {
                 let k = Dropable::new(i);
                 let v = m.remove(&k);
 
@@ -1741,12 +1741,12 @@ fn test_drops() {
             }
 
             DROP_VECTOR.with(|v| {
-                for i in 0u..50 {
+                for i in 0..50 {
                     assert_eq!(v.borrow()[i], 0);
                     assert_eq!(v.borrow()[i+100], 0);
                 }
 
-                for i in 50u..100 {
+                for i in 50..100 {
                     assert_eq!(v.borrow()[i], 1);
                     assert_eq!(v.borrow()[i+100], 1);
                 }
@@ -1754,7 +1754,7 @@ fn test_drops() {
         }
 
         DROP_VECTOR.with(|v| {
-            for i in 0u..200 {
+            for i in 0..200 {
                 assert_eq!(v.borrow()[i], 0);
             }
         });
@@ -1770,19 +1770,19 @@ fn test_move_iter_drops() {
             let mut hm = HashMap::new();
 
             DROP_VECTOR.with(|v| {
-                for i in 0u..200 {
+                for i in 0..200 {
                     assert_eq!(v.borrow()[i], 0);
                 }
             });
 
-            for i in 0u..100 {
+            for i in 0..100 {
                 let d1 = Dropable::new(i);
                 let d2 = Dropable::new(i+100);
                 hm.insert(d1, d2);
             }
 
             DROP_VECTOR.with(|v| {
-                for i in 0u..200 {
+                for i in 0..200 {
                     assert_eq!(v.borrow()[i], 1);
                 }
             });
@@ -1797,7 +1797,7 @@ fn test_move_iter_drops() {
             let mut half = hm.into_iter().take(50);
 
             DROP_VECTOR.with(|v| {
-                for i in 0u..200 {
+                for i in 0..200 {
                     assert_eq!(v.borrow()[i], 1);
                 }
             });
@@ -1805,11 +1805,11 @@ fn test_move_iter_drops() {
             for _ in half.by_ref() {}
 
             DROP_VECTOR.with(|v| {
-                let nk = (0u..100).filter(|&i| {
+                let nk = (0..100).filter(|&i| {
                     v.borrow()[i] == 1
                 }).count();
 
-                let nv = (0u..100).filter(|&i| {
+                let nv = (0..100).filter(|&i| {
                     v.borrow()[i+100] == 1
                 }).count();
 
@@ -1819,7 +1819,7 @@ fn test_move_iter_drops() {
         };
 
         DROP_VECTOR.with(|v| {
-            for i in 0u..200 {
+            for i in 0..200 {
                 assert_eq!(v.borrow()[i], 0);
             }
         });
@@ -1964,7 +1964,7 @@ fn test_pop() {
     #[test]
     fn test_iterate() {
         let mut m = HashMap::with_capacity(4);
-        for i in 0u..32 {
+        for i in 0..32 {
             assert!(m.insert(i, i*2).is_none());
         }
         assert_eq!(m.len(), 32);
@@ -1981,8 +1981,8 @@ fn test_iterate() {
     #[test]
     fn test_keys() {
         let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
-        let map = vec.into_iter().collect::<HashMap<int, char>>();
-        let keys = map.keys().map(|&k| k).collect::<Vec<int>>();
+        let map: HashMap<_, _> = vec.into_iter().collect();
+        let keys: Vec<_> = map.keys().cloned().collect();
         assert_eq!(keys.len(), 3);
         assert!(keys.contains(&1));
         assert!(keys.contains(&2));
@@ -1992,8 +1992,8 @@ fn test_keys() {
     #[test]
     fn test_values() {
         let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
-        let map = vec.into_iter().collect::<HashMap<int, char>>();
-        let values = map.values().map(|&v| v).collect::<Vec<char>>();
+        let map: HashMap<_, _> = vec.into_iter().collect();
+        let values: Vec<_> = map.values().cloned().collect();
         assert_eq!(values.len(), 3);
         assert!(values.contains(&'a'));
         assert!(values.contains(&'b'));
@@ -2031,8 +2031,8 @@ fn test_eq() {
 
     #[test]
     fn test_show() {
-        let mut map: HashMap<int, int> = HashMap::new();
-        let empty: HashMap<int, int> = HashMap::new();
+        let mut map = HashMap::new();
+        let empty: HashMap<i32, i32> = HashMap::new();
 
         map.insert(1, 2);
         map.insert(3, 4);
@@ -2051,7 +2051,7 @@ fn test_expand() {
         assert_eq!(m.len(), 0);
         assert!(m.is_empty());
 
-        let mut i = 0u;
+        let mut i = 0;
         let old_cap = m.table.capacity();
         while old_cap == m.table.capacity() {
             m.insert(i, i);
@@ -2079,7 +2079,7 @@ fn test_behavior_resize_policy() {
 
         assert_eq!(cap, initial_cap * 2);
 
-        let mut i = 0u;
+        let mut i = 0;
         for _ in 0..cap * 3 / 4 {
             m.insert(i, i);
             i += 1;
@@ -2121,21 +2121,21 @@ fn test_behavior_resize_policy() {
     #[test]
     fn test_reserve_shrink_to_fit() {
         let mut m = HashMap::new();
-        m.insert(0u, 0u);
+        m.insert(0, 0);
         m.remove(&0);
         assert!(m.capacity() >= m.len());
-        for i in 0us..128 {
+        for i in 0..128 {
             m.insert(i, i);
         }
         m.reserve(256);
 
         let usable_cap = m.capacity();
-        for i in 128us..128+256 {
+        for i in 128..(128 + 256) {
             m.insert(i, i);
             assert_eq!(m.capacity(), usable_cap);
         }
 
-        for i in 100us..128+256 {
+        for i in 100..(128 + 256) {
             assert_eq!(m.remove(&i), Some(i));
         }
         m.shrink_to_fit();
@@ -2144,7 +2144,7 @@ fn test_reserve_shrink_to_fit() {
         assert!(!m.is_empty());
         assert!(m.capacity() >= m.len());
 
-        for i in 0us..100 {
+        for i in 0..100 {
             assert_eq!(m.remove(&i), Some(i));
         }
         m.shrink_to_fit();
@@ -2159,7 +2159,7 @@ fn test_reserve_shrink_to_fit() {
     fn test_from_iter() {
         let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];
 
-        let map: HashMap<int, int> = xs.iter().map(|&x| x).collect();
+        let map: HashMap<_, _> = xs.iter().cloned().collect();
 
         for &(k, v) in &xs {
             assert_eq!(map.get(&k), Some(&v));
@@ -2170,7 +2170,7 @@ fn test_from_iter() {
     fn test_size_hint() {
         let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];
 
-        let map: HashMap<int, int> = xs.iter().map(|&x| x).collect();
+        let map: HashMap<_, _>  = xs.iter().cloned().collect();
 
         let mut iter = map.iter();
 
@@ -2183,7 +2183,7 @@ fn test_size_hint() {
     fn test_iter_len() {
         let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];
 
-        let map: HashMap<int, int> = xs.iter().map(|&x| x).collect();
+        let map: HashMap<_, _>  = xs.iter().cloned().collect();
 
         let mut iter = map.iter();
 
@@ -2196,7 +2196,7 @@ fn test_iter_len() {
     fn test_mut_size_hint() {
         let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];
 
-        let mut map: HashMap<int, int> = xs.iter().map(|&x| x).collect();
+        let mut map: HashMap<_, _>  = xs.iter().cloned().collect();
 
         let mut iter = map.iter_mut();
 
@@ -2209,7 +2209,7 @@ fn test_mut_size_hint() {
     fn test_iter_mut_len() {
         let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];
 
-        let mut map: HashMap<int, int> = xs.iter().map(|&x| x).collect();
+        let mut map: HashMap<_, _>  = xs.iter().cloned().collect();
 
         let mut iter = map.iter_mut();
 
@@ -2220,7 +2220,7 @@ fn test_iter_mut_len() {
 
     #[test]
     fn test_index() {
-        let mut map: HashMap<int, int> = HashMap::new();
+        let mut map = HashMap::new();
 
         map.insert(1, 2);
         map.insert(2, 1);
@@ -2232,7 +2232,7 @@ fn test_index() {
     #[test]
     #[should_fail]
     fn test_index_nonexistent() {
-        let mut map: HashMap<int, int> = HashMap::new();
+        let mut map = HashMap::new();
 
         map.insert(1, 2);
         map.insert(2, 1);
@@ -2245,7 +2245,7 @@ fn test_index_nonexistent() {
     fn test_entry(){
         let xs = [(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)];
 
-        let mut map: HashMap<int, int> = xs.iter().map(|&x| x).collect();
+        let mut map: HashMap<_, _> = xs.iter().cloned().collect();
 
         // Existing key (insert)
         match map.entry(1) {
@@ -2296,7 +2296,7 @@ fn test_entry(){
     #[test]
     fn test_entry_take_doesnt_corrupt() {
         // Test for #19292
-        fn check(m: &HashMap<int, ()>) {
+        fn check(m: &HashMap<isize, ()>) {
             for k in m.keys() {
                 assert!(m.contains_key(k),
                         "{} is in keys() but not in the map?", k);
@@ -2307,12 +2307,12 @@ fn check(m: &HashMap<int, ()>) {
         let mut rng = weak_rng();
 
         // Populate the map with some items.
-        for _ in 0u..50 {
+        for _ in 0..50 {
             let x = rng.gen_range(-10, 10);
             m.insert(x, ());
         }
 
-        for i in 0u..1000 {
+        for i in 0..1000 {
             let x = rng.gen_range(-10, 10);
             match m.entry(x) {
                 Vacant(_) => {},
index f5877e1dd99d8e6fcb62f3ed608bd598a69af076..a4641f14e3084825920f8b661cbb3a5f9a8f9ca1 100644 (file)
@@ -76,7 +76,7 @@
 /// #[derive(Hash, Eq, PartialEq, Debug)]
 /// struct Viking<'a> {
 ///     name: &'a str,
-///     power: uint,
+///     power: usize,
 /// }
 ///
 /// let mut vikings = HashSet::new();
@@ -123,7 +123,7 @@ pub fn new() -> HashSet<T, RandomState> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_capacity(capacity: uint) -> HashSet<T, RandomState> {
+    pub fn with_capacity(capacity: usize) -> HashSet<T, RandomState> {
         HashSet { map: HashMap::with_capacity(capacity) }
     }
 }
@@ -174,7 +174,7 @@ pub fn with_hash_state(hash_state: S) -> HashSet<T, S> {
     /// ```
     #[inline]
     #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
-    pub fn with_capacity_and_hash_state(capacity: uint, hash_state: S)
+    pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
                                         -> HashSet<T, S> {
         HashSet {
             map: HashMap::with_capacity_and_hash_state(capacity, hash_state),
@@ -192,7 +192,7 @@ pub fn with_capacity_and_hash_state(capacity: uint, hash_state: S)
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self.map.capacity()
     }
 
@@ -202,7 +202,7 @@ pub fn capacity(&self) -> uint {
     ///
     /// # Panics
     ///
-    /// Panics if the new allocation size overflows `uint`.
+    /// Panics if the new allocation size overflows `usize`.
     ///
     /// # Example
     ///
@@ -212,7 +212,7 @@ pub fn capacity(&self) -> uint {
     /// set.reserve(10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn reserve(&mut self, additional: uint) {
+    pub fn reserve(&mut self, additional: usize) {
         self.map.reserve(additional)
     }
 
@@ -402,7 +402,7 @@ pub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> {
     /// assert_eq!(v.len(), 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn len(&self) -> uint { self.map.len() }
+    pub fn len(&self) -> usize { self.map.len() }
 
     /// Returns true if the set contains no elements
     ///
@@ -456,7 +456,7 @@ pub fn clear(&mut self) { self.map.clear() }
     /// ```
     /// use std::collections::HashSet;
     ///
-    /// let set: HashSet<uint> = [1, 2, 3].iter().map(|&x| x).collect();
+    /// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
     /// assert_eq!(set.contains(&1), true);
     /// assert_eq!(set.contains(&4), false);
     /// ```
@@ -475,8 +475,8 @@ pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool
     /// ```
     /// use std::collections::HashSet;
     ///
-    /// let a: HashSet<uint> = [1, 2, 3].iter().map(|&x| x).collect();
-    /// let mut b: HashSet<uint> = HashSet::new();
+    /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
+    /// let mut b = HashSet::new();
     ///
     /// assert_eq!(a.is_disjoint(&b), true);
     /// b.insert(4);
@@ -496,8 +496,8 @@ pub fn is_disjoint(&self, other: &HashSet<T, S>) -> bool {
     /// ```
     /// use std::collections::HashSet;
     ///
-    /// let sup: HashSet<uint> = [1, 2, 3].iter().map(|&x| x).collect();
-    /// let mut set: HashSet<uint> = HashSet::new();
+    /// let sup: HashSet<_> = [1, 2, 3].iter().cloned().collect();
+    /// let mut set = HashSet::new();
     ///
     /// assert_eq!(set.is_subset(&sup), true);
     /// set.insert(2);
@@ -517,8 +517,8 @@ pub fn is_subset(&self, other: &HashSet<T, S>) -> bool {
     /// ```
     /// use std::collections::HashSet;
     ///
-    /// let sub: HashSet<uint> = [1, 2].iter().map(|&x| x).collect();
-    /// let mut set: HashSet<uint> = HashSet::new();
+    /// let sub: HashSet<_> = [1, 2].iter().cloned().collect();
+    /// let mut set = HashSet::new();
     ///
     /// assert_eq!(set.is_superset(&sub), false);
     ///
@@ -670,10 +670,10 @@ impl<'a, 'b, T, S, H> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S>
     /// ```
     /// use std::collections::HashSet;
     ///
-    /// let a: HashSet<int> = vec![1, 2, 3].into_iter().collect();
-    /// let b: HashSet<int> = vec![3, 4, 5].into_iter().collect();
+    /// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
+    /// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
     ///
-    /// let set: HashSet<int> = &a | &b;
+    /// let set = &a | &b;
     ///
     /// let mut i = 0;
     /// let expected = [1, 2, 3, 4, 5];
@@ -703,10 +703,10 @@ impl<'a, 'b, T, S, H> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S>
     /// ```
     /// use std::collections::HashSet;
     ///
-    /// let a: HashSet<int> = vec![1, 2, 3].into_iter().collect();
-    /// let b: HashSet<int> = vec![2, 3, 4].into_iter().collect();
+    /// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
+    /// let b: HashSet<_> = vec![2, 3, 4].into_iter().collect();
     ///
-    /// let set: HashSet<int> = &a & &b;
+    /// let set = &a & &b;
     ///
     /// let mut i = 0;
     /// let expected = [2, 3];
@@ -736,10 +736,10 @@ impl<'a, 'b, T, S, H> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S>
     /// ```
     /// use std::collections::HashSet;
     ///
-    /// let a: HashSet<int> = vec![1, 2, 3].into_iter().collect();
-    /// let b: HashSet<int> = vec![3, 4, 5].into_iter().collect();
+    /// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
+    /// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
     ///
-    /// let set: HashSet<int> = &a ^ &b;
+    /// let set = &a ^ &b;
     ///
     /// let mut i = 0;
     /// let expected = [1, 2, 4, 5];
@@ -769,10 +769,10 @@ impl<'a, 'b, T, S, H> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S>
     /// ```
     /// use std::collections::HashSet;
     ///
-    /// let a: HashSet<int> = vec![1, 2, 3].into_iter().collect();
-    /// let b: HashSet<int> = vec![3, 4, 5].into_iter().collect();
+    /// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
+    /// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
     ///
-    /// let set: HashSet<int> = &a - &b;
+    /// let set = &a - &b;
     ///
     /// let mut i = 0;
     /// let expected = [1, 2];
@@ -1029,7 +1029,7 @@ fn test_subset_and_superset() {
     #[test]
     fn test_iterate() {
         let mut a = HashSet::new();
-        for i in 0u..32 {
+        for i in 0..32 {
             assert!(a.insert(i));
         }
         let mut observed: u32 = 0;
@@ -1152,7 +1152,7 @@ fn test_union() {
     fn test_from_iter() {
         let xs = [1, 2, 3, 4, 5, 6, 7, 8, 9];
 
-        let set: HashSet<int> = xs.iter().map(|&x| x).collect();
+        let set: HashSet<_> = xs.iter().cloned().collect();
 
         for x in &xs {
             assert!(set.contains(x));
@@ -1198,8 +1198,8 @@ fn test_eq() {
 
     #[test]
     fn test_show() {
-        let mut set: HashSet<int> = HashSet::new();
-        let empty: HashSet<int> = HashSet::new();
+        let mut set = HashSet::new();
+        let empty = HashSet::<i32>::new();
 
         set.insert(1);
         set.insert(2);
@@ -1212,19 +1212,19 @@ fn test_show() {
 
     #[test]
     fn test_trivial_drain() {
-        let mut s = HashSet::<int>::new();
+        let mut s = HashSet::<i32>::new();
         for _ in s.drain() {}
         assert!(s.is_empty());
         drop(s);
 
-        let mut s = HashSet::<int>::new();
+        let mut s = HashSet::<i32>::new();
         drop(s.drain());
         assert!(s.is_empty());
     }
 
     #[test]
     fn test_drain() {
-        let mut s: HashSet<i32> = (1..100).collect();
+        let mut s: HashSet<_> = (1..100).collect();
 
         // try this a bunch of times to make sure we don't screw up internal state.
         for _ in 0..20 {
index 8952b81690186545d3abae3318e0d75de7def7fa..0bb6bd4cf356a24c93cdcc388068a0d41900a1c5 100644 (file)
@@ -67,8 +67,8 @@
 /// but in general is just a tricked out `Vec<Option<u64, K, V>>`.
 #[unsafe_no_drop_flag]
 pub struct RawTable<K, V> {
-    capacity: uint,
-    size:     uint,
+    capacity: usize,
+    size:     usize,
     hashes:   *mut u64,
     // Because K/V do not appear directly in any of the types in the struct,
     // inform rustc that in fact instances of K and V are reachable from here.
@@ -88,7 +88,7 @@ impl<K,V> Copy for RawBucket<K,V> {}
 
 pub struct Bucket<K, V, M> {
     raw:   RawBucket<K, V>,
-    idx:   uint,
+    idx:   usize,
     table: M
 }
 
@@ -96,13 +96,13 @@ impl<K,V,M:Copy> Copy for Bucket<K,V,M> {}
 
 pub struct EmptyBucket<K, V, M> {
     raw:   RawBucket<K, V>,
-    idx:   uint,
+    idx:   usize,
     table: M
 }
 
 pub struct FullBucket<K, V, M> {
     raw:   RawBucket<K, V>,
-    idx:   uint,
+    idx:   usize,
     table: M
 }
 
@@ -190,7 +190,7 @@ pub fn into_table(self) -> M {
         self.table
     }
     /// Get the raw index.
-    pub fn index(&self) -> uint {
+    pub fn index(&self) -> usize {
         self.idx
     }
 }
@@ -212,21 +212,21 @@ pub fn into_table(self) -> M {
         self.table
     }
     /// Get the raw index.
-    pub fn index(&self) -> uint {
+    pub fn index(&self) -> usize {
         self.idx
     }
 }
 
 impl<K, V, M: Deref<Target=RawTable<K, V>>> Bucket<K, V, M> {
     pub fn new(table: M, hash: SafeHash) -> Bucket<K, V, M> {
-        Bucket::at_index(table, hash.inspect() as uint)
+        Bucket::at_index(table, hash.inspect() as usize)
     }
 
-    pub fn at_index(table: M, ib_index: uint) -> Bucket<K, V, M> {
+    pub fn at_index(table: M, ib_index: usize) -> Bucket<K, V, M> {
         let ib_index = ib_index & (table.capacity() - 1);
         Bucket {
             raw: unsafe {
-               table.first_bucket_raw().offset(ib_index as int)
+               table.first_bucket_raw().offset(ib_index as isize)
             },
             idx: ib_index,
             table: table
@@ -276,7 +276,7 @@ pub fn next(&mut self) {
         // ... and it's zero at all other times.
         let maybe_wraparound_dist = (self.idx ^ (self.idx + 1)) & self.table.capacity();
         // Finally, we obtain the offset 1 or the offset -cap + 1.
-        let dist = 1 - (maybe_wraparound_dist as int);
+        let dist = 1 - (maybe_wraparound_dist as isize);
 
         self.idx += 1;
 
@@ -366,11 +366,11 @@ pub fn into_bucket(self) -> Bucket<K, V, M> {
     ///
     /// In the cited blog posts above, this is called the "distance to
     /// initial bucket", or DIB. Also known as "probe count".
-    pub fn distance(&self) -> uint {
+    pub fn distance(&self) -> usize {
         // Calculates the distance one has to travel when going from
         // `hash mod capacity` onwards to `idx mod capacity`, wrapping around
         // if the destination is not reached before the end of the table.
-        (self.idx - self.hash().inspect() as uint) & (self.table.capacity() - 1)
+        (self.idx - self.hash().inspect() as usize) & (self.table.capacity() - 1)
     }
 
     #[inline]
@@ -503,7 +503,7 @@ pub fn shift(mut self) -> Option<GapThenFull<K, V, M>> {
 /// # Panics
 ///
 /// Panics if `target_alignment` is not a power of two.
-fn round_up_to_next(unrounded: uint, target_alignment: uint) -> uint {
+fn round_up_to_next(unrounded: usize, target_alignment: usize) -> usize {
     assert!(target_alignment.is_power_of_two());
     (unrounded + target_alignment - 1) & !(target_alignment - 1)
 }
@@ -520,10 +520,10 @@ fn test_rounding() {
 
 // Returns a tuple of (key_offset, val_offset),
 // from the start of a mallocated array.
-fn calculate_offsets(hashes_size: uint,
-                     keys_size: uint, keys_align: uint,
-                     vals_align: uint)
-                     -> (uint, uint) {
+fn calculate_offsets(hashes_size: usize,
+                     keys_size: usize, keys_align: usize,
+                     vals_align: usize)
+                     -> (usize, usize) {
     let keys_offset = round_up_to_next(hashes_size, keys_align);
     let end_of_keys = keys_offset + keys_size;
 
@@ -534,10 +534,10 @@ fn calculate_offsets(hashes_size: uint,
 
 // Returns a tuple of (minimum required malloc alignment, hash_offset,
 // array_size), from the start of a mallocated array.
-fn calculate_allocation(hash_size: uint, hash_align: uint,
-                        keys_size: uint, keys_align: uint,
-                        vals_size: uint, vals_align: uint)
-                        -> (uint, uint, uint) {
+fn calculate_allocation(hash_size: usize, hash_align: usize,
+                        keys_size: usize, keys_align: usize,
+                        vals_size: usize, vals_align: usize)
+                        -> (usize, usize, usize) {
     let hash_offset = 0;
     let (_, vals_offset) = calculate_offsets(hash_size,
                                              keys_size, keys_align,
@@ -562,7 +562,7 @@ fn test_offset_calculation() {
 impl<K, V> RawTable<K, V> {
     /// Does not initialize the buckets. The caller should ensure they,
     /// at the very least, set every hash to EMPTY_BUCKET.
-    unsafe fn new_uninitialized(capacity: uint) -> RawTable<K, V> {
+    unsafe fn new_uninitialized(capacity: usize) -> RawTable<K, V> {
         if capacity == 0 {
             return RawTable {
                 size: 0,
@@ -601,7 +601,7 @@ unsafe fn new_uninitialized(capacity: uint) -> RawTable<K, V> {
         let buffer = allocate(size, malloc_alignment);
         if buffer.is_null() { ::alloc::oom() }
 
-        let hashes = buffer.offset(hash_offset as int) as *mut u64;
+        let hashes = buffer.offset(hash_offset as isize) as *mut u64;
 
         RawTable {
             capacity: capacity,
@@ -623,15 +623,15 @@ fn first_bucket_raw(&self) -> RawBucket<K, V> {
         unsafe {
             RawBucket {
                 hash: self.hashes,
-                key:  buffer.offset(keys_offset as int) as *mut K,
-                val:  buffer.offset(vals_offset as int) as *mut V
+                key:  buffer.offset(keys_offset as isize) as *mut K,
+                val:  buffer.offset(vals_offset as isize) as *mut V
             }
         }
     }
 
     /// Creates a new raw table from a given capacity. All buckets are
     /// initially empty.
-    pub fn new(capacity: uint) -> RawTable<K, V> {
+    pub fn new(capacity: usize) -> RawTable<K, V> {
         unsafe {
             let ret = RawTable::new_uninitialized(capacity);
             zero_memory(ret.hashes, capacity);
@@ -640,13 +640,13 @@ pub fn new(capacity: uint) -> RawTable<K, V> {
     }
 
     /// The hashtable's capacity, similar to a vector's.
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self.capacity
     }
 
     /// The number of elements ever `put` in the hashtable, minus the number
     /// of elements ever `take`n.
-    pub fn size(&self) -> uint {
+    pub fn size(&self) -> usize {
         self.size
     }
 
@@ -654,7 +654,7 @@ fn raw_buckets(&self) -> RawBuckets<K, V> {
         RawBuckets {
             raw: self.first_bucket_raw(),
             hashes_end: unsafe {
-                self.hashes.offset(self.capacity as int)
+                self.hashes.offset(self.capacity as isize)
             },
             marker: marker::ContravariantLifetime,
         }
@@ -705,7 +705,7 @@ pub fn drain(&mut self) -> Drain<K, V> {
     unsafe fn rev_move_buckets(&mut self) -> RevMoveBuckets<K, V> {
         let raw_bucket = self.first_bucket_raw();
         RevMoveBuckets {
-            raw: raw_bucket.offset(self.capacity as int),
+            raw: raw_bucket.offset(self.capacity as isize),
             hashes_end: raw_bucket.hash,
             elems_left: self.size,
             marker:     marker::ContravariantLifetime,
@@ -758,7 +758,7 @@ fn next(&mut self) -> Option<RawBucket<K, V>> {
 struct RevMoveBuckets<'a, K, V> {
     raw: RawBucket<K, V>,
     hashes_end: *mut u64,
-    elems_left: uint,
+    elems_left: usize,
     marker: marker::ContravariantLifetime<'a>,
 }
 
@@ -791,7 +791,7 @@ fn next(&mut self) -> Option<(K, V)> {
 /// Iterator over shared references to entries in a table.
 pub struct Iter<'a, K: 'a, V: 'a> {
     iter: RawBuckets<'a, K, V>,
-    elems_left: uint,
+    elems_left: usize,
 }
 
 // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
@@ -808,7 +808,7 @@ fn clone(&self) -> Iter<'a, K, V> {
 /// Iterator over mutable references to entries in a table.
 pub struct IterMut<'a, K: 'a, V: 'a> {
     iter: RawBuckets<'a, K, V>,
-    elems_left: uint,
+    elems_left: usize,
 }
 
 /// Iterator over the entries in a table, consuming the table.