about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-11-28 12:38:53 -0800
committerBrian Anderson <banderson@mozilla.com>2012-11-28 13:17:33 -0800
commitfc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6 (patch)
treebd9de2c450f23b8ff0e09130ab59d784ace5b5e3 /src/libcore
parent669fbddc4435a9ab152332df06a7fcca789c8059 (diff)
parent8179e268efd86ae5c1bcf21b4f8d4e01eea7c193 (diff)
downloadrust-fc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6.tar.gz
rust-fc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6.zip
Merge remote-tracking branch 'brson/companion' into incoming
Conflicts:
	src/compiletest/compiletest.rs
	src/libcargo/cargo.rs
	src/libcore/core.rs
	src/librustc/rustc.rs
	src/librustdoc/rustdoc.rc
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/bool.rs8
-rw-r--r--src/libcore/box.rs24
-rw-r--r--src/libcore/char.rs8
-rw-r--r--src/libcore/cmp.rs38
-rw-r--r--src/libcore/core.rc204
-rw-r--r--src/libcore/core.rs85
-rw-r--r--src/libcore/either.rs23
-rw-r--r--src/libcore/extfmt.rs19
-rw-r--r--src/libcore/float.rs24
-rw-r--r--src/libcore/int-template.rs24
-rw-r--r--src/libcore/int-template/i16b.rs4
-rw-r--r--src/libcore/int-template/i32b.rs4
-rw-r--r--src/libcore/int-template/i64b.rs4
-rw-r--r--src/libcore/int-template/i8b.rs4
-rw-r--r--src/libcore/int-template/intb.rs45
-rw-r--r--src/libcore/io.rs13
-rw-r--r--src/libcore/iter-trait/dlistb.rs38
-rw-r--r--src/libcore/iter-trait/dvecb.rs22
-rw-r--r--src/libcore/iter-trait/optionb.rs18
-rw-r--r--src/libcore/option.rs24
-rw-r--r--src/libcore/owned.rs24
-rw-r--r--src/libcore/path.rs24
-rw-r--r--src/libcore/pipes.rs10
-rw-r--r--src/libcore/ptr.rs68
-rw-r--r--src/libcore/repr.rs10
-rw-r--r--src/libcore/result.rs23
-rw-r--r--src/libcore/str.rs78
-rw-r--r--src/libcore/task.rs64
-rw-r--r--src/libcore/task/local_data_priv.rs12
-rw-r--r--src/libcore/task/mod.rs8
-rw-r--r--src/libcore/tuple.rs93
-rw-r--r--src/libcore/uint-template.rs24
-rw-r--r--src/libcore/uint-template/u16b.rs4
-rw-r--r--src/libcore/uint-template/u32b.rs4
-rw-r--r--src/libcore/uint-template/u64b.rs4
-rw-r--r--src/libcore/uint-template/u8b.rs11
-rw-r--r--src/libcore/uint-template/uintb.rs160
-rw-r--r--src/libcore/unit.rs24
-rw-r--r--src/libcore/vec.rs72
39 files changed, 457 insertions, 893 deletions
diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs
index 60aa3d48fb3..644cc90ccf6 100644
--- a/src/libcore/bool.rs
+++ b/src/libcore/bool.rs
@@ -66,15 +66,7 @@ pub fn all_values(blk: fn(v: bool)) {
 pub pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
 
 impl bool : cmp::Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &bool) -> bool { self == (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
-    #[cfg(stage0)]
-    pure fn ne(other: &bool) -> bool { self != (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &bool) -> bool { (*self) != (*other) }
 }
 
diff --git a/src/libcore/box.rs b/src/libcore/box.rs
index 4c32e58f56e..4b4890f770f 100644
--- a/src/libcore/box.rs
+++ b/src/libcore/box.rs
@@ -28,38 +28,14 @@ pub pure fn ptr_eq<T>(a: @T, b: @T) -> bool {
 }
 
 impl<T:Eq> @const T : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &@const T) -> bool { *self == *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &@const T) -> bool { *(*self) == *(*other) }
-    #[cfg(stage0)]
-    pure fn ne(other: &@const T) -> bool { *self != *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &@const T) -> bool { *(*self) != *(*other) }
 }
 
 impl<T:Ord> @const T : Ord {
-    #[cfg(stage0)]
-    pure fn lt(other: &@const T) -> bool { *self < *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &@const T) -> bool { *(*self) < *(*other) }
-    #[cfg(stage0)]
-    pure fn le(other: &@const T) -> bool { *self <= *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &@const T) -> bool { *(*self) <= *(*other) }
-    #[cfg(stage0)]
-    pure fn ge(other: &@const T) -> bool { *self >= *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &@const T) -> bool { *(*self) >= *(*other) }
-    #[cfg(stage0)]
-    pure fn gt(other: &@const T) -> bool { *self > *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &@const T) -> bool { *(*self) > *(*other) }
 }
 
