about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-02-16 00:46:43 +0000
committerbors <bors@rust-lang.org>2015-02-16 00:46:43 +0000
commitc5db290bf6df986a6acd5ce993f278c18e55ca37 (patch)
tree5a67ed2bb3601bc1d5f477057324421fbd2291c3 /src/libcore
parent342ab53bf858a89e418973ba3bfff55161c0b174 (diff)
parentcea2bbfe27707becaacad1ce64b835b408c0ccf8 (diff)
downloadrust-c5db290bf6df986a6acd5ce993f278c18e55ca37.tar.gz
rust-c5db290bf6df986a6acd5ce993f278c18e55ca37.zip
Auto merge of #22367 - Manishearth:rollup, r=steveklabnik
(still testing locally)
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/atomic.rs4
-rw-r--r--src/libcore/cell.rs3
-rw-r--r--src/libcore/char.rs42
-rw-r--r--src/libcore/clone.rs4
-rw-r--r--src/libcore/fmt/float.rs10
-rw-r--r--src/libcore/iter.rs4
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libcore/num/f32.rs19
-rw-r--r--src/libcore/num/f64.rs19
-rw-r--r--src/libcore/num/mod.rs18
-rw-r--r--src/libcore/option.rs2
-rw-r--r--src/libcore/raw.rs121
-rw-r--r--src/libcore/slice.rs234
-rw-r--r--src/libcore/str/mod.rs156
14 files changed, 385 insertions, 253 deletions
diff --git a/src/libcore/atomic.rs b/src/libcore/atomic.rs
index 0f3823eb7a5..32e8cffcae4 100644
--- a/src/libcore/atomic.rs
+++ b/src/libcore/atomic.rs
@@ -21,9 +21,9 @@
 //!
 //! Each method takes an `Ordering` which represents the strength of
 //! the memory barrier for that operation. These orderings are the
-//! same as [C++11 atomic orderings][1].
+//! same as [LLVM atomic orderings][1].
 //!
