about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-11-30 00:47:45 -0800
committerBrian Anderson <banderson@mozilla.com>2012-11-30 01:32:53 -0800
commitb52a4b412e515620c2c3ccbe8b7f8c7e0300f6ff (patch)
treebf47bce8679ce1dde1d1b4c172924858e1bfc737
parent3ed9fbd63c6a3c6226bc466786e6d3c1bfec856d (diff)
core: Make core.rc more readable. Cleanup
-rw-r--r--src/libcore/bool.rs1
-rw-r--r--src/libcore/box.rs2
-rw-r--r--src/libcore/char.rs1
-rw-r--r--src/libcore/cmp.rs85
-rw-r--r--src/libcore/core.rc224
-rw-r--r--src/libcore/f32.rs2
-rw-r--r--src/libcore/f64.rs2
-rw-r--r--src/libcore/float.rs2
-rw-r--r--src/libcore/int-template.rs2
-rw-r--r--src/libcore/int-template/i16.rs2
-rw-r--r--src/libcore/int-template/i32.rs2
-rw-r--r--src/libcore/int-template/i64.rs2
-rw-r--r--src/libcore/int-template/i8.rs2
-rw-r--r--src/libcore/int-template/int.rs2
-rw-r--r--src/libcore/kinds.rs21
-rw-r--r--src/libcore/ops.rs22
-rw-r--r--src/libcore/owned.rs2
-rw-r--r--src/libcore/ptr.rs4
-rw-r--r--src/libcore/rt.rs2
-rw-r--r--src/libcore/str.rs6
-rw-r--r--src/libcore/tuple.rs4
-rw-r--r--src/libcore/uint-template.rs2
-rw-r--r--src/libcore/uint-template/u16.rs2
-rw-r--r--src/libcore/uint-template/u32.rs2
-rw-r--r--src/libcore/uint-template/u64.rs2
-rw-r--r--src/libcore/uint-template/u8.rs2
-rw-r--r--src/libcore/uint-template/uint.rs2
-rw-r--r--src/libcore/unit.rs2
-rw-r--r--src/libcore/vec.rs30
29 files changed, 215 insertions, 221 deletions
diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs
index 644cc90ccf6..8ea5772dc12 100644
--- a/src/libcore/bool.rs
+++ b/src/libcore/bool.rs
@@ -65,6 +65,7 @@ pub fn all_values(blk: fn(v: bool)) {
 /// converts truth value to an 8 bit byte
 pub pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
 
+#[cfg(notest)]
 impl bool : cmp::Eq {
     pure fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
     pure fn ne(&self, other: &bool) -> bool { (*self) != (*other) }
diff --git a/src/libcore/box.rs b/src/libcore/box.rs
index 4b4890f770f..920b98d7b0b 100644
--- a/src/libcore/box.rs
+++ b/src/libcore/box.rs
@@ -27,11 +27,13 @@ pub pure fn ptr_eq<T>(a: @T, b: @T) -> bool {
     unsafe { ptr::addr_of(&(*a)) == ptr::addr_of(&(*b)) }
 }
 
+#[cfg(notest)]
 impl<T:Eq> @const T : Eq {
     pure fn eq(&self, other: &@const T) -> bool { *(*self) == *(*other) }
     pure fn ne(&self, other: &@const T) -> bool { *(*self) != *(*other) }
 }
 
+#[cfg(notest)]
 impl<T:Ord> @const T : Ord {
     pure fn lt(&self, other: &@const T) -> bool { *(*self) < *(*other) }
     pure fn le(&self, other: &@const T) -> bool { *(*self) <= *(*other) }
diff --git a/src/libcore/char.rs b/src/libcore/char.rs
index f1c67785aa0..d88e7ec9be1 100644
--- a/src/libcore/char.rs
+++ b/src/libcore/char.rs
@@ -180,6 +180,7 @@ pub pure fn cmp(a: char, b: char) -> int {
     else { 0 }
 }
 
+#[cfg(notest)]
 impl char : Eq {
     pure fn eq(&self, other: &char) -> bool { (*self) == (*other) }
     pure fn ne(&self, other: &char) -> bool { (*self) != (*other) }
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 97f439d936b..0a9335d3774 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -14,70 +14,35 @@ and `Eq` to overload the `==` and `!=` operators.
 #[forbid(deprecated_mode)];
 #[forbid(deprecated_pattern)];
 
-pub use nounittest::*;
-pub use unittest::*;
-
-/// Interfaces used for comparison.
-
-// Awful hack to work around duplicate lang items in core test.
-#[cfg(notest)]
-mod nounittest {
-    /**
-     * Trait for values that can be compared for a sort-order.
-     *
-     * Eventually this may be simplified to only require
-     * an `le` method, with the others generated from
-     * default implementations.
-     */
-    #[lang="ord"]
-    pub trait Ord {
-        pure fn lt(&self, other: &self) -> bool;
-        pure fn le(&self, other: &self) -> bool;
-        pure fn ge(&self, other: &self) -> bool;
-        pure fn gt(&self, other: &self) -> bool;
-    }
-
-    #[lang="eq"]
-    /**
-     * Trait for values that can be compared for equality
-     * and inequality.
-     *
-     * Eventually this may be simplified to only require
-     * an `eq` method, with the other generated from
-     * a default implementation.
-     */
-    #[lang="eq"]
-    pub trait Eq {
-        pure fn eq(&self, other: &self) -> bool;
-        pure fn ne(&self, other: &self) -> bool;
-    }
+/**
+* Trait for values that can be compared for equality
+* and inequality.
+*
+* Eventually this may be simplified to only require
+* an `eq` method, with the other generated from
+* a default implementation.
+*/
+#[lang="eq"]
+pub trait Eq {
+    pure fn eq(&self, other: &self) -> bool;
+    pure fn ne(&self, other: &self) -> bool;
 }
 
-#[cfg(test)]
-mod nounittest {
-    #[legacy_exports];}
-
-#[cfg(test)]
-mod unittest {
-    #[legacy_exports];
-
-    pub trait Ord {
-        pure fn lt(&self, other: &self) -> bool;
-        pure fn le(&self, other: &self) -> bool;
-        pure fn ge(&self, other: &self) -> bool;
-        pure fn gt(&self, other: &self) -> bool;
-    }
-
-    pub trait Eq {
-        pure fn eq(&self, other: &self) -> bool;
-        pure fn ne(&self, other: &self) -> bool;
-    }
+/**
+* Trait for values that can be compared for a sort-order.
+*
+* Eventually this may be simplified to only require
+* an `le` method, with the others generated from
+* default implementations.
+*/
+#[lang="ord"]
+pub trait Ord {
+    pure fn lt(&self, other: &self) -> bool;
+    pure fn le(&self, other: &self) -> bool;
+    pure fn ge(&self, other: &self) -> bool;
+    pure fn gt(&self, other: &self) -> bool;
 }
 
-#[cfg(notest)]
-mod unittest {
-    #[legacy_exports];}
-
 pub pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool {
     (*v1).lt(v2)
 }
diff --git a/src/libcore/core.rc b/src/libcore/core.rc
index ccd102e9ca5..e371082a50d 100644
--- a/src/libcore/core.rc
+++ b/src/libcore/core.rc
@@ -1,6 +1,6 @@
 /*!
 
-The Rust core library.
+The Rust core library
 
 The Rust core library provides runtime features required by the language,
 including the task scheduler and memory allocators, as well as library
@@ -24,6 +24,7 @@ Implicitly, all crates behave as if they included the following prologue:
 
 */
 
+
 #[link(name = "core",
        vers = "0.5",
        uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
@@ -33,125 +34,110 @@ Implicitly, all crates behave as if they included the following prologue:
 #[license = "MIT"];
 #[crate_type = "lib"];
 
+
 // Don't link to core. We are core.
 #[no_core];
 
 #[warn(deprecated_mode)];
 #[warn(deprecated_pattern)];
-
 #[warn(vecs_implicitly_copyable)];
 #[deny(non_camel_case_types)];
 
-// Built-in-type support modules
 
-/// Operations and constants for `int`
-#[path = "int-template.rs"]
-#[merge = "int-template/int.rs"]
-pub mod int;
+/* Primitive types */
 
-/// Operations and constants for `i8`
-#[path = "int-template.rs"]
-#[merge = "int-template/i8.rs"]
+#[path = "int-template.rs"] #[merge = "int-template/int.rs"]
+pub mod int;
+#[path = "int-template.rs"] #[merge = "int-template/i8.rs"]
 pub mod i8;
-
-/// Operations and constants for `i16`
-#[path = "int-template.rs"]
-#[merge = "int-template/i16.rs"]
+#[path = "int-template.rs"] #[merge = "int-template/i16.rs"]
 pub mod i16;
-
-/// Operations and constants for `i32`
-#[path = "int-template.rs"]
-#[merge = "int-template/i32.rs"]
+#[path = "int-template.rs"] #[merge = "int-template/i32.rs"]
 pub mod i32;
-
-/// Operations and constants for `i64`
-#[path = "int-template.rs"]
-#[merge = "int-template/i64.rs"]
+#[path = "int-template.rs"] #[merge = "int-template/i64.rs"]
 pub mod i64;
-
-/// Operations and constants for `uint`
-#[path = "uint-template.rs"]
-#[merge = "uint-template/uint.rs"]
+#[path = "uint-template.rs"] #[merge = "uint-template/uint.rs"]
 pub mod uint;
 
-/// Operations and constants for `u8`
-#[path = "uint-template.rs"]
-#[merge = "uint-template/u8.rs"]
+#[path = "uint-template.rs"] #[merge = "uint-template/u8.rs"]
 pub mod u8;
-
-/// Operations and constants for `u16`
-#[path = "uint-template.rs"]
-#[merge = "uint-template/u16.rs"]
+#[path = "uint-template.rs"] #[merge = "uint-template/u16.rs"]
 pub mod u16;
-
-/// Operations and constants for `u32`
-#[path = "uint-template.rs"]
-#[merge = "uint-template/u32.rs"]
+#[path = "uint-template.rs"] #[merge = "uint-template/u32.rs"]
 pub mod u32;
-
-/// Operations and constants for `u64`
-#[path = "uint-template.rs"]
-#[merge = "uint-template/u64.rs"]
+#[path = "uint-template.rs"] #[merge = "uint-template/u64.rs"]
 pub mod u64;
 
-
-pub mod box;
-pub mod char;
 pub mod float;
 pub mod f32;
 pub mod f64;
-pub mod str;
-pub mod ptr;
-pub mod vec;
-pub mod at_vec;
+
+pub mod unit;
 pub mod bool;
+pub mod char;
 pub mod tuple;
-pub mod unit;
+
+pub mod vec;
+pub mod at_vec;
+pub mod str;
+
+pub mod ptr;
+pub mod box; // FIXME #4079 Rename to 'managed' to match 'owned'
 pub mod owned;
 
-// Ubiquitous-utility-type modules
 
-#[cfg(notest)]
-pub mod ops;
-pub mod cmp;
+/* Core language traits */
+
+#[cfg(notest)] pub mod kinds;
+#[cfg(notest)] pub mod ops;
+#[cfg(notest)] pub mod cmp;
+
+// Make core testable by not duplicating lang items. See #2912
+#[cfg(test)] extern mod realcore(name = "core", vers = "0.5");
+#[cfg(test)] pub use kinds = realcore::kinds;
+#[cfg(test)] pub use ops = realcore::ops;
+#[cfg(test)] pub use cmp = realcore::cmp;
+
+
+/* Common traits */
+
+pub mod from_str;
 pub mod num;
-pub mod hash;
-pub mod either;
 pub mod iter;
-pub mod logging;
-pub mod option;
-#[path="iter-trait.rs"]
-#[merge = "iter-trait/option.rs"]
-pub mod option_iter;
-pub mod result;
 pub mod to_str;
 pub mod to_bytes;
-pub mod from_str;
-pub mod util;
 pub mod clone;
+pub mod io;
+pub mod hash;
 
-// Data structure modules
 
+/* Common data structures */
+
+pub mod option;
+#[path="iter-trait.rs"] #[merge = "iter-trait/option.rs"]
+pub mod option_iter;
+pub mod result;
+pub mod either;
 pub mod dvec;
-#[path="iter-trait.rs"]
-#[merge = "iter-trait/dvec.rs"]
+#[path="iter-trait.rs"] #[merge = "iter-trait/dvec.rs"]
 pub mod dvec_iter;
 pub mod dlist;
-#[path="iter-trait.rs"]
-#[merge = "iter-trait/dlist.rs"]
+#[path="iter-trait.rs"] #[merge = "iter-trait/dlist.rs"]
 pub mod dlist_iter;
 pub mod send_map;
 
-// Concurrency
+
+/* Tasks and communication */
+
 pub mod comm;
 #[path = "task/mod.rs"]
 pub mod task;
 pub mod pipes;
 
-// Runtime and language-primitive support
+
+/* Runtime and platform support */
 
 pub mod gc;
-pub mod io;
 pub mod libc;
 pub mod os;
 pub mod path;
@@ -165,36 +151,28 @@ pub mod repr;
 pub mod cleanup;
 pub mod reflect;
 pub mod condition;
+pub mod logging;
+pub mod util;
 
-// Modules supporting compiler-generated code
-// Exported but not part of the public interface
-
-pub mod extfmt;
-// The test harness links against core, so don't include runtime in tests.
-#[cfg(notest)]
-#[legacy_exports]
-pub mod rt;
 
-// Ideally not exported, but currently is.
-pub mod private;
+/* Reexported core operators */
 
-// For internal use, not exported.
-mod unicode;
-mod cmath;
-mod stackwalk;
+pub use kinds::{Const, Copy, Send, Owned};
+pub use ops::{Drop};
+pub use ops::{Add, Sub, Mul, Div, Modulo, Neg};
+pub use ops::{BitAnd, BitOr, BitXor};
+pub use ops::{Shl, Shr, Index};
 
-// Top-level, visible-everywhere definitions.
 
-// Export various ubiquitous types, constructors, methods.
+/* Reexported types and traits */
 
-pub use option::{Some, None};
-pub use Option = option::Option;
+pub use option::{Option, Some, None};
 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 path::Path;
+pub use path::GenericPath;
+pub use path::WindowsPath;
+pub use path::PosixPath;
 
 pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
 pub use str::{StrSlice, Trimmable};
@@ -203,44 +181,18 @@ 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.
+
+/*
+ * 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;
@@ -251,6 +203,24 @@ pub const info : u32 = 3_u32;
 /// The debug log level
 pub const debug : u32 = 4_u32;
 
+
+/* Unsupported interfaces */
+
+// The runtime interface used by the compiler
+#[cfg(notest)] pub mod rt;
+// The runtime and compiler interface to fmt!
+pub mod extfmt;
+// Private APIs
+pub mod private;
+
+
+/* For internal use, not exported */
+
+mod unicode;
+mod cmath;
+mod stackwalk;
+
+
 // 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.
@@ -262,6 +232,7 @@ mod core {
     pub const debug : u32 = 4_u32;
 }
 
+
 // Similar to above. Some magic to make core testable.
 #[cfg(test)]
 mod std {
@@ -269,6 +240,7 @@ mod std {
     pub use std::test;
 }
 
+
 // Local Variables:
 // mode: rust;
 // fill-column: 78;
diff --git a/src/libcore/f32.rs b/src/libcore/f32.rs
index 7ddf81629eb..2d0b130688d 100644
--- a/src/libcore/f32.rs
+++ b/src/libcore/f32.rs
@@ -138,11 +138,13 @@ pub pure fn logarithm(n: f32, b: f32) -> f32 {
     return log2(n) / log2(b);
 }
 
+#[cfg(notest)]
 impl f32 : cmp::Eq {
     pure fn eq(&self, other: &f32) -> bool { (*self) == (*other) }
     pure fn ne(&self, other: &f32) -> bool { (*self) != (*other) }
 }
 
+#[cfg(notest)]
 impl f32 : cmp::Ord {
     pure fn lt(&self, other: &f32) -> bool { (*self) < (*other) }
     pure fn le(&self, other: &f32) -> bool { (*self) <= (*other) }
diff --git a/src/libcore/f64.rs b/src/libcore/f64.rs
index c2d99d1ed40..6adbbbb2c40 100644
--- a/src/libcore/f64.rs
+++ b/src/libcore/f64.rs
@@ -157,11 +157,13 @@ pub pure fn logarithm(n: f64, b: f64) -> f64 {
     return log2(n) / log2(b);
 }
 
+#[cfg(notest)]
 impl f64 : cmp::Eq {
     pure fn eq(&self, other: &f64) -> bool { (*self) == (*other) }
     pure fn ne(&self, other: &f64) -> bool { (*self) != (*other) }
 }
 
+#[cfg(notest)]
 impl f64 : cmp::Ord {
     pure fn lt(&self, other: &f64) -> bool { (*self) < (*other) }
     pure fn le(&self, other: &f64) -> bool { (*self) <= (*other) }
diff --git a/src/libcore/float.rs b/src/libcore/float.rs
index a5740c71323..50dd4b90bfb 100644
--- a/src/libcore/float.rs
+++ b/src/libcore/float.rs
@@ -399,11 +399,13 @@ pub pure fn sin(x: float) -> float { f64::sin(x as f64) as float }
 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 }
 
+#[cfg(notest)]
 impl float : Eq {
     pure fn eq(&self, other: &float) -> bool { (*self) == (*other) }
     pure fn ne(&self, other: &float) -> bool { (*self) != (*other) }
 }
 
+#[cfg(notest)]
 impl float : Ord {
     pure fn lt(&self, other: &float) -> bool { (*self) < (*other) }
     pure fn le(&self, other: &float) -> bool { (*self) <= (*other) }
diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs
index e1383ba5ac2..4763f55400a 100644
--- a/src/libcore/int-template.rs
+++ b/src/libcore/int-template.rs
@@ -54,6 +54,7 @@ pub pure fn abs(i: T) -> T {
     if is_negative(i) { -i } else { i }
 }
 
+#[cfg(notest)]
 impl T : Ord {
     pure fn lt(&self, other: &T) -> bool { return (*self) < (*other); }
     pure fn le(&self, other: &T) -> bool { return (*self) <= (*other); }
@@ -61,6 +62,7 @@ impl T : Ord {
     pure fn gt(&self, other: &T) -> bool { return (*self) > (*other); }
 }
 
+#[cfg(notest)]
 impl T : Eq {
     pure fn eq(&self, other: &T) -> bool { return (*self) == (*other); }
     pure fn ne(&self, other: &T) -> bool { return (*self) != (*other); }
diff --git a/src/libcore/int-template/i16.rs b/src/libcore/int-template/i16.rs
index b24eb86e4ae..ccafb8f9d3b 100644
--- a/src/libcore/int-template/i16.rs
+++ b/src/libcore/int-template/i16.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `i16`
+
 mod inst {
     pub type T = i16;
     pub const bits: uint = u16::bits;
diff --git a/src/libcore/int-template/i32.rs b/src/libcore/int-template/i32.rs
index 5bfb8a6d01c..f890ff1f918 100644
--- a/src/libcore/int-template/i32.rs
+++ b/src/libcore/int-template/i32.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `i32`
+
 mod inst {
     pub type T = i32;
     pub const bits: uint = u32::bits;
diff --git a/src/libcore/int-template/i64.rs b/src/libcore/int-template/i64.rs
index 86552b2cced..1afefc3135e 100644
--- a/src/libcore/int-template/i64.rs
+++ b/src/libcore/int-template/i64.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `i64`
+
 mod inst {
     pub type T = i64;
     pub const bits: uint = u64::bits;
diff --git a/src/libcore/int-template/i8.rs b/src/libcore/int-template/i8.rs
index 2cf7ed2983f..6dd14ef842d 100644
--- a/src/libcore/int-template/i8.rs
+++ b/src/libcore/int-template/i8.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `i8`
+
 mod inst {
     pub type T = i8;
     pub const bits: uint = u8::bits;
diff --git a/src/libcore/int-template/int.rs b/src/libcore/int-template/int.rs
index c1f2ca944dd..5bd1ac667be 100644
--- a/src/libcore/int-template/int.rs
+++ b/src/libcore/int-template/int.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `int`
+
 pub use inst::pow;
 
 mod inst {
diff --git a/src/libcore/kinds.rs b/src/libcore/kinds.rs
new file mode 100644
index 00000000000..973a0888448
--- /dev/null
+++ b/src/libcore/kinds.rs
@@ -0,0 +1,21 @@
+//! The kind traits
+
+#[lang="const"]
+pub trait Const {
+    // Empty.
+}
+
+#[lang="copy"]
+pub trait Copy {
+    // Empty.
+}
+
+#[lang="send"]
+pub trait Send {
+    // Empty.
+}
+
+#[lang="owned"]
+pub trait Owned {
+    // Empty.
+}
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs
index 5c56ed7608f..9180d50a8f6 100644
--- a/src/libcore/ops.rs
+++ b/src/libcore/ops.rs
@@ -1,28 +1,8 @@
-// Core operators and kinds.
+// Core operators
 
 #[forbid(deprecated_mode)];
 #[forbid(deprecated_pattern)];
 
-#[lang="const"]
-pub trait Const {
-    // Empty.
-}
-
-#[lang="copy"]
-pub trait Copy {
-    // Empty.
-}
-
-#[lang="send"]
-pub trait Send {
-    // Empty.
-}
-
-#[lang="owned"]
-pub trait Owned {
-    // Empty.
-}
-
 #[lang="drop"]
 pub trait Drop {
     fn finalize(&self);  // XXX: Rename to "drop"? --pcwalton
diff --git a/src/libcore/owned.rs b/src/libcore/owned.rs
index aaee987b4bd..a8a6b5d30d0 100644
--- a/src/libcore/owned.rs
+++ b/src/libcore/owned.rs
@@ -6,11 +6,13 @@
 
 use cmp::{Eq, Ord};
 
+#[cfg(notest)]
 impl<T:Eq> ~const T : Eq {
     pure fn eq(&self, other: &~const T) -> bool { *(*self) == *(*other) }
     pure fn ne(&self, other: &~const T) -> bool { *(*self) != *(*other) }
 }
 
+#[cfg(notest)]
 impl<T:Ord> ~const T : Ord {
     pure fn lt(&self, other: &~const T) -> bool { *(*self) < *(*other) }
     pure fn le(&self, other: &~const T) -> bool { *(*self) <= *(*other) }
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 2cbd1173a6e..0ccb14c98e8 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -207,6 +207,7 @@ impl<T> *mut T: Ptr<T> {
 }
 
 // Equality for pointers
+#[cfg(notest)]
 impl<T> *const T : Eq {
     pure fn eq(&self, other: &*const T) -> bool unsafe {
         let a: uint = cast::reinterpret_cast(&(*self));
@@ -217,6 +218,7 @@ impl<T> *const T : Eq {
 }
 
 // Comparison for pointers
+#[cfg(notest)]
 impl<T> *const T : Ord {
     pure fn lt(&self, other: &*const T) -> bool unsafe {
         let a: uint = cast::reinterpret_cast(&(*self));
@@ -241,6 +243,7 @@ impl<T> *const T : Ord {
 }
 
 // Equality for region pointers
+#[cfg(notest)]
 impl<T:Eq> &const T : Eq {
     pure fn eq(&self, other: & &self/const T) -> bool {
         return *(*self) == *(*other);
@@ -251,6 +254,7 @@ impl<T:Eq> &const T : Eq {
 }
 
 // Comparison for region pointers
+#[cfg(notest)]
 impl<T:Ord> &const T : Ord {
     pure fn lt(&self, other: & &self/const T) -> bool {
         *(*self) < *(*other)
diff --git a/src/libcore/rt.rs b/src/libcore/rt.rs
index 04a8ee30235..22a13db5245 100644
--- a/src/libcore/rt.rs
+++ b/src/libcore/rt.rs
@@ -1,3 +1,5 @@
+#[legacy_exports];
+
 // NB: transitionary, de-mode-ing.
 #[forbid(deprecated_mode)];
 #[forbid(deprecated_pattern)];
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 825d314d58e..f4900d80a8e 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -735,6 +735,7 @@ pure fn gt(a: &str, b: &str) -> bool {
     !le(a, b)
 }
 
+#[cfg(notest)]
 impl &str : Eq {
     #[inline(always)]
     pure fn eq(&self, other: & &self/str) -> bool {
@@ -744,6 +745,7 @@ impl &str : Eq {
     pure fn ne(&self, other: & &self/str) -> bool { !(*self).eq(other) }
 }
 
+#[cfg(notest)]
 impl ~str : Eq {
     #[inline(always)]
     pure fn eq(&self, other: &~str) -> bool {
@@ -753,6 +755,7 @@ impl ~str : Eq {
     pure fn ne(&self, other: &~str) -> bool { !(*self).eq(other) }
 }
 
+#[cfg(notest)]
 impl @str : Eq {
     #[inline(always)]
     pure fn eq(&self, other: &@str) -> bool {
@@ -762,6 +765,7 @@ impl @str : Eq {
     pure fn ne(&self, other: &@str) -> bool { !(*self).eq(other) }
 }
 
+#[cfg(notest)]
 impl ~str : Ord {
     #[inline(always)]
     pure fn lt(&self, other: &~str) -> bool { lt((*self), (*other)) }
@@ -773,6 +777,7 @@ impl ~str : Ord {
     pure fn gt(&self, other: &~str) -> bool { gt((*self), (*other)) }
 }
 
+#[cfg(notest)]
 impl &str : Ord {
     #[inline(always)]
     pure fn lt(&self, other: & &self/str) -> bool { lt((*self), (*other)) }
@@ -784,6 +789,7 @@ impl &str : Ord {
     pure fn gt(&self, other: & &self/str) -> bool { gt((*self), (*other)) }
 }
 
+#[cfg(notest)]
 impl @str : Ord {
     #[inline(always)]
     pure fn lt(&self, other: &@str) -> bool { lt((*self), (*other)) }
diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs
index 78a3e3c8355..5f6881b8f14 100644
--- a/src/libcore/tuple.rs
+++ b/src/libcore/tuple.rs
@@ -94,6 +94,7 @@ impl<A: Copy, B: Copy> (~[A], ~[B]): ExtendedTupleOps<A,B> {
     }
 }
 
+#[cfg(notest)]
 impl<A: Eq, B: Eq> (A, B) : Eq {
     pure fn eq(&self, other: &(A, B)) -> bool {
         match (*self) {
@@ -107,6 +108,7 @@ impl<A: Eq, B: Eq> (A, B) : Eq {
     pure fn ne(&self, other: &(A, B)) -> bool { !(*self).eq(other) }
 }
 
+#[cfg(notest)]
 impl<A: Ord, B: Ord> (A, B) : Ord {
     pure fn lt(&self, other: &(A, B)) -> bool {
         match (*self) {
@@ -127,6 +129,7 @@ impl<A: Ord, B: Ord> (A, B) : Ord {
     pure fn gt(&self, other: &(A, B)) -> bool { (*other).lt(&(*self))  }
 }
 
+#[cfg(notest)]
 impl<A: Eq, B: Eq, C: Eq> (A, B, C) : Eq {
     pure fn eq(&self, other: &(A, B, C)) -> bool {
         match (*self) {
@@ -141,6 +144,7 @@ impl<A: Eq, B: Eq, C: Eq> (A, B, C) : Eq {
     pure fn ne(&self, other: &(A, B, C)) -> bool { !(*self).eq(other) }
 }
 
+#[cfg(notest)]
 impl<A: Ord, B: Ord, C: Ord> (A, B, C) : Ord {
     pure fn lt(&self, other: &(A, B, C)) -> bool {
         match (*self) {
diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs
index e96a6766570..9c191e7dadf 100644
--- a/src/libcore/uint-template.rs
+++ b/src/libcore/uint-template.rs
@@ -48,6 +48,7 @@ pub pure fn compl(i: T) -> T {
     max_value ^ i
 }
 
+#[cfg(notest)]
 impl T : Ord {
     pure fn lt(&self, other: &T) -> bool { (*self) < (*other) }
     pure fn le(&self, other: &T) -> bool { (*self) <= (*other) }
@@ -55,6 +56,7 @@ impl T : Ord {
     pure fn gt(&self, other: &T) -> bool { (*self) > (*other) }
 }
 
+#[cfg(notest)]
 impl T : Eq {
     pure fn eq(&self, other: &T) -> bool { return (*self) == (*other); }
     pure fn ne(&self, other: &T) -> bool { return (*self) != (*other); }
diff --git a/src/libcore/uint-template/u16.rs b/src/libcore/uint-template/u16.rs
index aafd46f845b..fe465aa1c6f 100644
--- a/src/libcore/uint-template/u16.rs
+++ b/src/libcore/uint-template/u16.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `u16`
+
 mod inst {
     pub type T = u16;
     pub const bits: uint = 16;
diff --git a/src/libcore/uint-template/u32.rs b/src/libcore/uint-template/u32.rs
index 8e784bdf225..7ec576d3500 100644
--- a/src/libcore/uint-template/u32.rs
+++ b/src/libcore/uint-template/u32.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `u32`
+
 mod inst {
     pub type T = u32;
     pub const bits: uint = 32;
diff --git a/src/libcore/uint-template/u64.rs b/src/libcore/uint-template/u64.rs
index 43a8169f08b..860d60b3830 100644
--- a/src/libcore/uint-template/u64.rs
+++ b/src/libcore/uint-template/u64.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `u64`
+
 mod inst {
     pub type T = u64;
     pub const bits: uint = 64;
diff --git a/src/libcore/uint-template/u8.rs b/src/libcore/uint-template/u8.rs
index a3e750861e5..2ee9af9882d 100644
--- a/src/libcore/uint-template/u8.rs
+++ b/src/libcore/uint-template/u8.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `u8`
+
 pub use inst::is_ascii;
 
 mod inst {
diff --git a/src/libcore/uint-template/uint.rs b/src/libcore/uint-template/uint.rs
index 68054d47e1f..1c635db2f54 100644
--- a/src/libcore/uint-template/uint.rs
+++ b/src/libcore/uint-template/uint.rs
@@ -1,3 +1,5 @@
+//! Operations and constants for `uint`
+
 pub use inst::{
     div_ceil, div_round, div_floor, iterate,
     next_power_of_two
diff --git a/src/libcore/unit.rs b/src/libcore/unit.rs
index 6110b9eebff..dc7379212ba 100644
--- a/src/libcore/unit.rs
+++ b/src/libcore/unit.rs
@@ -10,11 +10,13 @@ Functions for the unit type.
 
 use cmp::{Eq, Ord};
 
+#[cfg(notest)]
 impl () : Eq {
     pure fn eq(&self, _other: &()) -> bool { true }
     pure fn ne(&self, _other: &()) -> bool { false }
 }
 
+#[cfg(notest)]
 impl () : Ord {
     pure fn lt(&self, _other: &()) -> bool { false }
     pure fn le(&self, _other: &()) -> bool { true }
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 47864d0b562..976bcbf394b 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -1345,6 +1345,7 @@ pure fn eq<T: Eq>(a: &[T], b: &[T]) -> bool {
     return true;
 }
 
+#[cfg(notest)]
 impl<T: Eq> &[T] : Eq {
     #[inline(always)]
     pure fn eq(&self, other: & &self/[T]) -> bool { eq((*self), (*other)) }
@@ -1353,6 +1354,7 @@ impl<T: Eq> &[T] : Eq {
 }
 
 
+#[cfg(notest)]
 impl<T: Eq> ~[T] : Eq {
     #[inline(always)]
     pure fn eq(&self, other: &~[T]) -> bool { eq((*self), (*other)) }
@@ -1360,6 +1362,7 @@ impl<T: Eq> ~[T] : Eq {
     pure fn ne(&self, other: &~[T]) -> bool { !(*self).eq(other) }
 }
 
+#[cfg(notest)]
 impl<T: Eq> @[T] : Eq {
     #[inline(always)]
     pure fn eq(&self, other: &@[T]) -> bool { eq((*self), (*other)) }
@@ -1388,6 +1391,7 @@ pure fn le<T: Ord>(a: &[T], b: &[T]) -> bool { !lt(b, a) }
 pure fn ge<T: Ord>(a: &[T], b: &[T]) -> bool { !lt(a, b) }
 pure fn gt<T: Ord>(a: &[T], b: &[T]) -> bool { lt(b, a)  }
 
+#[cfg(notest)]
 impl<T: Ord> &[T] : Ord {
     #[inline(always)]
     pure fn lt(&self, other: & &self/[T]) -> bool { lt((*self), (*other)) }
@@ -1399,6 +1403,7 @@ impl<T: Ord> &[T] : Ord {
     pure fn gt(&self, other: & &self/[T]) -> bool { gt((*self), (*other)) }
 }
 
+#[cfg(notest)]
 impl<T: Ord> ~[T] : Ord {
     #[inline(always)]
     pure fn lt(&self, other: &~[T]) -> bool { lt((*self), (*other)) }
@@ -1410,6 +1415,7 @@ impl<T: Ord> ~[T] : Ord {
     pure fn gt(&self, other: &~[T]) -> bool { gt((*self), (*other)) }
 }
 
+#[cfg(notest)]
 impl<T: Ord> @[T] : Ord {
     #[inline(always)]
     pure fn lt(&self, other: &@[T]) -> bool { lt((*self), (*other)) }
@@ -1422,25 +1428,21 @@ impl<T: Ord> @[T] : Ord {
 }
 
 #[cfg(notest)]
-pub mod traits {
-    impl<T: Copy> ~[T] : Add<&[const T],~[T]> {
-        #[inline(always)]
-        pure fn add(rhs: & &self/[const T]) -> ~[T] {
-            append(copy self, (*rhs))
-        }
+impl<T: Copy> ~[T] : Add<&[const T],~[T]> {
+    #[inline(always)]
+    pure fn add(rhs: & &self/[const T]) -> ~[T] {
+        append(copy self, (*rhs))
     }
+}
 
-    impl<T: Copy> ~[mut T] : Add<&[const T],~[mut T]> {
-        #[inline(always)]
-        pure fn add(rhs: & &self/[const T]) -> ~[mut T] {
-            append_mut(copy self, (*rhs))
-        }
+#[cfg(notest)]
+impl<T: Copy> ~[mut T] : Add<&[const T],~[mut T]> {
+    #[inline(always)]
+    pure fn add(rhs: & &self/[const T]) -> ~[mut T] {
+        append_mut(copy self, (*rhs))
     }
 }
 
-#[cfg(test)]
-pub mod traits {}
-
 pub trait ConstVector {
     pure fn is_empty() -> bool;
     pure fn is_not_empty() -> bool;