diff --git a/src/libcore/char.rs b/src/libcore/char.rs
index 0a775ca1ac3..f1c67785aa0 100644
--- a/src/libcore/char.rs
+++ b/src/libcore/char.rs
@@ -181,15 +181,7 @@ pub pure fn cmp(a: char, b: char) -> int {
 }
 
 impl char : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &char) -> bool { self == (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &char) -> bool { (*self) == (*other) }
-    #[cfg(stage0)]
-    pure fn ne(other: &char) -> bool { self != (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &char) -> bool { (*self) != (*other) }
 }
 
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index c71111fb9e3..97f439d936b 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -30,17 +30,6 @@ mod nounittest {
      * default implementations.
      */
     #[lang="ord"]
-    #[cfg(stage0)]
-    pub trait Ord {
-        pure fn lt(other: &self) -> bool;
-        pure fn le(other: &self) -> bool;
-        pure fn ge(other: &self) -> bool;
-        pure fn gt(other: &self) -> bool;
-    }
-
-    #[lang="ord"]
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pub trait Ord {
         pure fn lt(&self, other: &self) -> bool;
         pure fn le(&self, other: &self) -> bool;
@@ -58,15 +47,6 @@ mod nounittest {
      * a default implementation.
      */
     #[lang="eq"]
-    #[cfg(stage0)]
-    pub trait Eq {
-        pure fn eq(other: &self) -> bool;
-        pure fn ne(other: &self) -> bool;
-    }
-
-    #[lang="eq"]
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pub trait Eq {
         pure fn eq(&self, other: &self) -> bool;
         pure fn ne(&self, other: &self) -> bool;
@@ -81,16 +61,6 @@ mod nounittest {
 mod unittest {
     #[legacy_exports];
 
-    #[cfg(stage0)]
-    pub trait Ord {
-        pure fn lt(other: &self) -> bool;
-        pure fn le(other: &self) -> bool;
-        pure fn ge(other: &self) -> bool;
-        pure fn gt(other: &self) -> bool;
-    }
-
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pub trait Ord {
         pure fn lt(&self, other: &self) -> bool;
         pure fn le(&self, other: &self) -> bool;
@@ -98,14 +68,6 @@ mod unittest {
         pure fn gt(&self, other: &self) -> bool;
     }
 
-    #[cfg(stage0)]
-    pub trait Eq {
-        pure fn eq(other: &self) -> bool;
-        pure fn ne(other: &self) -> bool;
-    }
-
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pub trait Eq {
         pure fn eq(&self, other: &self) -> bool;
         pure fn ne(&self, other: &self) -> bool;
diff --git a/src/libcore/core.rc b/src/libcore/core.rc
index 5dbb0fcdb56..9e8dc94cd84 100644
--- a/src/libcore/core.rc
+++ b/src/libcore/core.rc
@@ -45,80 +45,54 @@ Implicitly, all crates behave as if they included the following prologue:
 // Built-in-type support modules
 
 /// Operations and constants for `int`
-#[path = "int-template"]
-pub mod int {
-    pub use inst::{ pow };
-    #[path = "int.rs"]
-    pub mod inst;
-}
+#[path = "int-template.rs"]
+#[merge = "int-template/intb.rs"]
+pub mod int;
 
 /// Operations and constants for `i8`
-#[path = "int-template"]
-pub mod i8 {
-    #[path = "i8.rs"]
-    pub mod inst;
-}
+#[path = "int-template.rs"]
+#[merge = "int-template/i8b.rs"]
+pub mod i8;
 
 /// Operations and constants for `i16`
-#[path = "int-template"]
-pub mod i16 {
-    #[path = "i16.rs"]
-    pub mod inst;
-}
+#[path = "int-template.rs"]
+#[merge = "int-template/i16b.rs"]
+pub mod i16;
 
 /// Operations and constants for `i32`
-#[path = "int-template"]
-pub mod i32 {
-    #[path = "i32.rs"]
-    pub mod inst;
-}
+#[path = "int-template.rs"]
+#[merge = "int-template/i32b.rs"]
+pub mod i32;
 
 /// Operations and constants for `i64`
-#[path = "int-template"]
-pub mod i64 {
-    #[path = "i64.rs"]
-    pub mod inst;
-}
+#[path = "int-template.rs"]
+#[merge = "int-template/i64b.rs"]
+pub mod i64;
 
 /// Operations and constants for `uint`
-#[path = "uint-template"]
-pub mod uint {
-    pub use inst::{
-        div_ceil, div_round, div_floor, iterate,
-        next_power_of_two
-    };
-    #[path = "uint.rs"]
-    pub mod inst;
-}
+#[path = "uint-template.rs"]
+#[merge = "uint-template/uintb.rs"]
+pub mod uint;
 
 /// Operations and constants for `u8`
-#[path = "uint-template"]
-pub mod u8 {
-    pub use inst::is_ascii;
-    #[path = "u8.rs"]
-    pub mod inst;
-}
+#[path = "uint-template.rs"]
+#[merge = "uint-template/u8b.rs"]
+pub mod u8;
 
 /// Operations and constants for `u16`
-#[path = "uint-template"]
-pub mod u16 {
-    #[path = "u16.rs"]
-    pub mod inst;
-}
+#[path = "uint-template.rs"]
+#[merge = "uint-template/u16b.rs"]
+pub mod u16;
 
 /// Operations and constants for `u32`
-#[path = "uint-template"]
-pub mod u32 {
-    #[path = "u32.rs"]
-    pub mod inst;
-}
+#[path = "uint-template.rs"]
+#[merge = "uint-template/u32b.rs"]
+pub mod u32;
 
 /// Operations and constants for `u64`
-#[path = "uint-template"]
-pub mod u64 {
-    #[path = "u64.rs"]
-    pub mod inst;
-}
+#[path = "uint-template.rs"]
+#[merge = "uint-template/u64b.rs"]
+pub mod u64;
 
 
 pub mod box;
@@ -146,11 +120,9 @@ pub mod either;
 pub mod iter;
 pub mod logging;
 pub mod option;
-#[path="iter-trait"]
-pub mod option_iter {
-    #[path = "option.rs"]
-    pub mod inst;
-}
+#[path="iter-trait.rs"]
+#[merge = "iter-trait/optionb.rs"]
+pub mod option_iter;
 pub mod result;
 pub mod to_str;
 pub mod to_bytes;
@@ -161,27 +133,19 @@ pub mod clone;
 // Data structure modules
 
 pub mod dvec;
-#[path="iter-trait"]
-pub mod dvec_iter {
-    #[path = "dvec.rs"]
-    pub mod inst;
-}
+#[path="iter-trait.rs"]
+#[merge = "iter-trait/dvecb.rs"]
+pub mod dvec_iter;
 pub mod dlist;
-#[path="iter-trait"]
-pub mod dlist_iter {
-    #[path ="dlist.rs"]
-    pub mod inst;
-}
+#[path="iter-trait.rs"]
+#[merge = "iter-trait/dlistb.rs"]
+pub mod dlist_iter;
 pub mod send_map;
 
 // Concurrency
 pub mod comm;
-pub mod task {
-    pub mod local_data;
-    mod local_data_priv;
-    pub mod spawn;
-    pub mod rt;
-}
+#[merge = "task/mod.rs"]
+pub mod task;
 pub mod pipes;
 
 // Runtime and language-primitive support
@@ -219,6 +183,92 @@ mod unicode;
 mod cmath;
 mod stackwalk;
 
+// Top-level, visible-everywhere definitions.
+
+// Export various ubiquitous types, constructors, methods.
+
+pub use option::{Some, None};
+pub use Option = option::Option;
+pub use result::{Result, Ok, Err};
+
+pub use Path = path::Path;
+pub use GenericPath = path::GenericPath;
+pub use WindowsPath = path::WindowsPath;
+pub use PosixPath = path::PosixPath;
+
+pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
+pub use str::{StrSlice, Trimmable};
+pub use vec::{ConstVector, CopyableVector, ImmutableVector};
+pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
+pub use vec::{MutableVector, MutableCopyableVector};
+pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
+pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
+pub use num::Num;
+pub use ptr::Ptr;
+pub use to_str::ToStr;
+
+// The following exports are the core operators and kinds
+// The compiler has special knowlege of these so we must not duplicate them
+// when compiling for testing
+#[cfg(notest)]
+pub use ops::{Const, Copy, Send, Owned};
+#[cfg(notest)]
+pub use ops::{Drop};
+#[cfg(notest)]
+pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor};
+#[cfg(notest)]
+pub use ops::{Shl, Shr, Index};
+
+#[cfg(test)]
+extern mod coreops(name = "core", vers = "0.5");
+
+#[cfg(test)]
+pub use coreops::ops::{Const, Copy, Send, Owned};
+#[cfg(test)]
+pub use coreops::ops::{Drop};
+#[cfg(test)]
+pub use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr};
+#[cfg(test)]
+pub use coreops::ops::{BitXor};
+#[cfg(test)]
+pub use coreops::ops::{Shl, Shr, Index};
+
+#[cfg(notest)]
+pub use clone::Clone;
+#[cfg(test)]
+pub use coreops::clone::Clone;
+
+// Export the log levels as global constants. Higher levels mean
+// more-verbosity. Error is the bottom level, default logging level is
+// warn-and-below.
+
+/// The error log level
+pub const error : u32 = 1_u32;
+/// The warning log level
+pub const warn : u32 = 2_u32;
+/// The info log level
+pub const info : u32 = 3_u32;
+/// The debug log level
+pub const debug : u32 = 4_u32;
+
+// A curious inner-module that's not exported that contains the binding
+// 'core' so that macro-expanded references to core::error and such
+// can be resolved within libcore.
+#[doc(hidden)] // FIXME #3538
+mod core {
+    pub const error : u32 = 1_u32;
+    pub const warn : u32 = 2_u32;
+    pub const info : u32 = 3_u32;
+    pub const debug : u32 = 4_u32;
+}
+
+// Similar to above. Some magic to make core testable.
+#[cfg(test)]
+mod std {
+    extern mod std(vers = "0.5");
+    pub use std::test;
+}
+
 // Local Variables:
 // mode: rust;
 // fill-column: 78;
diff --git a/src/libcore/core.rs b/src/libcore/core.rs
deleted file mode 100644
index c9157a8d254..00000000000
--- a/src/libcore/core.rs
+++ /dev/null
@@ -1,85 +0,0 @@
-// Top-level, visible-everywhere definitions.
-
-// Export various ubiquitous types, constructors, methods.
-
-pub use option::{Some, None};
-pub use Option = option::Option;
-pub use result::{Result, Ok, Err};
-
-pub use Path = path::Path;
-pub use GenericPath = path::GenericPath;
-pub use WindowsPath = path::WindowsPath;
-pub use PosixPath = path::PosixPath;
-
-pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
-pub use str::{StrSlice, Trimmable};
-pub use vec::{ConstVector, CopyableVector, ImmutableVector};
-pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
-pub use vec::{MutableVector, MutableCopyableVector};
-pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
-pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
-pub use num::Num;
-pub use ptr::Ptr;
-pub use to_str::ToStr;
-
-// The following exports are the core operators and kinds
-// The compiler has special knowlege of these so we must not duplicate them
-// when compiling for testing
-#[cfg(notest)]
-pub use ops::{Const, Copy, Send, Owned};
-#[cfg(notest)]
-pub use ops::{Drop};
-#[cfg(notest)]
-pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor};
-#[cfg(notest)]
-pub use ops::{Shl, Shr, Index};
-
-#[cfg(test)]
-extern mod coreops(name = "core", vers = "0.5");
-
-#[cfg(test)]
-pub use coreops::ops::{Const, Copy, Send, Owned};
-#[cfg(test)]
-pub use coreops::ops::{Drop};
-#[cfg(test)]
-pub use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr};
-#[cfg(test)]
-pub use coreops::ops::{BitXor};
-#[cfg(test)]
-pub use coreops::ops::{Shl, Shr, Index};
-
-#[cfg(notest)]
-pub use clone::Clone;
-#[cfg(test)]
-pub use coreops::clone::Clone;
-
-// Export the log levels as global constants. Higher levels mean
-// more-verbosity. Error is the bottom level, default logging level is
-// warn-and-below.
-
-/// The error log level
-pub const error : u32 = 1_u32;
-/// The warning log level
-pub const warn : u32 = 2_u32;
-/// The info log level
-pub const info : u32 = 3_u32;
-/// The debug log level
-pub const debug : u32 = 4_u32;
-
-// A curious inner-module that's not exported that contains the binding
-// 'core' so that macro-expanded references to core::error and such
-// can be resolved within libcore.
-#[doc(hidden)] // FIXME #3538
-mod core {
-    pub const error : u32 = 1_u32;
-    pub const warn : u32 = 2_u32;
-    pub const info : u32 = 3_u32;
-    pub const debug : u32 = 4_u32;
-}
-
-// Similar to above. Some magic to make core testable.
-#[cfg(test)]
-mod std {
-    extern mod std(vers = "0.5");
-    pub use std::test;
-}
diff --git a/src/libcore/either.rs b/src/libcore/either.rs
index a8b0c117b8c..844f98acb26 100644
--- a/src/libcore/either.rs
+++ b/src/libcore/either.rs
@@ -132,25 +132,6 @@ pub pure fn unwrap_right<T,U>(eith: Either<T,U>) -> U {
 }
 
 impl<T:Eq,U:Eq> Either<T,U> : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &Either<T,U>) -> bool {
-        match self {
-            Left(ref a) => {
-                match (*other) {
-                    Left(ref b) => (*a).eq(b),
-                    Right(_) => false
-                }
-            }
-            Right(ref a) => {
-                match (*other) {
-                    Left(_) => false,
-                    Right(ref b) => (*a).eq(b)
-                }
-            }
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &Either<T,U>) -> bool {
         match (*self) {
             Left(ref a) => {
@@ -167,10 +148,6 @@ impl<T:Eq,U:Eq> Either<T,U> : Eq {
             }
         }
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &Either<T,U>) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &Either<T,U>) -> bool { !(*self).eq(other) }
 }
 
diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs
index a9989f5d37d..eb985a272df 100644
--- a/src/libcore/extfmt.rs
+++ b/src/libcore/extfmt.rs
@@ -438,21 +438,6 @@ pub mod rt {
     pub enum PadMode { PadSigned, PadUnsigned, PadNozero, PadFloat }
 
     pub impl PadMode : Eq {
-        #[cfg(stage0)]
-        pure fn eq(other: &PadMode) -> bool {
-            match (self, (*other)) {
-                (PadSigned, PadSigned) => true,
-                (PadUnsigned, PadUnsigned) => true,
-                (PadNozero, PadNozero) => true,
-                (PadFloat, PadFloat) => true,
-                (PadSigned, _) => false,
-                (PadUnsigned, _) => false,
-                (PadNozero, _) => false,
-                (PadFloat, _) => false
-            }
-        }
-        #[cfg(stage1)]
-        #[cfg(stage2)]
         pure fn eq(&self, other: &PadMode) -> bool {
             match ((*self), (*other)) {
                 (PadSigned, PadSigned) => true,
@@ -465,10 +450,6 @@ pub mod rt {
                 (PadFloat, _) => false
             }
         }
-        #[cfg(stage0)]
-        pure fn ne(other: &PadMode) -> bool { !self.eq(other) }
-        #[cfg(stage1)]
-        #[cfg(stage2)]
         pure fn ne(&self, other: &PadMode) -> bool { !(*self).eq(other) }
     }
 
diff --git a/src/libcore/float.rs b/src/libcore/float.rs
index 1e218f1cba3..a5740c71323 100644
--- a/src/libcore/float.rs
+++ b/src/libcore/float.rs
@@ -400,38 +400,14 @@ pub pure fn cos(x: float) -> float { f64::cos(x as f64) as float }
 pub pure fn tan(x: float) -> float { f64::tan(x as f64) as float }
 
 impl float : Eq {
-    #[cfg(stage0)]
-    pub pure fn eq(other: &float) -> bool { self == (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &float) -> bool { (*self) == (*other) }
-    #[cfg(stage0)]
-    pub pure fn ne(other: &float) -> bool { self != (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &float) -> bool { (*self) != (*other) }
 }
 
 impl float : Ord {
-    #[cfg(stage0)]
-    pub pure fn lt(other: &float) -> bool { self < (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &float) -> bool { (*self) < (*other) }
-    #[cfg(stage0)]
-    pub pure fn le(other: &float) -> bool { self <= (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &float) -> bool { (*self) <= (*other) }
-    #[cfg(stage0)]
-    pub pure fn ge(other: &float) -> bool { self >= (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &float) -> bool { (*self) >= (*other) }
-    #[cfg(stage0)]
-    pub pure fn gt(other: &float) -> bool { self > (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &float) -> bool { (*self) > (*other) }
 }
 
diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs
index 78f85fce3ec..e1383ba5ac2 100644
--- a/src/libcore/int-template.rs
+++ b/src/libcore/int-template.rs
@@ -55,38 +55,14 @@ pub pure fn abs(i: T) -> T {
 }
 
 impl T : Ord {
-    #[cfg(stage0)]
-    pure fn lt(other: &T) -> bool { return self < (*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &T) -> bool { return (*self) < (*other); }
-    #[cfg(stage0)]
-    pure fn le(other: &T) -> bool { return self <= (*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &T) -> bool { return (*self) <= (*other); }
-    #[cfg(stage0)]
-    pure fn ge(other: &T) -> bool { return self >= (*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &T) -> bool { return (*self) >= (*other); }
-    #[cfg(stage0)]
-    pure fn gt(other: &T) -> bool { return self > (*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &T) -> bool { return (*self) > (*other); }
 }
 
 impl T : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &T) -> bool { return self == (*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &T) -> bool { return (*self) == (*other); }
-    #[cfg(stage0)]
-    pure fn ne(other: &T) -> bool { return self != (*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &T) -> bool { return (*self) != (*other); }
 }
 
diff --git a/src/libcore/int-template/i16b.rs b/src/libcore/int-template/i16b.rs
new file mode 100644
index 00000000000..b24eb86e4ae
--- /dev/null
+++ b/src/libcore/int-template/i16b.rs
@@ -0,0 +1,4 @@
+mod inst {
+    pub type T = i16;
+    pub const bits: uint = u16::bits;
+}
\ No newline at end of file
diff --git a/src/libcore/int-template/i32b.rs b/src/libcore/int-template/i32b.rs
new file mode 100644
index 00000000000..5bfb8a6d01c
--- /dev/null
+++ b/src/libcore/int-template/i32b.rs
@@ -0,0 +1,4 @@
+mod inst {
+    pub type T = i32;
+    pub const bits: uint = u32::bits;
+}
diff --git a/src/libcore/int-template/i64b.rs b/src/libcore/int-template/i64b.rs
new file mode 100644
index 00000000000..86552b2cced
--- /dev/null
+++ b/src/libcore/int-template/i64b.rs
@@ -0,0 +1,4 @@
+mod inst {
+    pub type T = i64;
+    pub const bits: uint = u64::bits;
+}
\ No newline at end of file
diff --git a/src/libcore/int-template/i8b.rs b/src/libcore/int-template/i8b.rs
new file mode 100644
index 00000000000..2cf7ed2983f
--- /dev/null
+++ b/src/libcore/int-template/i8b.rs
@@ -0,0 +1,4 @@
+mod inst {
+    pub type T = i8;
+    pub const bits: uint = u8::bits;
+}
\ No newline at end of file
diff --git a/src/libcore/int-template/intb.rs b/src/libcore/int-template/intb.rs
new file mode 100644
index 00000000000..c1f2ca944dd
--- /dev/null
+++ b/src/libcore/int-template/intb.rs
@@ -0,0 +1,45 @@
+pub use inst::pow;
+
+mod inst {
+    pub type T = int;
+    pub const bits: uint = uint::bits;
+
+    /// Returns `base` raised to the power of `exponent`
+    pub fn pow(base: int, exponent: uint) -> int {
+        if exponent == 0u {
+            //Not mathemtically true if ~[base == 0]
+            return 1;
+        }
+        if base     == 0  { return 0; }
+        let mut my_pow  = exponent;
+        let mut acc     = 1;
+        let mut multiplier = base;
+        while(my_pow > 0u) {
+            if my_pow % 2u == 1u {
+                acc *= multiplier;
+            }
+            my_pow     /= 2u;
+            multiplier *= multiplier;
+        }
+        return acc;
+    }
+
+    #[test]
+    fn test_pow() {
+        assert (pow(0, 0u) == 1);
+        assert (pow(0, 1u) == 0);
+        assert (pow(0, 2u) == 0);
+        assert (pow(-1, 0u) == 1);
+        assert (pow(1, 0u) == 1);
+        assert (pow(-3, 2u) == 9);
+        assert (pow(-3, 3u) == -27);
+        assert (pow(4, 9u) == 262144);
+    }
+
+    #[test]
+    fn test_overflows() {
+        assert (max_value > 0);
+        assert (min_value <= 0);
+        assert (min_value + max_value + 1 == 0);
+    }
+}
\ No newline at end of file
diff --git a/src/libcore/io.rs b/src/libcore/io.rs
index a498adc1788..aa2eccfb343 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -516,25 +516,12 @@ pub enum FileFlag { Append, Create, Truncate, NoFlag, }
 pub enum WriterType { Screen, File }
 
 pub impl WriterType : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &WriterType) -> bool {
-        match (self, (*other)) {
-            (Screen, Screen) | (File, File) => true,
-            (Screen, _) | (File, _) => false
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &WriterType) -> bool {
         match ((*self), (*other)) {
             (Screen, Screen) | (File, File) => true,
             (Screen, _) | (File, _) => false
         }
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &WriterType) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &WriterType) -> bool { !(*self).eq(other) }
 }
 
diff --git a/src/libcore/iter-trait/dlistb.rs b/src/libcore/iter-trait/dlistb.rs
new file mode 100644
index 00000000000..2d782b1262b
--- /dev/null
+++ b/src/libcore/iter-trait/dlistb.rs
@@ -0,0 +1,38 @@
+mod inst {
+    #[allow(non_camel_case_types)]
+    pub type IMPL_T<A> = dlist::DList<A>;
+
+    /**
+    * Iterates through the current contents.
+    *
+    * Attempts to access this dlist during iteration are allowed (to
+    * allow for e.g. breadth-first search with in-place enqueues), but
+    * removing the current node is forbidden.
+    */
+    pub pure fn EACH<A>(self: &IMPL_T<A>, f: fn(v: &A) -> bool) {
+        let mut link = self.peek_n();
+        while option::is_some(&link) {
+            let nobe = option::get(link);
+            assert nobe.linked;
+            if !f(&nobe.data) { break; }
+            // Check (weakly) that the user didn't do a remove.
+            if self.size == 0 {
+                fail ~"The dlist became empty during iteration??"
+            }
+            if !nobe.linked ||
+                (!((nobe.prev.is_some()
+                    || box::ptr_eq(*self.hd.expect(~"headless dlist?"),
+                                   *nobe))
+                   && (nobe.next.is_some()
+                    || box::ptr_eq(*self.tl.expect(~"tailless dlist?"),
+                                   *nobe)))) {
+                fail ~"Removing a dlist node during iteration is forbidden!"
+            }
+            link = nobe.next_link();
+        }
+    }
+
+    pub pure fn SIZE_HINT<A>(self: &IMPL_T<A>) -> Option<uint> {
+        Some(self.len())
+    }
+}
\ No newline at end of file
diff --git a/src/libcore/iter-trait/dvecb.rs b/src/libcore/iter-trait/dvecb.rs
new file mode 100644
index 00000000000..b30c1372a2e
--- /dev/null
+++ b/src/libcore/iter-trait/dvecb.rs
@@ -0,0 +1,22 @@
+mod inst {
+    #[allow(non_camel_case_types)]
+    pub type IMPL_T<A> = dvec::DVec<A>;
+
+    /**
+    * Iterates through the current contents.
+    *
+    * Attempts to access this dvec during iteration will fail.
+    */
+    pub pure fn EACH<A>(self: &IMPL_T<A>, f: fn(v: &A) -> bool) {
+        unsafe {
+            do self.swap |v| {
+                v.each(f);
+                move v
+            }
+        }
+    }
+
+    pub pure fn SIZE_HINT<A>(self: &IMPL_T<A>) -> Option<uint> {
+        Some(self.len())
+    }
+}
\ No newline at end of file
diff --git a/src/libcore/iter-trait/optionb.rs b/src/libcore/iter-trait/optionb.rs
new file mode 100644
index 00000000000..680893eb95b
--- /dev/null
+++ b/src/libcore/iter-trait/optionb.rs
@@ -0,0 +1,18 @@
+mod inst {
+    #[allow(non_camel_case_types)]
+    pub type IMPL_T<A> = Option<A>;
+
+    pub pure fn EACH<A>(self: &IMPL_T<A>, f: fn(v: &A) -> bool) {
+        match *self {
+            None => (),
+            Some(ref a) => { f(a); }
+        }
+    }
+
+    pub pure fn SIZE_HINT<A>(self: &IMPL_T<A>) -> Option<uint> {
+        match *self {
+            None => Some(0),
+            Some(_) => Some(1)
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 1c47bc7f1ba..e5fcc7e83eb 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -301,26 +301,6 @@ impl<T: Copy> Option<T> {
 }
 
 impl<T: Eq> Option<T> : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &Option<T>) -> bool {
-        match self {
-            None => {
-                match (*other) {
-                    None => true,
-                    Some(_) => false
-                }
-            }
-            Some(ref self_contents) => {
-                match (*other) {
-                    None => false,
-                    Some(ref other_contents) =>
-                        (*self_contents).eq(other_contents)
-                }
-            }
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &Option<T>) -> bool {
         match (*self) {
             None => {
@@ -338,10 +318,6 @@ impl<T: Eq> Option<T> : Eq {
             }
         }
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &Option<T>) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &Option<T>) -> bool { !(*self).eq(other) }
 }
 
diff --git a/src/libcore/owned.rs b/src/libcore/owned.rs
index 62fffde7f16..aaee987b4bd 100644
--- a/src/libcore/owned.rs
+++ b/src/libcore/owned.rs
@@ -7,38 +7,14 @@
 use cmp::{Eq, Ord};
 
 impl<T:Eq> ~const T : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &~const T) -> bool { *self == *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &~const T) -> bool { *(*self) == *(*other) }
-    #[cfg(stage0)]
-    pure fn ne(other: &~const T) -> bool { *self != *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &~const T) -> bool { *(*self) != *(*other) }
 }
 
 impl<T:Ord> ~const T : Ord {
-    #[cfg(stage0)]
-    pure fn lt(other: &~const T) -> bool { *self < *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &~const T) -> bool { *(*self) < *(*other) }
-    #[cfg(stage0)]
-    pure fn le(other: &~const T) -> bool { *self <= *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &~const T) -> bool { *(*self) <= *(*other) }
-    #[cfg(stage0)]
-    pure fn ge(other: &~const T) -> bool { *self >= *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &~const T) -> bool { *(*self) >= *(*other) }
-    #[cfg(stage0)]
-    pure fn gt(other: &~const T) -> bool { *self > *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &~const T) -> bool { *(*self) > *(*other) }
 }
 
diff --git a/src/libcore/path.rs b/src/libcore/path.rs
index 8b5e383ed94..f0fefee9d06 100644
--- a/src/libcore/path.rs
+++ b/src/libcore/path.rs
@@ -344,44 +344,20 @@ impl PosixPath : ToStr {
 }
 
 impl PosixPath : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &PosixPath) -> bool {
-        return self.is_absolute == (*other).is_absolute &&
-            self.components == (*other).components;
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &PosixPath) -> bool {
         return (*self).is_absolute == (*other).is_absolute &&
             (*self).components == (*other).components;
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &PosixPath) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &PosixPath) -> bool { !(*self).eq(other) }
 }
 
 impl WindowsPath : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &WindowsPath) -> bool {
-        return self.host == (*other).host &&
-            self.device == (*other).device &&
-            self.is_absolute == (*other).is_absolute &&
-            self.components == (*other).components;
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &WindowsPath) -> bool {
         return (*self).host == (*other).host &&
             (*self).device == (*other).device &&
             (*self).is_absolute == (*other).is_absolute &&
             (*self).components == (*other).components;
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &WindowsPath) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &WindowsPath) -> bool { !(*self).eq(other) }
 }
 
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs
index 8b05f63752f..9a6f05fe405 100644
--- a/src/libcore/pipes.rs
+++ b/src/libcore/pipes.rs
@@ -98,19 +98,9 @@ enum State {
 }
 
 impl State : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &State) -> bool {
-        (self as uint) == ((*other) as uint)
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &State) -> bool {
         ((*self) as uint) == ((*other) as uint)
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &State) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &State) -> bool { !(*self).eq(other) }
 }
 
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 7cba022e7c3..d1566735a3f 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -208,75 +208,31 @@ impl<T> *mut T: Ptr<T> {
 
 // Equality for pointers
 impl<T> *const T : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &*const T) -> bool unsafe {
-        let a: uint = cast::reinterpret_cast(&self);
-        let b: uint = cast::reinterpret_cast(&(*other));
-        return a == b;
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &*const T) -> bool unsafe {
         let a: uint = cast::reinterpret_cast(&(*self));
         let b: uint = cast::reinterpret_cast(&(*other));
         return a == b;
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &*const T) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &*const T) -> bool { !(*self).eq(other) }
 }
 
 // Comparison for pointers
 impl<T> *const T : Ord {
-    #[cfg(stage0)]
-    pure fn lt(other: &*const T) -> bool unsafe {
-        let a: uint = cast::reinterpret_cast(&self);
-        let b: uint = cast::reinterpret_cast(&(*other));
-        return a < b;
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &*const T) -> bool unsafe {
         let a: uint = cast::reinterpret_cast(&(*self));
         let b: uint = cast::reinterpret_cast(&(*other));
         return a < b;
     }
-    #[cfg(stage0)]
-    pure fn le(other: &*const T) -> bool unsafe {
-        let a: uint = cast::reinterpret_cast(&self);
-        let b: uint = cast::reinterpret_cast(&(*other));
-        return a <= b;
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &*const T) -> bool unsafe {
         let a: uint = cast::reinterpret_cast(&(*self));
         let b: uint = cast::reinterpret_cast(&(*other));
         return a <= b;
     }
-    #[cfg(stage0)]
-    pure fn ge(other: &*const T) -> bool unsafe {
-        let a: uint = cast::reinterpret_cast(&self);
-        let b: uint = cast::reinterpret_cast(&(*other));
-        return a >= b;
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &*const T) -> bool unsafe {
         let a: uint = cast::reinterpret_cast(&(*self));
         let b: uint = cast::reinterpret_cast(&(*other));
         return a >= b;
     }
-    #[cfg(stage0)]
-    pure fn gt(other: &*const T) -> bool unsafe {
-        let a: uint = cast::reinterpret_cast(&self);
-        let b: uint = cast::reinterpret_cast(&(*other));
-        return a > b;
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &*const T) -> bool unsafe {
         let a: uint = cast::reinterpret_cast(&(*self));
         let b: uint = cast::reinterpret_cast(&(*other));
@@ -286,17 +242,9 @@ impl<T> *const T : Ord {
 
 // Equality for region pointers
 impl<T:Eq> &const T : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: & &self/const T) -> bool { return *self == *(*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: & &self/const T) -> bool {
         return *(*self) == *(*other);
     }
-    #[cfg(stage0)]
-    pure fn ne(other: & &self/const T) -> bool { return *self != *(*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: & &self/const T) -> bool {
         return *(*self) != *(*other);
     }
@@ -304,31 +252,15 @@ impl<T:Eq> &const T : Eq {
 
 // Comparison for region pointers
 impl<T:Ord> &const T : Ord {
-    #[cfg(stage0)]
-    pure fn lt(other: & &self/const T) -> bool { *self < *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: & &self/const T) -> bool {
         *(*self) < *(*other)
     }
-    #[cfg(stage0)]
-    pure fn le(other: & &self/const T) -> bool { *self <= *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: & &self/const T) -> bool {
         *(*self) <= *(*other)
     }
-    #[cfg(stage0)]
-    pure fn ge(other: & &self/const T) -> bool { *self >= *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: & &self/const T) -> bool {
         *(*self) >= *(*other)
     }
-    #[cfg(stage0)]
-    pure fn gt(other: & &self/const T) -> bool { *self > *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: & &self/const T) -> bool {
         *(*self) > *(*other)
     }
diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs
index 0eee413cdad..3bec87e0af6 100644
--- a/src/libcore/repr.rs
+++ b/src/libcore/repr.rs
@@ -516,19 +516,9 @@ enum EnumVisitState {
 }
 
 impl EnumVisitState : cmp::Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &EnumVisitState) -> bool {
-        (self as uint) == ((*other) as uint)
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &EnumVisitState) -> bool {
         ((*self) as uint) == ((*other) as uint)
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &EnumVisitState) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &EnumVisitState) -> bool { !(*self).eq(other) }
 }
 
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 5c59f429fd4..20d4bd81056 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -365,25 +365,6 @@ pub fn unwrap_err<T, U>(res: Result<T, U>) -> U {
 }
 
 impl<T:Eq,U:Eq> Result<T,U> : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &Result<T,U>) -> bool {
-        match self {
-            Ok(ref e0a) => {
-                match (*other) {
-                    Ok(ref e0b) => *e0a == *e0b,
-                    _ => false
-                }
-            }
-            Err(ref e0a) => {
-                match (*other) {
-                    Err(ref e0b) => *e0a == *e0b,
-                    _ => false
-                }
-            }
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &Result<T,U>) -> bool {
         match (*self) {
             Ok(ref e0a) => {
@@ -400,10 +381,6 @@ impl<T:Eq,U:Eq> Result<T,U> : Eq {
             }
         }
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &Result<T,U>) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &Result<T,U>) -> bool { !(*self).eq(other) }
 }
 
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 2d8d1cd9fd8..410d18d6665 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -737,139 +737,61 @@ pure fn gt(a: &str, b: &str) -> bool {
 
 impl &str : Eq {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn eq(other: & &self/str) -> bool {
-        eq_slice(self, (*other))
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: & &self/str) -> bool {
         eq_slice((*self), (*other))
     }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ne(other: & &self/str) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: & &self/str) -> bool { !(*self).eq(other) }
 }
 
 impl ~str : Eq {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn eq(other: &~str) -> bool {
-        eq_slice(self, (*other))
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &~str) -> bool {
         eq_slice((*self), (*other))
     }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ne(other: &~str) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &~str) -> bool { !(*self).eq(other) }
 }
 
 impl @str : Eq {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn eq(other: &@str) -> bool {
-        eq_slice(self, (*other))
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &@str) -> bool {
         eq_slice((*self), (*other))
     }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ne(other: &@str) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &@str) -> bool { !(*self).eq(other) }
 }
 
 impl ~str : Ord {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn lt(other: &~str) -> bool { lt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &~str) -> bool { lt((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn le(other: &~str) -> bool { le(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &~str) -> bool { le((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ge(other: &~str) -> bool { ge(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &~str) -> bool { ge((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn gt(other: &~str) -> bool { gt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &~str) -> bool { gt((*self), (*other)) }
 }
 
 impl &str : Ord {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn lt(other: & &self/str) -> bool { lt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: & &self/str) -> bool { lt((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn le(other: & &self/str) -> bool { le(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: & &self/str) -> bool { le((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ge(other: & &self/str) -> bool { ge(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: & &self/str) -> bool { ge((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn gt(other: & &self/str) -> bool { gt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: & &self/str) -> bool { gt((*self), (*other)) }
 }
 
 impl @str : Ord {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn lt(other: &@str) -> bool { lt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &@str) -> bool { lt((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn le(other: &@str) -> bool { le(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &@str) -> bool { le((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ge(other: &@str) -> bool { ge(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &@str) -> bool { ge((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn gt(other: &@str) -> bool { gt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &@str) -> bool { gt((*self), (*other)) }
 }
 
diff --git a/src/libcore/task.rs b/src/libcore/task.rs
index 3a6fa2d3931..a2b5c3229ad 100644
--- a/src/libcore/task.rs
+++ b/src/libcore/task.rs
@@ -43,15 +43,7 @@ pub enum Task {
 }
 
 impl Task : cmp::Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &Task) -> bool { *self == *(*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &Task) -> bool { *(*self) == *(*other) }
-    #[cfg(stage0)]
-    pure fn ne(other: &Task) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &Task) -> bool { !(*self).eq(other) }
 }
 
@@ -72,25 +64,12 @@ pub enum TaskResult {
 }
 
 impl TaskResult : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &TaskResult) -> bool {
-        match (self, (*other)) {
-            (Success, Success) | (Failure, Failure) => true,
-            (Success, _) | (Failure, _) => false
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &TaskResult) -> bool {
         match ((*self), (*other)) {
             (Success, Success) | (Failure, Failure) => true,
             (Success, _) | (Failure, _) => false
         }
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &TaskResult) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &TaskResult) -> bool { !(*self).eq(other) }
 }
 
@@ -114,43 +93,6 @@ pub enum SchedMode {
 }
 
 impl SchedMode : cmp::Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &SchedMode) -> bool {
-        match self {
-            SingleThreaded => {
-                match (*other) {
-                    SingleThreaded => true,
-                    _ => false
-                }
-            }
-            ThreadPerCore => {
-                match (*other) {
-                    ThreadPerCore => true,
-                    _ => false
-                }
-            }
-            ThreadPerTask => {
-                match (*other) {
-                    ThreadPerTask => true,
-                    _ => false
-                }
-            }
-            ManualThreads(e0a) => {
-                match (*other) {
-                    ManualThreads(e0b) => e0a == e0b,
-                    _ => false
-                }
-            }
-            PlatformThread => {
-                match (*other) {
-                    PlatformThread => true,
-                    _ => false
-                }
-            }
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &SchedMode) -> bool {
         match (*self) {
             SingleThreaded => {
@@ -185,12 +127,6 @@ impl SchedMode : cmp::Eq {
             }
         }
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &SchedMode) -> bool {
-        !self.eq(other)
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &SchedMode) -> bool {
         !(*self).eq(other)
     }
diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs
index 02550f3470f..b8537373e65 100644
--- a/src/libcore/task/local_data_priv.rs
+++ b/src/libcore/task/local_data_priv.rs
@@ -7,23 +7,11 @@ pub trait LocalData { }
 impl<T: Owned> @T: LocalData { }
 
 impl LocalData: Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &@LocalData) -> bool unsafe {
-        let ptr_a: (uint, uint) = cast::reinterpret_cast(&self);
-        let ptr_b: (uint, uint) = cast::reinterpret_cast(other);
-        return ptr_a == ptr_b;
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &@LocalData) -> bool unsafe {
         let ptr_a: (uint, uint) = cast::reinterpret_cast(&(*self));
         let ptr_b: (uint, uint) = cast::reinterpret_cast(other);
         return ptr_a == ptr_b;
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &@LocalData) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &@LocalData) -> bool { !(*self).eq(other) }
 }
 
diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs
new file mode 100644
index 00000000000..887983e8b6c
--- /dev/null
+++ b/src/libcore/task/mod.rs
@@ -0,0 +1,8 @@
+
+mod local_data_priv;
+
+pub mod local_data;
+
+pub mod rt;
+
+pub mod spawn;
diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs
index 33ad2cc903b..78a3e3c8355 100644
--- a/src/libcore/tuple.rs
+++ b/src/libcore/tuple.rs
@@ -95,18 +95,6 @@ impl<A: Copy, B: Copy> (~[A], ~[B]): ExtendedTupleOps<A,B> {
 }
 
 impl<A: Eq, B: Eq> (A, B) : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &(A, B)) -> bool {
-        match self {
-            (ref self_a, ref self_b) => match other {
-                &(ref other_a, ref other_b) => {
-                    (*self_a).eq(other_a) && (*self_b).eq(other_b)
-                }
-            }
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &(A, B)) -> bool {
         match (*self) {
             (ref self_a, ref self_b) => match other {
@@ -116,31 +104,10 @@ impl<A: Eq, B: Eq> (A, B) : Eq {
             }
         }
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &(A, B)) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &(A, B)) -> bool { !(*self).eq(other) }
 }
 
 impl<A: Ord, B: Ord> (A, B) : Ord {
-    #[cfg(stage0)]
-    pure fn lt(other: &(A, B)) -> bool {
-        match self {
-            (ref self_a, ref self_b) => {
-                match (*other) {
-                    (ref other_a, ref other_b) => {
-                        if (*self_a).lt(other_a) { return true; }
-                        if (*other_a).lt(self_a) { return false; }
-                        if (*self_b).lt(other_b) { return true; }
-                        return false;
-                    }
-                }
-            }
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &(A, B)) -> bool {
         match (*self) {
             (ref self_a, ref self_b) => {
@@ -155,37 +122,12 @@ impl<A: Ord, B: Ord> (A, B) : Ord {
             }
         }
     }
-    #[cfg(stage0)]
-    pure fn le(other: &(A, B)) -> bool { !(*other).lt(&self) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &(A, B)) -> bool { !(*other).lt(&(*self)) }
-    #[cfg(stage0)]
-    pure fn ge(other: &(A, B)) -> bool { !self.lt(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &(A, B)) -> bool { !(*self).lt(other) }
-    #[cfg(stage0)]
-    pure fn gt(other: &(A, B)) -> bool { (*other).lt(&self)  }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &(A, B)) -> bool { (*other).lt(&(*self))  }
 }
 
 impl<A: Eq, B: Eq, C: Eq> (A, B, C) : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &(A, B, C)) -> bool {
-        match self {
-            (ref self_a, ref self_b, ref self_c) => match other {
-                &(ref other_a, ref other_b, ref other_c) => {
-                    (*self_a).eq(other_a) && (*self_b).eq(other_b)
-                        && (*self_c).eq(other_c)
-                }
-            }
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &(A, B, C)) -> bool {
         match (*self) {
             (ref self_a, ref self_b, ref self_c) => match other {
@@ -196,33 +138,10 @@ impl<A: Eq, B: Eq, C: Eq> (A, B, C) : Eq {
             }
         }
     }
-    #[cfg(stage0)]
-    pure fn ne(other: &(A, B, C)) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &(A, B, C)) -> bool { !(*self).eq(other) }
 }
 
 impl<A: Ord, B: Ord, C: Ord> (A, B, C) : Ord {
-    #[cfg(stage0)]
-    pure fn lt(other: &(A, B, C)) -> bool {
-        match self {
-            (ref self_a, ref self_b, ref self_c) => {
-                match (*other) {
-                    (ref other_a, ref other_b, ref other_c) => {
-                        if (*self_a).lt(other_a) { return true; }
-                        if (*other_a).lt(self_a) { return false; }
-                        if (*self_b).lt(other_b) { return true; }
-                        if (*other_b).lt(self_b) { return false; }
-                        if (*self_c).lt(other_c) { return true; }
-                        return false;
-                    }
-                }
-            }
-        }
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &(A, B, C)) -> bool {
         match (*self) {
             (ref self_a, ref self_b, ref self_c) => {
@@ -239,20 +158,8 @@ impl<A: Ord, B: Ord, C: Ord> (A, B, C) : Ord {
             }
         }
     }
-    #[cfg(stage0)]
-    pure fn le(other: &(A, B, C)) -> bool { !(*other).lt(&self) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &(A, B, C)) -> bool { !(*other).lt(&(*self)) }
-    #[cfg(stage0)]
-    pure fn ge(other: &(A, B, C)) -> bool { !self.lt(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &(A, B, C)) -> bool { !(*self).lt(other) }
-    #[cfg(stage0)]
-    pure fn gt(other: &(A, B, C)) -> bool { (*other).lt(&self)  }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &(A, B, C)) -> bool { (*other).lt(&(*self))  }
 }
 
diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs
index 4f84f9acb7e..e96a6766570 100644
--- a/src/libcore/uint-template.rs
+++ b/src/libcore/uint-template.rs
@@ -49,38 +49,14 @@ pub pure fn compl(i: T) -> T {
 }
 
 impl T : Ord {
-    #[cfg(stage0)]
-    pure fn lt(other: &T) -> bool { self < (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &T) -> bool { (*self) < (*other) }
-    #[cfg(stage0)]
-    pure fn le(other: &T) -> bool { self <= (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &T) -> bool { (*self) <= (*other) }
-    #[cfg(stage0)]
-    pure fn ge(other: &T) -> bool { self >= (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &T) -> bool { (*self) >= (*other) }
-    #[cfg(stage0)]
-    pure fn gt(other: &T) -> bool { self > (*other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &T) -> bool { (*self) > (*other) }
 }
 
 impl T : Eq {
-    #[cfg(stage0)]
-    pure fn eq(other: &T) -> bool { return self == (*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &T) -> bool { return (*self) == (*other); }
-    #[cfg(stage0)]
-    pure fn ne(other: &T) -> bool { return self != (*other); }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &T) -> bool { return (*self) != (*other); }
 }
 
diff --git a/src/libcore/uint-template/u16b.rs b/src/libcore/uint-template/u16b.rs
new file mode 100644
index 00000000000..aafd46f845b
--- /dev/null
+++ b/src/libcore/uint-template/u16b.rs
@@ -0,0 +1,4 @@
+mod inst {
+    pub type T = u16;
+    pub const bits: uint = 16;
+}
diff --git a/src/libcore/uint-template/u32b.rs b/src/libcore/uint-template/u32b.rs
new file mode 100644
index 00000000000..8e784bdf225
--- /dev/null
+++ b/src/libcore/uint-template/u32b.rs
@@ -0,0 +1,4 @@
+mod inst {
+    pub type T = u32;
+    pub const bits: uint = 32;
+}
\ No newline at end of file
diff --git a/src/libcore/uint-template/u64b.rs b/src/libcore/uint-template/u64b.rs
new file mode 100644
index 00000000000..43a8169f08b
--- /dev/null
+++ b/src/libcore/uint-template/u64b.rs
@@ -0,0 +1,4 @@
+mod inst {
+    pub type T = u64;
+    pub const bits: uint = 64;
+}
\ No newline at end of file
diff --git a/src/libcore/uint-template/u8b.rs b/src/libcore/uint-template/u8b.rs
new file mode 100644
index 00000000000..a3e750861e5
--- /dev/null
+++ b/src/libcore/uint-template/u8b.rs
@@ -0,0 +1,11 @@
+pub use inst::is_ascii;
+
+mod inst {
+    pub type T = u8;
+    pub const bits: uint = 8;
+
+    // Type-specific functions here. These must be reexported by the
+    // parent module so that they appear in core::u8 and not core::u8::u8;
+
+    pub pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; }
+}
diff --git a/src/libcore/uint-template/uintb.rs b/src/libcore/uint-template/uintb.rs
new file mode 100644
index 00000000000..68054d47e1f
--- /dev/null
+++ b/src/libcore/uint-template/uintb.rs
@@ -0,0 +1,160 @@
+pub use inst::{
+    div_ceil, div_round, div_floor, iterate,
+    next_power_of_two
+};
+
+mod inst {
+    pub type T = uint;
+
+    #[cfg(target_arch = "x86")]
+    #[cfg(target_arch = "arm")]
+    pub const bits: uint = 32;
+
+    #[cfg(target_arch = "x86_64")]
+    pub const bits: uint = 64;
+
+    /**
+    * Divide two numbers, return the result, rounded up.
+    *
+    * # Arguments
+    *
+    * * x - an integer
+    * * y - an integer distinct from 0u
+    *
+    * # Return value
+    *
+    * The smallest integer `q` such that `x/y <= q`.
+    */
+    pub pure fn div_ceil(x: uint, y: uint) -> uint {
+        let div = x / y;
+        if x % y == 0u { div }
+        else { div + 1u }
+    }
+
+    /**
+    * Divide two numbers, return the result, rounded to the closest integer.
+    *
+    * # Arguments
+    *
+    * * x - an integer
+    * * y - an integer distinct from 0u
+    *
+    * # Return value
+    *
+    * The integer `q` closest to `x/y`.
+    */
+    pub pure fn div_round(x: uint, y: uint) -> uint {
+        let div = x / y;
+        if x % y * 2u  < y { div }
+        else { div + 1u }
+    }
+
+    /**
+    * Divide two numbers, return the result, rounded down.
+    *
+    * Note: This is the same function as `div`.
+    *
+    * # Arguments
+    *
+    * * x - an integer
+    * * y - an integer distinct from 0u
+    *
+    * # Return value
+    *
+    * The smallest integer `q` such that `x/y <= q`. This
+    * is either `x/y` or `x/y + 1`.
+    */
+    pub pure fn div_floor(x: uint, y: uint) -> uint { return x / y; }
+
+    /**
+    * Iterate over the range [`lo`..`hi`), or stop when requested
+    *
+    * # Arguments
+    *
+    * * lo - The integer at which to start the loop (included)
+    * * hi - The integer at which to stop the loop (excluded)
+    * * it - A block to execute with each consecutive integer of the range.
+    *        Return `true` to continue, `false` to stop.
+    *
+    * # Return value
+    *
+    * `true` If execution proceeded correctly, `false` if it was interrupted,
+    * that is if `it` returned `false` at any point.
+    */
+    pub pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
+        let mut i = lo;
+        while i < hi {
+            if (!it(i)) { return false; }
+            i += 1u;
+        }
+        return true;
+    }
+
+    /// Returns the smallest power of 2 greater than or equal to `n`
+    #[inline(always)]
+    pub fn next_power_of_two(n: uint) -> uint {
+        let halfbits: uint = sys::size_of::<uint>() * 4u;
+        let mut tmp: uint = n - 1u;
+        let mut shift: uint = 1u;
+        while shift <= halfbits { tmp |= tmp >> shift; shift <<= 1u; }
+        return tmp + 1u;
+    }
+
+    #[test]
+    fn test_next_power_of_two() {
+        assert (uint::next_power_of_two(0u) == 0u);
+        assert (uint::next_power_of_two(1u) == 1u);
+        assert (uint::next_power_of_two(2u) == 2u);
+        assert (uint::next_power_of_two(3u) == 4u);
+        assert (uint::next_power_of_two(4u) == 4u);
+        assert (uint::next_power_of_two(5u) == 8u);
+        assert (uint::next_power_of_two(6u) == 8u);
+        assert (uint::next_power_of_two(7u) == 8u);
+        assert (uint::next_power_of_two(8u) == 8u);
+        assert (uint::next_power_of_two(9u) == 16u);
+        assert (uint::next_power_of_two(10u) == 16u);
+        assert (uint::next_power_of_two(11u) == 16u);
+        assert (uint::next_power_of_two(12u) == 16u);
+        assert (uint::next_power_of_two(13u) == 16u);
+        assert (uint::next_power_of_two(14u) == 16u);
+        assert (uint::next_power_of_two(15u) == 16u);
+        assert (uint::next_power_of_two(16u) == 16u);
+        assert (uint::next_power_of_two(17u) == 32u);
+        assert (uint::next_power_of_two(18u) == 32u);
+        assert (uint::next_power_of_two(19u) == 32u);
+        assert (uint::next_power_of_two(20u) == 32u);
+        assert (uint::next_power_of_two(21u) == 32u);
+        assert (uint::next_power_of_two(22u) == 32u);
+        assert (uint::next_power_of_two(23u) == 32u);
+        assert (uint::next_power_of_two(24u) == 32u);
+        assert (uint::next_power_of_two(25u) == 32u);
+        assert (uint::next_power_of_two(26u) == 32u);
+        assert (uint::next_power_of_two(27u) == 32u);
+        assert (uint::next_power_of_two(28u) == 32u);
+        assert (uint::next_power_of_two(29u) == 32u);
+        assert (uint::next_power_of_two(30u) == 32u);
+        assert (uint::next_power_of_two(31u) == 32u);
+        assert (uint::next_power_of_two(32u) == 32u);
+        assert (uint::next_power_of_two(33u) == 64u);
+        assert (uint::next_power_of_two(34u) == 64u);
+        assert (uint::next_power_of_two(35u) == 64u);
+        assert (uint::next_power_of_two(36u) == 64u);
+        assert (uint::next_power_of_two(37u) == 64u);
+        assert (uint::next_power_of_two(38u) == 64u);
+        assert (uint::next_power_of_two(39u) == 64u);
+    }
+
+    #[test]
+    fn test_overflows() {
+        assert (uint::max_value > 0u);
+        assert (uint::min_value <= 0u);
+        assert (uint::min_value + uint::max_value + 1u == 0u);
+    }
+
+    #[test]
+    fn test_div() {
+        assert(uint::div_floor(3u, 4u) == 0u);
+        assert(uint::div_ceil(3u, 4u)  == 1u);
+        assert(uint::div_round(3u, 4u) == 1u);
+    }
+}
\ No newline at end of file
diff --git a/src/libcore/unit.rs b/src/libcore/unit.rs
index 27960a09b24..6110b9eebff 100644
--- a/src/libcore/unit.rs
+++ b/src/libcore/unit.rs
@@ -11,38 +11,14 @@ Functions for the unit type.
 use cmp::{Eq, Ord};
 
 impl () : Eq {
-    #[cfg(stage0)]
-    pure fn eq(_other: &()) -> bool { true }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, _other: &()) -> bool { true }
-    #[cfg(stage0)]
-    pure fn ne(_other: &()) -> bool { false }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, _other: &()) -> bool { false }
 }
 
 impl () : Ord {
-    #[cfg(stage0)]
-    pure fn lt(_other: &()) -> bool { false }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, _other: &()) -> bool { false }
-    #[cfg(stage0)]
-    pure fn le(_other: &()) -> bool { true }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, _other: &()) -> bool { true }
-    #[cfg(stage0)]
-    pure fn ge(_other: &()) -> bool { true }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, _other: &()) -> bool { true }
-    #[cfg(stage0)]
-    pure fn gt(_other: &()) -> bool { false }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, _other: &()) -> bool { false }
 }
 
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 087ce42b28a..47864d0b562 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -1347,47 +1347,23 @@ pure fn eq<T: Eq>(a: &[T], b: &[T]) -> bool {
 
 impl<T: Eq> &[T] : Eq {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn eq(other: & &self/[T]) -> bool { eq(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: & &self/[T]) -> bool { eq((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ne(other: & &self/[T]) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: & &self/[T]) -> bool { !(*self).eq(other) }
 }
 
 
 impl<T: Eq> ~[T] : Eq {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn eq(other: &~[T]) -> bool { eq(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &~[T]) -> bool { eq((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ne(other: &~[T]) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &~[T]) -> bool { !(*self).eq(other) }
 }
 
 impl<T: Eq> @[T] : Eq {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn eq(other: &@[T]) -> bool { eq(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn eq(&self, other: &@[T]) -> bool { eq((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ne(other: &@[T]) -> bool { !self.eq(other) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ne(&self, other: &@[T]) -> bool { !(*self).eq(other) }
 }
 
@@ -1414,82 +1390,34 @@ pure fn gt<T: Ord>(a: &[T], b: &[T]) -> bool { lt(b, a)  }
 
 impl<T: Ord> &[T] : Ord {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn lt(other: & &self/[T]) -> bool { lt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: & &self/[T]) -> bool { lt((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn le(other: & &self/[T]) -> bool { le(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: & &self/[T]) -> bool { le((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ge(other: & &self/[T]) -> bool { ge(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: & &self/[T]) -> bool { ge((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn gt(other: & &self/[T]) -> bool { gt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: & &self/[T]) -> bool { gt((*self), (*other)) }
 }
 
 impl<T: Ord> ~[T] : Ord {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn lt(other: &~[T]) -> bool { lt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &~[T]) -> bool { lt((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn le(other: &~[T]) -> bool { le(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &~[T]) -> bool { le((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ge(other: &~[T]) -> bool { ge(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &~[T]) -> bool { ge((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn gt(other: &~[T]) -> bool { gt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &~[T]) -> bool { gt((*self), (*other)) }
 }
 
 impl<T: Ord> @[T] : Ord {
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn lt(other: &@[T]) -> bool { lt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn lt(&self, other: &@[T]) -> bool { lt((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn le(other: &@[T]) -> bool { le(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn le(&self, other: &@[T]) -> bool { le((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn ge(other: &@[T]) -> bool { ge(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn ge(&self, other: &@[T]) -> bool { ge((*self), (*other)) }
     #[inline(always)]
-    #[cfg(stage0)]
-    pure fn gt(other: &@[T]) -> bool { gt(self, (*other)) }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
     pure fn gt(&self, other: &@[T]) -> bool { gt((*self), (*other)) }
 }