-//! [1]: http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync
+//! [1]: http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations
 //!
 //! Atomic variables are safe to share between threads (they implement `Sync`)
 //! but they do not themselves provide the mechanism for sharing. The most
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index 050b34508ff..cf293ded13f 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -649,7 +649,8 @@ impl<'b, T> DerefMut for RefMut<'b, T> {
 ///
 /// **NOTE:** `UnsafeCell<T>`'s fields are public to allow static initializers. It is not
 /// recommended to access its fields directly, `get` should be used instead.
-#[lang="unsafe"]
+#[cfg_attr(stage0, lang="unsafe")]  // NOTE: remove after next snapshot
+#[cfg_attr(not(stage0), lang="unsafe_cell")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct UnsafeCell<T> {
     /// Wrapped value
diff --git a/src/libcore/char.rs b/src/libcore/char.rs
index 28e0247f00a..683e450acb2 100644
--- a/src/libcore/char.rs
+++ b/src/libcore/char.rs
@@ -119,16 +119,16 @@ pub fn from_u32(i: u32) -> Option<char> {
 /// ```
 #[inline]
 #[unstable(feature = "core", reason = "pending integer conventions")]
-pub fn from_digit(num: uint, radix: uint) -> Option<char> {
+pub fn from_digit(num: u32, radix: u32) -> Option<char> {
     if radix > 36 {
         panic!("from_digit: radix is too high (maximum 36)");
     }
     if num < radix {
         unsafe {
             if num < 10 {
-                Some(transmute(('0' as uint + num) as u32))
+                Some(transmute('0' as u32 + num))
             } else {
-                Some(transmute(('a' as uint + num - 10) as u32))
+                Some(transmute('a' as u32 + num - 10))
             }
         }
     } else {
@@ -164,7 +164,7 @@ pub trait CharExt {
     /// ```
     #[unstable(feature = "core",
                reason = "pending integer conventions")]
-    fn is_digit(self, radix: uint) -> bool;
+    fn is_digit(self, radix: u32) -> bool;
 
     /// Converts a character to the corresponding digit.
     ///
@@ -189,7 +189,7 @@ pub trait CharExt {
     /// ```
     #[unstable(feature = "core",
                reason = "pending integer conventions")]
-    fn to_digit(self, radix: uint) -> Option<uint>;
+    fn to_digit(self, radix: u32) -> Option<u32>;
 
     /// Returns an iterator that yields the hexadecimal Unicode escape of a character, as `char`s.
     ///
@@ -275,7 +275,7 @@ pub trait CharExt {
     /// assert_eq!(n, 2);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf8(self) -> uint;
+    fn len_utf8(self) -> usize;
 
     /// Returns the number of bytes this character would need if encoded in UTF-16.
     ///
@@ -287,7 +287,7 @@ pub trait CharExt {
     /// assert_eq!(n, 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf16(self) -> uint;
+    fn len_utf16(self) -> usize;
 
     /// Encodes this character as UTF-8 into the provided byte buffer, and then returns the number
     /// of bytes written.
@@ -317,7 +317,7 @@ pub trait CharExt {
     /// assert_eq!(result, None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn encode_utf8(self, dst: &mut [u8]) -> Option<uint>;
+    fn encode_utf8(self, dst: &mut [u8]) -> Option<usize>;
 
     /// Encodes this character as UTF-16 into the provided `u16` buffer, and then returns the
     /// number of `u16`s written.
@@ -347,27 +347,27 @@ pub trait CharExt {
     /// assert_eq!(result, None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn encode_utf16(self, dst: &mut [u16]) -> Option<uint>;
+    fn encode_utf16(self, dst: &mut [u16]) -> Option<usize>;
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl CharExt for char {
     #[unstable(feature = "core",
                reason = "pending integer conventions")]
-    fn is_digit(self, radix: uint) -> bool {
+    fn is_digit(self, radix: u32) -> bool {
         self.to_digit(radix).is_some()
     }
 
     #[unstable(feature = "core",
                reason = "pending integer conventions")]
-    fn to_digit(self, radix: uint) -> Option<uint> {
+    fn to_digit(self, radix: u32) -> Option<u32> {
         if radix > 36 {
             panic!("to_digit: radix is too high (maximum 36)");
         }
         let val = match self {
-          '0' ... '9' => self as uint - ('0' as uint),
-          'a' ... 'z' => self as uint + 10 - ('a' as uint),
-          'A' ... 'Z' => self as uint + 10 - ('A' as uint),
+          '0' ... '9' => self as u32 - '0' as u32,
+          'a' ... 'z' => self as u32 - 'a' as u32 + 10,
+          'A' ... 'Z' => self as u32 - 'A' as u32 + 10,
           _ => return None,
         };
         if val < radix { Some(val) }
@@ -396,7 +396,7 @@ impl CharExt for char {
 
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf8(self) -> uint {
+    fn len_utf8(self) -> usize {
         let code = self as u32;
         match () {
             _ if code < MAX_ONE_B   => 1,
@@ -408,7 +408,7 @@ impl CharExt for char {
 
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf16(self) -> uint {
+    fn len_utf16(self) -> usize {
         let ch = self as u32;
         if (ch & 0xFFFF_u32) == ch { 1 } else { 2 }
     }
@@ -416,14 +416,14 @@ impl CharExt for char {
     #[inline]
     #[unstable(feature = "core",
                reason = "pending decision about Iterator/Writer/Reader")]
-    fn encode_utf8(self, dst: &mut [u8]) -> Option<uint> {
+    fn encode_utf8(self, dst: &mut [u8]) -> Option<usize> {
         encode_utf8_raw(self as u32, dst)
     }
 
     #[inline]
     #[unstable(feature = "core",
                reason = "pending decision about Iterator/Writer/Reader")]
-    fn encode_utf16(self, dst: &mut [u16]) -> Option<uint> {
+    fn encode_utf16(self, dst: &mut [u16]) -> Option<usize> {
         encode_utf16_raw(self as u32, dst)
     }
 }
@@ -435,7 +435,7 @@ impl CharExt for char {
 /// and a `None` will be returned.
 #[inline]
 #[unstable(feature = "core")]
-pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<uint> {
+pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> {
     // Marked #[inline] to allow llvm optimizing it away
     if code < MAX_ONE_B && dst.len() >= 1 {
         dst[0] = code as u8;
@@ -467,7 +467,7 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<uint> {
 /// and a `None` will be returned.
 #[inline]
 #[unstable(feature = "core")]
-pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option<uint> {
+pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option<usize> {
     // Marked #[inline] to allow llvm optimizing it away
     if (ch & 0xFFFF_u32) == ch  && dst.len() >= 1 {
         // The BMP falls through (assuming non-surrogate, as it should)
@@ -499,7 +499,7 @@ enum EscapeUnicodeState {
     Backslash,
     Type,
     LeftBrace,
-    Value(uint),
+    Value(usize),
     RightBrace,
     Done,
 }
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs
index 28c306fc009..058eff121e6 100644
--- a/src/libcore/clone.rs
+++ b/src/libcore/clone.rs
@@ -61,13 +61,13 @@ macro_rules! clone_impl {
     }
 }
 
-clone_impl! { int }
+clone_impl! { isize }
 clone_impl! { i8 }
 clone_impl! { i16 }
 clone_impl! { i32 }
 clone_impl! { i64 }
 
-clone_impl! { uint }
+clone_impl! { usize }
 clone_impl! { u8 }
 clone_impl! { u16 }
 clone_impl! { u32 }
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs
index 25bb959b9b3..8e09e52daee 100644
--- a/src/libcore/fmt/float.rs
+++ b/src/libcore/fmt/float.rs
@@ -53,7 +53,7 @@ pub enum SignFormat {
     SignNeg
 }
 
-static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11;
+static DIGIT_E_RADIX: u32 = ('e' as u32) - ('a' as u32) + 11;
 
 /// Converts a number to its string representation as a byte vector.
 /// This is meant to be a common base implementation for all numeric string
@@ -87,7 +87,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11;
 ///   between digit and exponent sign `'p'`.
 pub fn float_to_str_bytes_common<T: Float, U, F>(
     num: T,
-    radix: uint,
+    radix: u32,
     negative_zero: bool,
     sign: SignFormat,
     digits: SignificantDigits,
@@ -156,7 +156,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
         deccum = deccum / radix_gen;
         deccum = deccum.trunc();
 
-        let c = char::from_digit(current_digit.to_int().unwrap() as uint, radix);
+        let c = char::from_digit(current_digit.to_int().unwrap() as u32, radix);
         buf[end] = c.unwrap() as u8;
         end += 1;
 
@@ -211,7 +211,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
             // See note in first loop.
             let current_digit = deccum.trunc().abs();
 
-            let c = char::from_digit(current_digit.to_int().unwrap() as uint,
+            let c = char::from_digit(current_digit.to_int().unwrap() as u32,
                                      radix);
             buf[end] = c.unwrap() as u8;
             end += 1;
@@ -228,7 +228,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
             let ascii2value = |chr: u8| {
                 (chr as char).to_digit(radix).unwrap()
             };
-            let value2ascii = |val: uint| {
+            let value2ascii = |val: u32| {
                 char::from_digit(val, radix).unwrap() as u8
             };
 
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 7740cd6867c..06aba2cb08e 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -2676,9 +2676,9 @@ impl<A: Int> Iterator for ::ops::Range<A> {
     }
 }
 
+// Ranges of u64 and i64 are excluded because they cannot guarantee having
+// a length <= usize::MAX, which is required by ExactSizeIterator.
 range_exact_iter_impl!(usize u8 u16 u32 isize i8 i16 i32);
-#[cfg(target_pointer_width = "64")]
-range_exact_iter_impl!(u64 i64);
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<A: Int> DoubleEndedIterator for ::ops::Range<A> {
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index a122bcb2c7a..7243bd4f0cb 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -64,7 +64,7 @@
 #![feature(int_uint)]
 #![feature(intrinsics, lang_items)]
 #![feature(on_unimplemented)]
-#![feature(simd, unsafe_destructor, slicing_syntax)]
+#![feature(simd, unsafe_destructor)]
 #![feature(staged_api)]
 #![feature(unboxed_closures)]
 
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index 83d070feb8a..b542c9d47f7 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -35,14 +35,27 @@ pub const EPSILON: f32 = 1.19209290e-07_f32;
 
 /// Smallest finite f32 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f32::MIN`")]
 pub const MIN_VALUE: f32 = -3.40282347e+38_f32;
 /// Smallest positive, normalized f32 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f32::MIN_POSITIVE`")]
 pub const MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
 /// Largest finite f32 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f32::MAX`")]
 pub const MAX_VALUE: f32 = 3.40282347e+38_f32;
 
+/// Smallest finite f32 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MIN: f32 = -3.40282347e+38_f32;
+/// Smallest positive, normalized f32 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32;
+/// Largest finite f32 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MAX: f32 = 3.40282347e+38_f32;
+
 #[unstable(feature = "core", reason = "pending integer conventions")]
 pub const MIN_EXP: int = -125;
 #[unstable(feature = "core", reason = "pending integer conventions")]
@@ -215,17 +228,17 @@ impl Float for f32 {
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_value() -> f32 { MIN_VALUE }
+    fn min_value() -> f32 { MIN }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_pos_value(_: Option<f32>) -> f32 { MIN_POS_VALUE }
+    fn min_pos_value(_: Option<f32>) -> f32 { MIN_POSITIVE }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn max_value() -> f32 { MAX_VALUE }
+    fn max_value() -> f32 { MAX }
 
     /// Returns the mantissa, exponent and sign as integers.
     fn integer_decode(self) -> (u64, i16, i8) {
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index ce011b3c2ee..2aae7107548 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -38,14 +38,27 @@ pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
 
 /// Smallest finite f64 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f64::MIN`")]
 pub const MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
 /// Smallest positive, normalized f64 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f64::MIN_POSITIVE`")]
 pub const MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
 /// Largest finite f64 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f64::MAX`")]
 pub const MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
 
+/// Smallest finite f64 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MIN: f64 = -1.7976931348623157e+308_f64;
+/// Smallest positive, normalized f64 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308_f64;
+/// Largest finite f64 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MAX: f64 = 1.7976931348623157e+308_f64;
+
 #[unstable(feature = "core", reason = "pending integer conventions")]
 pub const MIN_EXP: int = -1021;
 #[unstable(feature = "core", reason = "pending integer conventions")]
@@ -222,17 +235,17 @@ impl Float for f64 {
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_value() -> f64 { MIN_VALUE }
+    fn min_value() -> f64 { MIN }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_pos_value(_: Option<f64>) -> f64 { MIN_POS_VALUE }
+    fn min_pos_value(_: Option<f64>) -> f64 { MIN_POSITIVE }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn max_value() -> f64 { MAX_VALUE }
+    fn max_value() -> f64 { MAX }
 
     /// Returns the mantissa, exponent and sign as integers.
     fn integer_decode(self) -> (u64, i16, i8) {
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index b7c5c6640ce..7612469c808 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -956,7 +956,7 @@ macro_rules! impl_to_primitive_float_to_float {
             Some($slf as $DstT)
         } else {
             let n = $slf as f64;
-            let max_value: $SrcT = ::$SrcT::MAX_VALUE;
+            let max_value: $SrcT = ::$SrcT::MAX;
             if -max_value as f64 <= n && n <= max_value as f64 {
                 Some($slf as $DstT)
             } else {
@@ -1331,18 +1331,18 @@ pub trait Float
     /// Returns the smallest finite value that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MIN_VALUE` or `std::f64::MIN_VALUE` as appropriate")]
+                 reason = "use `std::f32::MIN` or `std::f64::MIN` as appropriate")]
     fn min_value() -> Self;
     /// Returns the smallest normalized positive number that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MIN_POS_VALUE` or \
-                           `std::f64::MIN_POS_VALUE` as appropriate")]
+                 reason = "use `std::f32::MIN_POSITIVE` or \
+                           `std::f64::MIN_POSITIVE` as appropriate")]
     fn min_pos_value(unused_self: Option<Self>) -> Self;
     /// Returns the largest finite value that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MAX_VALUE` or `std::f64::MAX_VALUE` as appropriate")]
+                 reason = "use `std::f32::MAX` or `std::f64::MAX` as appropriate")]
     fn max_value() -> Self;
 
     /// Returns true if this value is NaN and false otherwise.
@@ -1432,12 +1432,12 @@ pub trait Float
 #[unstable(feature = "core", reason = "needs reevaluation")]
 pub trait FromStrRadix {
     type Err;
-    fn from_str_radix(str: &str, radix: uint) -> Result<Self, Self::Err>;
+    fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::Err>;
 }
 
 /// A utility function that just calls FromStrRadix::from_str_radix.
 #[unstable(feature = "core", reason = "needs reevaluation")]
-pub fn from_str_radix<T: FromStrRadix>(str: &str, radix: uint)
+pub fn from_str_radix<T: FromStrRadix>(str: &str, radix: u32)
                                        -> Result<T, T::Err> {
     FromStrRadix::from_str_radix(str, radix)
 }
@@ -1501,7 +1501,7 @@ macro_rules! from_str_radix_float_impl {
             /// `None` if the string did not represent a valid number.
             /// Otherwise, `Some(n)` where `n` is the floating-point number
             /// represented by `src`.
-            fn from_str_radix(src: &str, radix: uint)
+            fn from_str_radix(src: &str, radix: u32)
                               -> Result<$T, ParseFloatError> {
                 use self::FloatErrorKind::*;
                 use self::ParseFloatError as PFE;
@@ -1661,7 +1661,7 @@ macro_rules! from_str_radix_int_impl {
         #[stable(feature = "rust1", since = "1.0.0")]
         impl FromStrRadix for $T {
             type Err = ParseIntError;
-            fn from_str_radix(src: &str, radix: uint)
+            fn from_str_radix(src: &str, radix: u32)
                               -> Result<$T, ParseIntError> {
                 use self::IntErrorKind::*;
                 use self::ParseIntError as PIE;
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 2f261b0628f..081c895c317 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -162,7 +162,7 @@ use slice;
 // `Iterator` is an enumeration with one type parameter and two variants,
 // which basically means it must be `Option`.
 
-/// The `Option` type.
+/// The `Option` type. See [the module level documentation](../index.html) for more.
 #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub enum Option<T> {
diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs
index 3fd244b46e3..5cc210df5b4 100644
--- a/src/libcore/raw.rs
+++ b/src/libcore/raw.rs
@@ -21,27 +21,130 @@
 use marker::Copy;
 use mem;
 
-/// The representation of a Rust slice
+/// The representation of a slice like `&[T]`.
+///
+/// This struct is guaranteed to have the layout of types like `&[T]`,
+/// `&str`, and `Box<[T]>`, but is not the type of such slices
+/// (e.g. the fields are not directly accessible on a `&[T]`) nor does
+/// it control that layout (changing the definition will not change
+/// the layout of a `&[T]`). It is only designed to be used by unsafe
+/// code that needs to manipulate the low-level details.
+///
+/// However, it is not recommended to use this type for such code,
+/// since there are alternatives which may be safer:
+///
+/// - Creating a slice from a data pointer and length can be done with
+///   `std::slice::from_raw_parts` or `std::slice::from_raw_parts_mut`
+///   instead of `std::mem::transmute`ing a value of type `Slice`.
+/// - Extracting the data pointer and length from a slice can be
+///   performed with the `as_ptr` (or `as_mut_ptr`) and `len`
+///   methods.
+///
+/// If one does decide to convert a slice value to a `Slice`, the
+/// `Repr` trait in this module provides a method for a safe
+/// conversion from `&[T]` (and `&str`) to a `Slice`, more type-safe
+/// than a call to `transmute`.
+///
+/// # Examples
+///
+/// ```
+/// use std::raw::{self, Repr};
+///
+/// let slice: &[u16] = &[1, 2, 3, 4];
+///
+/// let repr: raw::Slice<u16> = slice.repr();
+/// println!("data pointer = {:?}, length = {}", repr.data, repr.len);
+/// ```
 #[repr(C)]
 pub struct Slice<T> {
     pub data: *const T,
-    pub len: uint,
+    pub len: usize,
 }
 
 impl<T> Copy for Slice<T> {}
 
-/// The representation of a Rust closure
+/// The representation of an old closure.
 #[repr(C)]
 #[derive(Copy)]
+#[unstable(feature = "core")]
+#[deprecated(reason = "unboxed new closures do not have a universal representation; \
+                       `&Fn` (etc) trait objects should use `TraitObject` instead",
+             since= "1.0.0")]
 pub struct Closure {
     pub code: *mut (),
     pub env: *mut (),
 }
 
-/// The representation of a Rust trait object.
+/// The representation of a trait object like `&SomeTrait`.
+///
+/// This struct has the same layout as types like `&SomeTrait` and
+/// `Box<AnotherTrait>`. The [Static and Dynamic Dispatch chapter of the
+/// Book][moreinfo] contains more details about the precise nature of
+/// these internals.
+///
+/// [moreinfo]: ../../book/static-and-dynamic-dispatch.html#representation
+///
+/// `TraitObject` is guaranteed to match layouts, but it is not the
+/// type of trait objects (e.g. the fields are not directly accessible
+/// on a `&SomeTrait`) nor does it control that layout (changing the
+/// definition will not change the layout of a `&SometTrait`). It is
+/// only designed to be used by unsafe code that needs to manipulate
+/// the low-level details.
+///
+/// There is no `Repr` implementation for `TraitObject` because there
+/// is no way to refer to all trait objects generically, so the only
+/// way to create values of this type is with functions like
+/// `std::mem::transmute`. Similarly, the only way to create a true
+/// trait object from a `TraitObject` value is with `transmute`.
+///
+/// Synthesizing a trait object with mismatched types—one where the
+/// vtable does not correspond to the type of the value to which the
+/// data pointer points—is highly likely to lead to undefined
+/// behaviour.
+///
+/// # Examples
+///
+/// ```
+/// use std::mem;
+/// use std::raw;
+///
+/// // an example trait
+/// trait Foo {
+///     fn bar(&self) -> i32;
+/// }
+/// impl Foo for i32 {
+///     fn bar(&self) -> i32 {
+///          *self + 1
+///     }
+/// }
+///
+/// let value: i32 = 123;
+///
+/// // let the compiler make a trait object
+/// let object: &Foo = &value;
+///
+/// // look at the raw representation
+/// let raw_object: raw::TraitObject = unsafe { mem::transmute(object) };
+///
+/// // the data pointer is the address of `value`
+/// assert_eq!(raw_object.data as *const i32, &value as *const _);
+///
+///
+/// let other_value: i32 = 456;
+///
+/// // construct a new object, pointing to a different `i32`, being
+/// // careful to use the `i32` vtable from `object`
+/// let synthesized: &Foo = unsafe {
+///      mem::transmute(raw::TraitObject {
+///          data: &other_value as *const _ as *mut (),
+///          vtable: raw_object.vtable
+///      })
+/// };
 ///
-/// This struct does not have a `Repr` implementation
-/// because there is no way to refer to all trait objects generically.
+/// // it should work just like we constructed a trait object out of
+/// // `other_value` directly
+/// assert_eq!(synthesized.bar(), 457);
+/// ```
 #[repr(C)]
 #[derive(Copy)]
 pub struct TraitObject {
@@ -51,7 +154,7 @@ pub struct TraitObject {
 
 /// This trait is meant to map equivalences between raw structs and their
 /// corresponding rust values.
-pub trait Repr<T> {
+pub unsafe trait Repr<T> {
     /// This function "unwraps" a rust value (without consuming it) into its raw
     /// struct representation. This can be used to read/write different values
     /// for the struct. This is a safe method because by default it does not
@@ -60,5 +163,5 @@ pub trait Repr<T> {
     fn repr(&self) -> T { unsafe { mem::transmute_copy(&self) } }
 }
 
-impl<T> Repr<Slice<T>> for [T] {}
-impl Repr<Slice<u8>> for str {}
+unsafe impl<T> Repr<Slice<T>> for [T] {}
+unsafe impl Repr<Slice<u8>> for str {}
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index cf1df4ac423..097633b7063 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -66,28 +66,28 @@ use raw::Slice as RawSlice;
 pub trait SliceExt {
     type Item;
 
-    fn split_at<'a>(&'a self, mid: uint) -> (&'a [Self::Item], &'a [Self::Item]);
+    fn split_at<'a>(&'a self, mid: usize) -> (&'a [Self::Item], &'a [Self::Item]);
     fn iter<'a>(&'a self) -> Iter<'a, Self::Item>;
     fn split<'a, P>(&'a self, pred: P) -> Split<'a, Self::Item, P>
                     where P: FnMut(&Self::Item) -> bool;
-    fn splitn<'a, P>(&'a self, n: uint, pred: P) -> SplitN<'a, Self::Item, P>
+    fn splitn<'a, P>(&'a self, n: usize, pred: P) -> SplitN<'a, Self::Item, P>
                      where P: FnMut(&Self::Item) -> bool;
-    fn rsplitn<'a, P>(&'a self,  n: uint, pred: P) -> RSplitN<'a, Self::Item, P>
+    fn rsplitn<'a, P>(&'a self,  n: usize, pred: P) -> RSplitN<'a, Self::Item, P>
                       where P: FnMut(&Self::Item) -> bool;
-    fn windows<'a>(&'a self, size: uint) -> Windows<'a, Self::Item>;
-    fn chunks<'a>(&'a self, size: uint) -> Chunks<'a, Self::Item>;
-    fn get<'a>(&'a self, index: uint) -> Option<&'a Self::Item>;
+    fn windows<'a>(&'a self, size: usize) -> Windows<'a, Self::Item>;
+    fn chunks<'a>(&'a self, size: usize) -> Chunks<'a, Self::Item>;
+    fn get<'a>(&'a self, index: usize) -> Option<&'a Self::Item>;
     fn first<'a>(&'a self) -> Option<&'a Self::Item>;
     fn tail<'a>(&'a self) -> &'a [Self::Item];
     fn init<'a>(&'a self) -> &'a [Self::Item];
     fn last<'a>(&'a self) -> Option<&'a Self::Item>;
-    unsafe fn get_unchecked<'a>(&'a self, index: uint) -> &'a Self::Item;
+    unsafe fn get_unchecked<'a>(&'a self, index: usize) -> &'a Self::Item;
     fn as_ptr(&self) -> *const Self::Item;
-    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;
-    fn len(&self) -> uint;
+    fn len(&self) -> usize;
     fn is_empty(&self) -> bool { self.len() == 0 }
-    fn get_mut<'a>(&'a mut self, index: uint) -> Option<&'a mut Self::Item>;
+    fn get_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut Self::Item>;
     fn as_mut_slice<'a>(&'a mut self) -> &'a mut [Self::Item];
     fn iter_mut<'a>(&'a mut self) -> IterMut<'a, Self::Item>;
     fn first_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>;
@@ -96,20 +96,20 @@ pub trait SliceExt {
     fn last_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>;
     fn split_mut<'a, P>(&'a mut self, pred: P) -> SplitMut<'a, Self::Item, P>
                         where P: FnMut(&Self::Item) -> bool;
-    fn splitn_mut<P>(&mut self, n: uint, pred: P) -> SplitNMut<Self::Item, P>
+    fn splitn_mut<P>(&mut self, n: usize, pred: P) -> SplitNMut<Self::Item, P>
                      where P: FnMut(&Self::Item) -> bool;
-    fn rsplitn_mut<P>(&mut self,  n: uint, pred: P) -> RSplitNMut<Self::Item, P>
+    fn rsplitn_mut<P>(&mut self,  n: usize, pred: P) -> RSplitNMut<Self::Item, P>
                       where P: FnMut(&Self::Item) -> bool;
-    fn chunks_mut<'a>(&'a mut self, chunk_size: uint) -> ChunksMut<'a, Self::Item>;
-    fn swap(&mut self, a: uint, b: uint);
-    fn split_at_mut<'a>(&'a mut self, mid: uint) -> (&'a mut [Self::Item], &'a mut [Self::Item]);
+    fn chunks_mut<'a>(&'a mut self, chunk_size: usize) -> ChunksMut<'a, Self::Item>;
+    fn swap(&mut self, a: usize, b: usize);
+    fn split_at_mut<'a>(&'a mut self, mid: usize) -> (&'a mut [Self::Item], &'a mut [Self::Item]);
     fn reverse(&mut self);
-    unsafe fn get_unchecked_mut<'a>(&'a mut self, index: uint) -> &'a mut Self::Item;
+    unsafe fn get_unchecked_mut<'a>(&'a mut self, index: usize) -> &'a mut Self::Item;
     fn as_mut_ptr(&mut self) -> *mut Self::Item;
 
-    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;
 
-    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;
 
     fn contains(&self, x: &Self::Item) -> bool where Self::Item: PartialEq;
 
@@ -117,11 +117,11 @@ pub trait SliceExt {
 
     fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
 
-    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;
     fn next_permutation(&mut self) -> bool where Self::Item: Ord;
     fn prev_permutation(&mut self) -> bool where Self::Item: Ord;
 
-    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;
 }
 
 #[unstable(feature = "core")]
@@ -129,7 +129,7 @@ impl<T> SliceExt for [T] {
     type Item = T;
 
     #[inline]
-    fn split_at(&self, mid: uint) -> (&[T], &[T]) {
+    fn split_at(&self, mid: usize) -> (&[T], &[T]) {
         (&self[..mid], &self[mid..])
     }
 
@@ -139,11 +139,11 @@ impl<T> SliceExt for [T] {
             let p = self.as_ptr();
             if mem::size_of::<T>() == 0 {
                 Iter {ptr: p,
-                      end: (p as uint + self.len()) as *const T,
+                      end: (p as usize + self.len()) as *const T,
                       marker: marker::ContravariantLifetime::<'a>}
             } else {
                 Iter {ptr: p,
-                      end: p.offset(self.len() as int),
+                      end: p.offset(self.len() as isize),
                       marker: marker::ContravariantLifetime::<'a>}
             }
         }
@@ -159,7 +159,7 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn splitn<'a, P>(&'a self, n: uint, pred: P) -> SplitN<'a, T, P> where
+    fn splitn<'a, P>(&'a self, n: usize, pred: P) -> SplitN<'a, T, P> where
         P: FnMut(&T) -> bool,
     {
         SplitN {
@@ -172,7 +172,7 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn rsplitn<'a, P>(&'a self, n: uint, pred: P) -> RSplitN<'a, T, P> where
+    fn rsplitn<'a, P>(&'a self, n: usize, pred: P) -> RSplitN<'a, T, P> where
         P: FnMut(&T) -> bool,
     {
         RSplitN {
@@ -185,19 +185,19 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn windows(&self, size: uint) -> Windows<T> {
+    fn windows(&self, size: usize) -> Windows<T> {
         assert!(size != 0);
         Windows { v: self, size: size }
     }
 
     #[inline]
-    fn chunks(&self, size: uint) -> Chunks<T> {
+    fn chunks(&self, size: usize) -> Chunks<T> {
         assert!(size != 0);
         Chunks { v: self, size: size }
     }
 
     #[inline]
-    fn get(&self, index: uint) -> Option<&T> {
+    fn get(&self, index: usize) -> Option<&T> {
         if index < self.len() { Some(&self[index]) } else { None }
     }
 
@@ -220,8 +220,8 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    unsafe fn get_unchecked(&self, index: uint) -> &T {
-        transmute(self.repr().data.offset(index as int))
+    unsafe fn get_unchecked(&self, index: usize) -> &T {
+        transmute(self.repr().data.offset(index as isize))
     }
 
     #[inline]
@@ -230,11 +230,11 @@ impl<T> SliceExt for [T] {
     }
 
     #[unstable(feature = "core")]
-    fn binary_search_by<F>(&self, mut f: F) -> Result<uint, uint> where
+    fn binary_search_by<F>(&self, mut f: F) -> Result<usize, usize> where
         F: FnMut(&T) -> Ordering
     {
-        let mut base : uint = 0;
-        let mut lim : uint = self.len();
+        let mut base : usize = 0;
+        let mut lim : usize = self.len();
 
         while lim != 0 {
             let ix = base + (lim >> 1);
@@ -252,10 +252,10 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn len(&self) -> uint { self.repr().len }
+    fn len(&self) -> usize { self.repr().len }
 
     #[inline]
-    fn get_mut(&mut self, index: uint) -> Option<&mut T> {
+    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
         if index < self.len() { Some(&mut self[index]) } else { None }
     }
 
@@ -263,7 +263,7 @@ impl<T> SliceExt for [T] {
     fn as_mut_slice(&mut self) -> &mut [T] { self }
 
     #[inline]
-    fn split_at_mut(&mut self, mid: uint) -> (&mut [T], &mut [T]) {
+    fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) {
         unsafe {
             let self2: &mut [T] = mem::transmute_copy(&self);
 
@@ -278,11 +278,11 @@ impl<T> SliceExt for [T] {
             let p = self.as_mut_ptr();
             if mem::size_of::<T>() == 0 {
                 IterMut {ptr: p,
-                         end: (p as uint + self.len()) as *mut T,
+                         end: (p as usize + self.len()) as *mut T,
                          marker: marker::ContravariantLifetime::<'a>}
             } else {
                 IterMut {ptr: p,
-                         end: p.offset(self.len() as int),
+                         end: p.offset(self.len() as isize),
                          marker: marker::ContravariantLifetime::<'a>}
             }
         }
@@ -317,7 +317,7 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn splitn_mut<'a, P>(&'a mut self, n: uint, pred: P) -> SplitNMut<'a, T, P> where
+    fn splitn_mut<'a, P>(&'a mut self, n: usize, pred: P) -> SplitNMut<'a, T, P> where
         P: FnMut(&T) -> bool
     {
         SplitNMut {
@@ -330,7 +330,7 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn rsplitn_mut<'a, P>(&'a mut self, n: uint, pred: P) -> RSplitNMut<'a, T, P> where
+    fn rsplitn_mut<'a, P>(&'a mut self, n: usize, pred: P) -> RSplitNMut<'a, T, P> where
         P: FnMut(&T) -> bool,
     {
         RSplitNMut {
@@ -343,12 +343,12 @@ impl<T> SliceExt for [T] {
    }
 
     #[inline]
-    fn chunks_mut(&mut self, chunk_size: uint) -> ChunksMut<T> {
+    fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<T> {
         assert!(chunk_size > 0);
         ChunksMut { v: self, chunk_size: chunk_size }
     }
 
-    fn swap(&mut self, a: uint, b: uint) {
+    fn swap(&mut self, a: usize, b: usize) {
         unsafe {
             // Can't take two mutable loans from one vector, so instead just cast
             // them to their raw pointers to do the swap
@@ -359,7 +359,7 @@ impl<T> SliceExt for [T] {
     }
 
     fn reverse(&mut self) {
-        let mut i: uint = 0;
+        let mut i: usize = 0;
         let ln = self.len();
         while i < ln / 2 {
             // Unsafe swap to avoid the bounds check in safe swap.
@@ -373,8 +373,8 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    unsafe fn get_unchecked_mut(&mut self, index: uint) -> &mut T {
-        transmute((self.repr().data as *mut T).offset(index as int))
+    unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T {
+        transmute((self.repr().data as *mut T).offset(index as isize))
     }
 
     #[inline]
@@ -383,12 +383,12 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn position_elem(&self, x: &T) -> Option<uint> where T: PartialEq {
+    fn position_elem(&self, x: &T) -> Option<usize> where T: PartialEq {
         self.iter().position(|y| *x == *y)
     }
 
     #[inline]
-    fn rposition_elem(&self, t: &T) -> Option<uint> where T: PartialEq {
+    fn rposition_elem(&self, t: &T) -> Option<usize> where T: PartialEq {
         self.iter().rposition(|x| *x == *t)
     }
 
@@ -410,7 +410,7 @@ impl<T> SliceExt for [T] {
     }
 
     #[unstable(feature = "core")]
-    fn binary_search(&self, x: &T) -> Result<uint, uint> where T: Ord {
+    fn binary_search(&self, x: &T) -> Result<usize, usize> where T: Ord {
         self.binary_search_by(|p| p.cmp(x))
     }
 
@@ -477,7 +477,7 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn clone_from_slice(&mut self, src: &[T]) -> uint where T: Clone {
+    fn clone_from_slice(&mut self, src: &[T]) -> usize where T: Clone {
         let min = cmp::min(self.len(), src.len());
         let dst = &mut self[.. min];
         let src = &src[.. min];
@@ -489,53 +489,53 @@ impl<T> SliceExt for [T] {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::Index<uint> for [T] {
+impl<T> ops::Index<usize> for [T] {
     type Output = T;
 
-    fn index(&self, &index: &uint) -> &T {
+    fn index(&self, &index: &usize) -> &T {
         assert!(index < self.len());
 
-        unsafe { mem::transmute(self.repr().data.offset(index as int)) }
+        unsafe { mem::transmute(self.repr().data.offset(index as isize)) }
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::IndexMut<uint> for [T] {
-    fn index_mut(&mut self, &index: &uint) -> &mut T {
+impl<T> ops::IndexMut<usize> for [T] {
+    fn index_mut(&mut self, &index: &usize) -> &mut T {
         assert!(index < self.len());
 
-        unsafe { mem::transmute(self.repr().data.offset(index as int)) }
+        unsafe { mem::transmute(self.repr().data.offset(index as isize)) }
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::Index<ops::Range<uint>> for [T] {
+impl<T> ops::Index<ops::Range<usize>> for [T] {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::Range<uint>) -> &[T] {
+    fn index(&self, index: &ops::Range<usize>) -> &[T] {
         assert!(index.start <= index.end);
         assert!(index.end <= self.len());
         unsafe {
             transmute(RawSlice {
-                    data: self.as_ptr().offset(index.start as int),
+                    data: self.as_ptr().offset(index.start as isize),
                     len: index.end - index.start
                 })
         }
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::Index<ops::RangeTo<uint>> for [T] {
+impl<T> ops::Index<ops::RangeTo<usize>> for [T] {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::RangeTo<uint>) -> &[T] {
+    fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
         self.index(&ops::Range{ start: 0, end: index.end })
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::Index<ops::RangeFrom<uint>> for [T] {
+impl<T> ops::Index<ops::RangeFrom<usize>> for [T] {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::RangeFrom<uint>) -> &[T] {
+    fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
         self.index(&ops::Range{ start: index.start, end: self.len() })
     }
 }
@@ -549,30 +549,30 @@ impl<T> ops::Index<RangeFull> for [T] {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::IndexMut<ops::Range<uint>> for [T] {
+impl<T> ops::IndexMut<ops::Range<usize>> for [T] {
     #[inline]
-    fn index_mut(&mut self, index: &ops::Range<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
         assert!(index.start <= index.end);
         assert!(index.end <= self.len());
         unsafe {
             transmute(RawSlice {
-                    data: self.as_ptr().offset(index.start as int),
+                    data: self.as_ptr().offset(index.start as isize),
                     len: index.end - index.start
                 })
         }
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::IndexMut<ops::RangeTo<uint>> for [T] {
+impl<T> ops::IndexMut<ops::RangeTo<usize>> for [T] {
     #[inline]
-    fn index_mut(&mut self, index: &ops::RangeTo<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
         self.index_mut(&ops::Range{ start: 0, end: index.end })
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ops::IndexMut<ops::RangeFrom<uint>> for [T] {
+impl<T> ops::IndexMut<ops::RangeFrom<usize>> for [T] {
     #[inline]
-    fn index_mut(&mut self, index: &ops::RangeFrom<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
         let len = self.len();
         self.index_mut(&ops::Range{ start: index.start, end: len })
     }
@@ -660,7 +660,7 @@ macro_rules! iterator {
                             // purposefully don't use 'ptr.offset' because for
                             // vectors with 0-size elements this would return the
                             // same pointer.
-                            self.ptr = transmute(self.ptr as uint + 1);
+                            self.ptr = transmute(self.ptr as usize + 1);
 
                             // Use a non-null pointer value
                             Some(&mut *(1 as *mut _))
@@ -675,8 +675,8 @@ macro_rules! iterator {
             }
 
             #[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))
@@ -694,7 +694,7 @@ macro_rules! iterator {
                     } else {
                         if mem::size_of::<T>() == 0 {
                             // See above for why 'ptr.offset' isn't used
-                            self.end = transmute(self.end as uint - 1);
+                            self.end = transmute(self.end as usize - 1);
 
                             // Use a non-null pointer value
                             Some(&mut *(1 as *mut _))
@@ -712,7 +712,7 @@ macro_rules! iterator {
 
 macro_rules! make_slice {
     ($t: ty => $result: ty: $start: expr, $end: expr) => {{
-        let diff = $end as uint - $start as uint;
+        let diff = $end as usize - $start as usize;
         let len = if mem::size_of::<T>() == 0 {
             diff
         } else {
@@ -733,28 +733,28 @@ pub struct Iter<'a, T: 'a> {
 }
 
 #[unstable(feature = "core")]
-impl<'a, T> ops::Index<ops::Range<uint>> for Iter<'a, T> {
+impl<'a, T> ops::Index<ops::Range<usize>> for Iter<'a, T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::Range<uint>) -> &[T] {
+    fn index(&self, index: &ops::Range<usize>) -> &[T] {
         self.as_slice().index(index)
     }
 }
 
 #[unstable(feature = "core")]
-impl<'a, T> ops::Index<ops::RangeTo<uint>> for Iter<'a, T> {
+impl<'a, T> ops::Index<ops::RangeTo<usize>> for Iter<'a, T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::RangeTo<uint>) -> &[T] {
+    fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
         self.as_slice().index(index)
     }
 }
 
 #[unstable(feature = "core")]
-impl<'a, T> ops::Index<ops::RangeFrom<uint>> for Iter<'a, T> {
+impl<'a, T> ops::Index<ops::RangeFrom<usize>> for Iter<'a, T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::RangeFrom<uint>) -> &[T] {
+    fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
         self.as_slice().index(index)
     }
 }
@@ -792,20 +792,20 @@ impl<'a, T> Clone for Iter<'a, T> {
 #[unstable(feature = "core", reason = "trait is experimental")]
 impl<'a, T> RandomAccessIterator for Iter<'a, T> {
     #[inline]
-    fn indexable(&self) -> uint {
+    fn indexable(&self) -> usize {
         let (exact, _) = self.size_hint();
         exact
     }
 
     #[inline]
-    fn idx(&mut self, index: uint) -> Option<&'a T> {
+    fn idx(&mut self, index: usize) -> Option<&'a T> {
         unsafe {
             if index < self.indexable() {
                 if mem::size_of::<T>() == 0 {
                     // Use a non-null pointer value
                     Some(&mut *(1 as *mut _))
                 } else {
-                    Some(transmute(self.ptr.offset(index as int)))
+                    Some(transmute(self.ptr.offset(index as isize)))
                 }
             } else {
                 None
@@ -824,26 +824,26 @@ pub struct IterMut<'a, T: 'a> {
 
 
 #[unstable(feature = "core")]
-impl<'a, T> ops::Index<ops::Range<uint>> for IterMut<'a, T> {
+impl<'a, T> ops::Index<ops::Range<usize>> for IterMut<'a, T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::Range<uint>) -> &[T] {
+    fn index(&self, index: &ops::Range<usize>) -> &[T] {
         self.index(&RangeFull).index(index)
     }
 }
 #[unstable(feature = "core")]
-impl<'a, T> ops::Index<ops::RangeTo<uint>> for IterMut<'a, T> {
+impl<'a, T> ops::Index<ops::RangeTo<usize>> for IterMut<'a, T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::RangeTo<uint>) -> &[T] {
+    fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
         self.index(&RangeFull).index(index)
     }
 }
 #[unstable(feature = "core")]
-impl<'a, T> ops::Index<ops::RangeFrom<uint>> for IterMut<'a, T> {
+impl<'a, T> ops::Index<ops::RangeFrom<usize>> for IterMut<'a, T> {
     type Output = [T];
     #[inline]
-    fn index(&self, index: &ops::RangeFrom<uint>) -> &[T] {
+    fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
         self.index(&RangeFull).index(index)
     }
 }
@@ -857,23 +857,23 @@ impl<'a, T> ops::Index<RangeFull> for IterMut<'a, T> {
 }
 
 #[unstable(feature = "core")]
-impl<'a, T> ops::IndexMut<ops::Range<uint>> for IterMut<'a, T> {
+impl<'a, T> ops::IndexMut<ops::Range<usize>> for IterMut<'a, T> {
     #[inline]
-    fn index_mut(&mut self, index: &ops::Range<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
         self.index_mut(&RangeFull).index_mut(index)
     }
 }
 #[unstable(feature = "core")]
-impl<'a, T> ops::IndexMut<ops::RangeTo<uint>> for IterMut<'a, T> {
+impl<'a, T> ops::IndexMut<ops::RangeTo<usize>> for IterMut<'a, T> {
     #[inline]
-    fn index_mut(&mut self, index: &ops::RangeTo<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
         self.index_mut(&RangeFull).index_mut(index)
     }
 }
 #[unstable(feature = "core")]
-impl<'a, T> ops::IndexMut<ops::RangeFrom<uint>> for IterMut<'a, T> {
+impl<'a, T> ops::IndexMut<ops::RangeFrom<usize>> for IterMut<'a, T> {
     #[inline]
-    fn index_mut(&mut self, index: &ops::RangeFrom<uint>) -> &mut [T] {
+    fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
         self.index_mut(&RangeFull).index_mut(index)
     }
 }
@@ -952,7 +952,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         if self.finished {
             (0, Some(0))
         } else {
@@ -1030,7 +1030,7 @@ impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         if self.finished {
             (0, Some(0))
         } else {
@@ -1070,7 +1070,7 @@ impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where
 /// times.
 struct GenericSplitN<I> {
     iter: I,
-    count: uint,
+    count: usize,
     invert: bool
 }
 
@@ -1088,7 +1088,7 @@ impl<T, I: SplitIter<Item=T>> Iterator for GenericSplitN<I> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let (lower, upper_opt) = self.iter.size_hint();
         (lower, upper_opt.map(|upper| cmp::min(self.count + 1, upper)))
     }
@@ -1138,7 +1138,7 @@ macro_rules! forward_iterator {
             }
 
             #[inline]
-            fn size_hint(&self) -> (uint, Option<uint>) {
+            fn size_hint(&self) -> (usize, Option<usize>) {
                 self.inner.size_hint()
             }
         }
@@ -1155,7 +1155,7 @@ forward_iterator! { RSplitNMut: T, &'a mut [T] }
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Windows<'a, T:'a> {
     v: &'a [T],
-    size: uint
+    size: usize
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -1174,7 +1174,7 @@ impl<'a, T> Iterator for Windows<'a, T> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         if self.size > self.v.len() {
             (0, Some(0))
         } else {
@@ -1204,12 +1204,12 @@ impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
 #[unstable(feature = "core", reason = "trait is experimental")]
 impl<'a, T> RandomAccessIterator for Windows<'a, T> {
     #[inline]
-    fn indexable(&self) -> uint {
+    fn indexable(&self) -> usize {
         self.size_hint().0
     }
 
     #[inline]
-    fn idx(&mut self, index: uint) -> Option<&'a [T]> {
+    fn idx(&mut self, index: usize) -> Option<&'a [T]> {
         if index + self.size > self.v.len() {
             None
         } else {
@@ -1227,7 +1227,7 @@ impl<'a, T> RandomAccessIterator for Windows<'a, T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Chunks<'a, T:'a> {
     v: &'a [T],
-    size: uint
+    size: usize
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -1247,7 +1247,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         if self.v.len() == 0 {
             (0, Some(0))
         } else {
@@ -1281,12 +1281,12 @@ impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
 #[unstable(feature = "core", reason = "trait is experimental")]
 impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
     #[inline]
-    fn indexable(&self) -> uint {
+    fn indexable(&self) -> usize {
         self.v.len()/self.size + if self.v.len() % self.size != 0 { 1 } else { 0 }
     }
 
     #[inline]
-    fn idx(&mut self, index: uint) -> Option<&'a [T]> {
+    fn idx(&mut self, index: usize) -> Option<&'a [T]> {
         if index < self.indexable() {
             let lo = index * self.size;
             let mut hi = lo + self.size;
@@ -1305,7 +1305,7 @@ impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct ChunksMut<'a, T:'a> {
     v: &'a mut [T],
-    chunk_size: uint
+    chunk_size: usize
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -1326,7 +1326,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         if self.v.len() == 0 {
             (0, Some(0))
         } else {
@@ -1402,7 +1402,7 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
 /// use std::slice;
 ///
 /// // manifest a slice out of thin air!
-/// let ptr = 0x1234 as *const uint;
+/// let ptr = 0x1234 as *const usize;
 /// let amt = 10;
 /// unsafe {
 ///     let slice = slice::from_raw_parts(ptr, amt);
@@ -1410,7 +1410,7 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
 /// ```
 #[inline]
 #[unstable(feature = "core")]
-pub unsafe fn from_raw_parts<'a, T>(p: *const T, len: uint) -> &'a [T] {
+pub unsafe fn from_raw_parts<'a, T>(p: *const T, len: usize) -> &'a [T] {
     transmute(RawSlice { data: p, len: len })
 }
 
@@ -1422,7 +1422,7 @@ pub unsafe fn from_raw_parts<'a, T>(p: *const T, len: uint) -> &'a [T] {
 /// mutable slice.
 #[inline]
 #[unstable(feature = "core")]
-pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: uint) -> &'a mut [T] {
+pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] {
     transmute(RawSlice { data: p, len: len })
 }
 
@@ -1445,7 +1445,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: uint) -> &'a mut [T] {
 /// use std::slice;
 ///
 /// // manifest a slice out of thin air!
-/// let ptr = 0x1234 as *const uint;
+/// let ptr = 0x1234 as *const usize;
 /// let amt = 10;
 /// unsafe {
 ///     let slice = slice::from_raw_buf(&ptr, amt);
@@ -1455,7 +1455,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: uint) -> &'a mut [T] {
 #[unstable(feature = "core")]
 #[deprecated(since = "1.0.0",
              reason = "use from_raw_parts")]
-pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] {
+pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: usize) -> &'a [T] {
     transmute(RawSlice { data: *p, len: len })
 }
 
@@ -1469,7 +1469,7 @@ pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] {
 #[unstable(feature = "core")]
 #[deprecated(since = "1.0.0",
              reason = "use from_raw_parts_mut")]
-pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] {
+pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: usize) -> &'a mut [T] {
     transmute(RawSlice { data: *p, len: len })
 }
 
@@ -1606,4 +1606,4 @@ impl_int_slices! { u8,   i8  }
 impl_int_slices! { u16,  i16 }
 impl_int_slices! { u32,  i32 }
 impl_int_slices! { u64,  i64 }
-impl_int_slices! { uint, int }
+impl_int_slices! { usize, isize }
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 747152a8244..ce26abe606d 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -41,7 +41,7 @@ macro_rules! delegate_iter {
         delegate_iter!{$te : $ti}
         impl<'a> ExactSizeIterator for $ti {
             #[inline]
-            fn len(&self) -> uint {
+            fn len(&self) -> usize {
                 self.0.len()
             }
         }
@@ -56,7 +56,7 @@ macro_rules! delegate_iter {
                 self.0.next()
             }
             #[inline]
-            fn size_hint(&self) -> (uint, Option<uint>) {
+            fn size_hint(&self) -> (usize, Option<usize>) {
                 self.0.size_hint()
             }
         }
@@ -78,7 +78,7 @@ macro_rules! delegate_iter {
                 self.0.next()
             }
             #[inline]
-            fn size_hint(&self) -> (uint, Option<uint>) {
+            fn size_hint(&self) -> (usize, Option<usize>) {
                 self.0.size_hint()
             }
         }
@@ -100,7 +100,7 @@ macro_rules! delegate_iter {
                 self.0.next()
             }
             #[inline]
-            fn size_hint(&self) -> (uint, Option<uint>) {
+            fn size_hint(&self) -> (usize, Option<usize>) {
                 self.0.size_hint()
             }
         }
@@ -178,7 +178,7 @@ pub enum Utf8Error {
     /// The offset is guaranteed to be in bounds of the slice in question, and
     /// the byte at the specified offset was the first invalid byte in the
     /// sequence detected.
-    InvalidByte(uint),
+    InvalidByte(usize),
 
     /// The byte slice was invalid because more bytes were needed but no more
     /// bytes were available.
@@ -227,7 +227,7 @@ pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str {
 pub unsafe fn from_c_str(s: *const i8) -> &'static str {
     let s = s as *const u8;
     let mut len = 0;
-    while *s.offset(len as int) != 0 {
+    while *s.offset(len as isize) != 0 {
         len += 1;
     }
     let v: &'static [u8] = ::mem::transmute(Slice { data: s, len: len });
@@ -250,7 +250,7 @@ impl CharEq for char {
     fn matches(&mut self, c: char) -> bool { *self == c }
 
     #[inline]
-    fn only_ascii(&self) -> bool { (*self as uint) < 128 }
+    fn only_ascii(&self) -> bool { (*self as u32) < 128 }
 }
 
 impl<F> CharEq for F where F: FnMut(char) -> bool {
@@ -383,7 +383,7 @@ impl<'a> Iterator for Chars<'a> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let (len, _) = self.iter.size_hint();
         (len.saturating_add(3) / 4, Some(len))
     }
@@ -428,16 +428,16 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
 #[derive(Clone)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct CharIndices<'a> {
-    front_offset: uint,
+    front_offset: usize,
     iter: Chars<'a>,
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for CharIndices<'a> {
-    type Item = (uint, char);
+    type Item = (usize, char);
 
     #[inline]
-    fn next(&mut self) -> Option<(uint, char)> {
+    fn next(&mut self) -> Option<(usize, char)> {
         let (pre_len, _) = self.iter.iter.size_hint();
         match self.iter.next() {
             None => None,
@@ -451,7 +451,7 @@ impl<'a> Iterator for CharIndices<'a> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         self.iter.size_hint()
     }
 }
@@ -459,7 +459,7 @@ impl<'a> Iterator for CharIndices<'a> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> DoubleEndedIterator for CharIndices<'a> {
     #[inline]
-    fn next_back(&mut self) -> Option<(uint, char)> {
+    fn next_back(&mut self) -> Option<(usize, char)> {
         match self.iter.next_back() {
             None => None,
             Some(ch) => {
@@ -512,7 +512,7 @@ struct CharSplits<'a, Sep> {
 struct CharSplitsN<'a, Sep> {
     iter: CharSplits<'a, Sep>,
     /// The number of splits remaining
-    count: uint,
+    count: usize,
     invert: bool,
 }
 
@@ -636,7 +636,7 @@ impl<'a, Sep: CharEq> Iterator for CharSplitsN<'a, Sep> {
 /// within a larger string using naive search
 #[derive(Clone)]
 struct NaiveSearcher {
-    position: uint
+    position: usize
 }
 
 impl NaiveSearcher {
@@ -644,7 +644,7 @@ impl NaiveSearcher {
         NaiveSearcher { position: 0 }
     }
 
-    fn next(&mut self, haystack: &[u8], needle: &[u8]) -> Option<(uint, uint)> {
+    fn next(&mut self, haystack: &[u8], needle: &[u8]) -> Option<(usize, usize)> {
         while self.position + needle.len() <= haystack.len() {
             if &haystack[self.position .. self.position + needle.len()] == needle {
                 let match_pos = self.position;
@@ -663,13 +663,13 @@ impl NaiveSearcher {
 #[derive(Clone)]
 struct TwoWaySearcher {
     // constants
-    crit_pos: uint,
-    period: uint,
+    crit_pos: usize,
+    period: usize,
     byteset: u64,
 
     // variables
-    position: uint,
-    memory: uint
+    position: usize,
+    memory: usize
 }
 
 /*
@@ -756,7 +756,7 @@ impl TwoWaySearcher {
 
         // This isn't in the original algorithm, as far as I'm aware.
         let byteset = needle.iter()
-                            .fold(0, |a, &b| (1 << ((b & 0x3f) as uint)) | a);
+                            .fold(0, |a, &b| (1 << ((b & 0x3f) as usize)) | a);
 
         // A particularly readable explanation of what's going on here can be found
         // in Crochemore and Rytter's book "Text Algorithms", ch 13. Specifically
@@ -794,7 +794,8 @@ impl TwoWaySearcher {
     // How far we can jump when we encounter a mismatch is all based on the fact
     // that (u, v) is a critical factorization for the needle.
     #[inline]
-    fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> Option<(uint, uint)> {
+    fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool)
+            -> Option<(usize, usize)> {
         'search: loop {
             // Check that we have room to search in
             if self.position + needle.len() > haystack.len() {
@@ -804,7 +805,7 @@ impl TwoWaySearcher {
             // Quickly skip by large portions unrelated to our substring
             if (self.byteset >>
                     ((haystack[self.position + needle.len() - 1] & 0x3f)
-                     as uint)) & 1 == 0 {
+                     as usize)) & 1 == 0 {
                 self.position += needle.len();
                 if !long_period {
                     self.memory = 0;
@@ -851,7 +852,7 @@ impl TwoWaySearcher {
     // Specifically, returns (i, p), where i is the starting index of v in some
     // critical factorization (u, v) and p = period(v)
     #[inline]
-    fn maximal_suffix(arr: &[u8], reversed: bool) -> (uint, uint) {
+    fn maximal_suffix(arr: &[u8], reversed: bool) -> (usize, usize) {
         let mut left = -1; // Corresponds to i in the paper
         let mut right = 0; // Corresponds to j in the paper
         let mut offset = 1; // Corresponds to k in the paper
@@ -937,16 +938,16 @@ pub struct MatchIndices<'a> {
 #[unstable(feature = "core", reason = "type may be removed")]
 pub struct SplitStr<'a> {
     it: MatchIndices<'a>,
-    last_end: uint,
+    last_end: usize,
     finished: bool
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for MatchIndices<'a> {
-    type Item = (uint, uint);
+    type Item = (usize, usize);
 
     #[inline]
-    fn next(&mut self) -> Option<(uint, uint)> {
+    fn next(&mut self) -> Option<(usize, usize)> {
         match self.searcher {
             Naive(ref mut searcher)
                 => searcher.next(self.haystack.as_bytes(), self.needle.as_bytes()),
@@ -991,8 +992,9 @@ Section: Comparing strings
 /// to compare &[u8] byte slices that are not necessarily valid UTF-8.
 #[inline]
 fn eq_slice_(a: &str, b: &str) -> bool {
+    // NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
     #[allow(improper_ctypes)]
-    extern { fn memcmp(s1: *const i8, s2: *const i8, n: uint) -> i32; }
+    extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
     a.len() == b.len() && unsafe {
         memcmp(a.as_ptr() as *const i8,
                b.as_ptr() as *const i8,
@@ -1049,7 +1051,7 @@ fn run_utf8_validation_iterator(iter: &mut slice::Iter<u8>)
         // ASCII characters are always valid, so only large
         // bytes need more examination.
         if first >= 128 {
-            let w = UTF8_CHAR_WIDTH[first as uint] as uint;
+            let w = UTF8_CHAR_WIDTH[first as usize] as usize;
             let second = next!();
             // 2-byte encoding is for codepoints  \u{0080} to  \u{07ff}
             //        first  C2 80        last DF BF
@@ -1124,7 +1126,7 @@ pub struct CharRange {
     /// Current `char`
     pub ch: char,
     /// Index of the first byte of the next `char`
-    pub next: uint,
+    pub next: usize,
 }
 
 /// Mask of the value bits of a continuation byte
@@ -1209,10 +1211,10 @@ mod traits {
     /// // &s[3 .. 100];
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    impl ops::Index<ops::Range<uint>> for str {
+    impl ops::Index<ops::Range<usize>> for str {
         type Output = str;
         #[inline]
-        fn index(&self, index: &ops::Range<uint>) -> &str {
+        fn index(&self, index: &ops::Range<usize>) -> &str {
             // is_char_boundary checks that the index is in [0, .len()]
             if index.start <= index.end &&
                self.is_char_boundary(index.start) &&
@@ -1232,10 +1234,10 @@ mod traits {
     /// Panics when `end` does not point to a valid character, or is
     /// out of bounds.
     #[stable(feature = "rust1", since = "1.0.0")]
-    impl ops::Index<ops::RangeTo<uint>> for str {
+    impl ops::Index<ops::RangeTo<usize>> for str {
         type Output = str;
         #[inline]
-        fn index(&self, index: &ops::RangeTo<uint>) -> &str {
+        fn index(&self, index: &ops::RangeTo<usize>) -> &str {
             // is_char_boundary checks that the index is in [0, .len()]
             if self.is_char_boundary(index.end) {
                 unsafe { self.slice_unchecked(0, index.end) }
@@ -1252,10 +1254,10 @@ mod traits {
     /// Panics when `begin` does not point to a valid character, or is
     /// out of bounds.
     #[stable(feature = "rust1", since = "1.0.0")]
-    impl ops::Index<ops::RangeFrom<uint>> for str {
+    impl ops::Index<ops::RangeFrom<usize>> for str {
         type Output = str;
         #[inline]
-        fn index(&self, index: &ops::RangeFrom<uint>) -> &str {
+        fn index(&self, index: &ops::RangeFrom<usize>) -> &str {
             // is_char_boundary checks that the index is in [0, .len()]
             if self.is_char_boundary(index.start) {
                 unsafe { self.slice_unchecked(index.start, self.len()) }
@@ -1332,40 +1334,40 @@ pub trait StrExt {
     fn bytes<'a>(&'a self) -> Bytes<'a>;
     fn char_indices<'a>(&'a self) -> CharIndices<'a>;
     fn split<'a, P: CharEq>(&'a self, pat: P) -> Split<'a, P>;
-    fn splitn<'a, P: CharEq>(&'a self, count: uint, pat: P) -> SplitN<'a, P>;
+    fn splitn<'a, P: CharEq>(&'a self, count: usize, pat: P) -> SplitN<'a, P>;
     fn split_terminator<'a, P: CharEq>(&'a self, pat: P) -> SplitTerminator<'a, P>;
-    fn rsplitn<'a, P: CharEq>(&'a self, count: uint, pat: P) -> RSplitN<'a, P>;
+    fn rsplitn<'a, P: CharEq>(&'a self, count: usize, pat: P) -> RSplitN<'a, P>;
     fn match_indices<'a>(&'a self, sep: &'a str) -> MatchIndices<'a>;
     fn split_str<'a>(&'a self, pat: &'a str) -> SplitStr<'a>;
     fn lines<'a>(&'a self) -> Lines<'a>;
     fn lines_any<'a>(&'a self) -> LinesAny<'a>;
-    fn char_len(&self) -> uint;
-    fn slice_chars<'a>(&'a self, begin: uint, end: uint) -> &'a str;
-    unsafe fn slice_unchecked<'a>(&'a self, begin: uint, end: uint) -> &'a str;
+    fn char_len(&self) -> usize;
+    fn slice_chars<'a>(&'a self, begin: usize, end: usize) -> &'a str;
+    unsafe fn slice_unchecked<'a>(&'a self, begin: usize, end: usize) -> &'a str;
     fn starts_with(&self, pat: &str) -> bool;
     fn ends_with(&self, pat: &str) -> bool;
     fn trim_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str;
     fn trim_left_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str;
     fn trim_right_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str;
-    fn is_char_boundary(&self, index: uint) -> bool;
-    fn char_range_at(&self, start: uint) -> CharRange;
-    fn char_range_at_reverse(&self, start: uint) -> CharRange;
-    fn char_at(&self, i: uint) -> char;
-    fn char_at_reverse(&self, i: uint) -> char;
+    fn is_char_boundary(&self, index: usize) -> bool;
+    fn char_range_at(&self, start: usize) -> CharRange;
+    fn char_range_at_reverse(&self, start: usize) -> CharRange;
+    fn char_at(&self, i: usize) -> char;
+    fn char_at_reverse(&self, i: usize) -> char;
     fn as_bytes<'a>(&'a self) -> &'a [u8];
-    fn find<P: CharEq>(&self, pat: P) -> Option<uint>;
-    fn rfind<P: CharEq>(&self, pat: P) -> Option<uint>;
-    fn find_str(&self, pat: &str) -> Option<uint>;
+    fn find<P: CharEq>(&self, pat: P) -> Option<usize>;
+    fn rfind<P: CharEq>(&self, pat: P) -> Option<usize>;
+    fn find_str(&self, pat: &str) -> Option<usize>;
     fn slice_shift_char<'a>(&'a self) -> Option<(char, &'a str)>;
-    fn subslice_offset(&self, inner: &str) -> uint;
+    fn subslice_offset(&self, inner: &str) -> usize;
     fn as_ptr(&self) -> *const u8;
-    fn len(&self) -> uint;
+    fn len(&self) -> usize;
     fn is_empty(&self) -> bool;
     fn parse<T: FromStr>(&self) -> Result<T, T::Err>;
 }
 
 #[inline(never)]
-fn slice_error_fail(s: &str, begin: uint, end: uint) -> ! {
+fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! {
     assert!(begin <= end);
     panic!("index {} and/or {} in `{}` do not lie on character boundary",
           begin, end, s);
@@ -1409,7 +1411,7 @@ impl StrExt for str {
     }
 
     #[inline]
-    fn splitn<P: CharEq>(&self, count: uint, pat: P) -> SplitN<P> {
+    fn splitn<P: CharEq>(&self, count: usize, pat: P) -> SplitN<P> {
         SplitN(CharSplitsN {
             iter: self.split(pat).0,
             count: count,
@@ -1426,7 +1428,7 @@ impl StrExt for str {
     }
 
     #[inline]
-    fn rsplitn<P: CharEq>(&self, count: uint, pat: P) -> RSplitN<P> {
+    fn rsplitn<P: CharEq>(&self, count: usize, pat: P) -> RSplitN<P> {
         RSplitN(CharSplitsN {
             iter: self.split(pat).0,
             count: count,
@@ -1470,9 +1472,9 @@ impl StrExt for str {
     }
 
     #[inline]
-    fn char_len(&self) -> uint { self.chars().count() }
+    fn char_len(&self) -> usize { self.chars().count() }
 
-    fn slice_chars(&self, begin: uint, end: uint) -> &str {
+    fn slice_chars(&self, begin: usize, end: usize) -> &str {
         assert!(begin <= end);
         let mut count = 0;
         let mut begin_byte = None;
@@ -1496,9 +1498,9 @@ impl StrExt for str {
     }
 
     #[inline]
-    unsafe fn slice_unchecked(&self, begin: uint, end: uint) -> &str {
+    unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str {
         mem::transmute(Slice {
-            data: self.as_ptr().offset(begin as int),
+            data: self.as_ptr().offset(begin as isize),
             len: end - begin,
         })
     }
@@ -1550,7 +1552,7 @@ impl StrExt for str {
     }
 
     #[inline]
-    fn is_char_boundary(&self, index: uint) -> bool {
+    fn is_char_boundary(&self, index: usize) -> bool {
         if index == self.len() { return true; }
         match self.as_bytes().get(index) {
             None => false,
@@ -1559,13 +1561,13 @@ impl StrExt for str {
     }
 
     #[inline]
-    fn char_range_at(&self, i: uint) -> CharRange {
+    fn char_range_at(&self, i: usize) -> CharRange {
         let (c, n) = char_range_at_raw(self.as_bytes(), i);
         CharRange { ch: unsafe { mem::transmute(c) }, next: n }
     }
 
     #[inline]
-    fn char_range_at_reverse(&self, start: uint) -> CharRange {
+    fn char_range_at_reverse(&self, start: usize) -> CharRange {
         let mut prev = start;
 
         prev = prev.saturating_sub(1);
@@ -1574,14 +1576,14 @@ impl StrExt for str {
         }
 
         // Multibyte case is a fn to allow char_range_at_reverse to inline cleanly
-        fn multibyte_char_range_at_reverse(s: &str, mut i: uint) -> CharRange {
+        fn multibyte_char_range_at_reverse(s: &str, mut i: usize) -> CharRange {
             // while there is a previous byte == 10......
             while i > 0 && s.as_bytes()[i] & !CONT_MASK == TAG_CONT_U8 {
                 i -= 1;
             }
 
             let mut val = s.as_bytes()[i] as u32;
-            let w = UTF8_CHAR_WIDTH[val as uint] as uint;
+            let w = UTF8_CHAR_WIDTH[val as usize] as usize;
             assert!((w != 0));
 
             val = utf8_first_byte!(val, w);
@@ -1596,12 +1598,12 @@ impl StrExt for str {
     }
 
     #[inline]
-    fn char_at(&self, i: uint) -> char {
+    fn char_at(&self, i: usize) -> char {
         self.char_range_at(i).ch
     }
 
     #[inline]
-    fn char_at_reverse(&self, i: uint) -> char {
+    fn char_at_reverse(&self, i: usize) -> char {
         self.char_range_at_reverse(i).ch
     }
 
@@ -1610,7 +1612,7 @@ impl StrExt for str {
         unsafe { mem::transmute(self) }
     }
 
-    fn find<P: CharEq>(&self, mut pat: P) -> Option<uint> {
+    fn find<P: CharEq>(&self, mut pat: P) -> Option<usize> {
         if pat.only_ascii() {
             self.bytes().position(|b| pat.matches(b as char))
         } else {
@@ -1621,7 +1623,7 @@ impl StrExt for str {
         }
     }
 
-    fn rfind<P: CharEq>(&self, mut pat: P) -> Option<uint> {
+    fn rfind<P: CharEq>(&self, mut pat: P) -> Option<usize> {
         if pat.only_ascii() {
             self.bytes().rposition(|b| pat.matches(b as char))
         } else {
@@ -1632,7 +1634,7 @@ impl StrExt for str {
         }
     }
 
-    fn find_str(&self, needle: &str) -> Option<uint> {
+    fn find_str(&self, needle: &str) -> Option<usize> {
         if needle.is_empty() {
             Some(0)
         } else {
@@ -1653,10 +1655,10 @@ impl StrExt for str {
         }
     }
 
-    fn subslice_offset(&self, inner: &str) -> uint {
-        let a_start = self.as_ptr() as uint;
+    fn subslice_offset(&self, inner: &str) -> usize {
+        let a_start = self.as_ptr() as usize;
         let a_end = a_start + self.len();
-        let b_start = inner.as_ptr() as uint;
+        let b_start = inner.as_ptr() as usize;
         let b_end = b_start + inner.len();
 
         assert!(a_start <= b_start);
@@ -1670,7 +1672,7 @@ impl StrExt for str {
     }
 
     #[inline]
-    fn len(&self) -> uint { self.repr().len }
+    fn len(&self) -> usize { self.repr().len }
 
     #[inline]
     fn is_empty(&self) -> bool { self.len() == 0 }
@@ -1683,15 +1685,15 @@ impl StrExt for str {
 /// index of the next code point.
 #[inline]
 #[unstable(feature = "core")]
-pub fn char_range_at_raw(bytes: &[u8], i: uint) -> (u32, usize) {
+pub fn char_range_at_raw(bytes: &[u8], i: usize) -> (u32, usize) {
     if bytes[i] < 128u8 {
         return (bytes[i] as u32, i + 1);
     }
 
     // Multibyte case is a fn to allow char_range_at to inline cleanly
-    fn multibyte_char_range_at(bytes: &[u8], i: uint) -> (u32, usize) {
+    fn multibyte_char_range_at(bytes: &[u8], i: usize) -> (u32, usize) {
         let mut val = bytes[i] as u32;
-        let w = UTF8_CHAR_WIDTH[val as uint] as uint;
+        let w = UTF8_CHAR_WIDTH[val as usize] as usize;
         assert!((w != 0));
 
         val = utf8_first_byte!(val, w);
@@ -1718,7 +1720,7 @@ impl<'a> Iterator for Lines<'a> {
     #[inline]
     fn next(&mut self) -> Option<&'a str> { self.inner.next() }
     #[inline]
-    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")]
@@ -1734,7 +1736,7 @@ impl<'a> Iterator for LinesAny<'a> {
     #[inline]
     fn next(&mut self) -> Option<&'a str> { self.inner.next() }
     #[inline]
-    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")]