about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/at_vec.rs2
-rw-r--r--src/libcore/cleanup.rs2
-rw-r--r--src/libcore/cmp.rs76
-rw-r--r--src/libcore/comm.rs6
-rw-r--r--src/libcore/core.rc10
-rw-r--r--src/libcore/dvec.rs8
-rw-r--r--src/libcore/num/f32.rs2
-rw-r--r--src/libcore/num/f64.rs2
-rw-r--r--src/libcore/os.rs23
-rw-r--r--src/libcore/pipes.rs4
-rw-r--r--src/libcore/prelude.rs6
-rw-r--r--src/libcore/ptr.rs8
-rw-r--r--src/libcore/str.rs40
-rw-r--r--src/libcore/task/local_data_priv.rs6
-rw-r--r--src/libcore/task/spawn.rs14
-rw-r--r--src/libcore/unstable.rs (renamed from src/libcore/private.rs)19
-rw-r--r--src/libcore/unstable/at_exit.rs (renamed from src/libcore/private/at_exit.rs)0
-rw-r--r--src/libcore/unstable/exchange_alloc.rs (renamed from src/libcore/private/exchange_alloc.rs)2
-rw-r--r--src/libcore/unstable/extfmt.rs (renamed from src/libcore/private/extfmt.rs)0
-rw-r--r--src/libcore/unstable/finally.rs (renamed from src/libcore/private/finally.rs)0
-rw-r--r--src/libcore/unstable/global.rs (renamed from src/libcore/private/global.rs)10
-rw-r--r--src/libcore/unstable/intrinsics.rs (renamed from src/libcore/private/intrinsics.rs)0
-rw-r--r--src/libcore/unstable/lang.rs (renamed from src/libcore/rt.rs)5
-rw-r--r--src/libcore/unstable/weak_task.rs (renamed from src/libcore/private/weak_task.rs)6
-rw-r--r--src/libcore/vec.rs67
25 files changed, 237 insertions, 81 deletions
diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs
index ab604d1f0b6..d89481766c0 100644
--- a/src/libcore/at_vec.rs
+++ b/src/libcore/at_vec.rs
@@ -183,7 +183,7 @@ pub mod raw {
     use at_vec::{capacity, rustrt};
     use cast::transmute;
     use libc;
-    use private::intrinsics::{move_val_init};
+    use unstable::intrinsics::{move_val_init};
     use ptr::addr_of;
     use ptr;
     use sys;
diff --git a/src/libcore/cleanup.rs b/src/libcore/cleanup.rs
index 6912d6d995b..393a71562ad 100644
--- a/src/libcore/cleanup.rs
+++ b/src/libcore/cleanup.rs
@@ -154,7 +154,7 @@ fn debug_mem() -> bool {
 #[cfg(notest)]
 #[lang="annihilate"]
 pub unsafe fn annihilate() {
-    use rt::local_free;
+    use unstable::lang::local_free;
     use io::WriterUtil;
     use io;
     use libc;
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index fd99235bd27..d588f0c53b1 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -37,6 +37,70 @@ pub trait Eq {
     pure fn ne(&self, other: &Self) -> bool;
 }
 
+#[deriving_eq]
+pub enum Ordering { Less, Equal, Greater }
+
+/// Trait for types that form a total order
+pub trait TotalOrd {
+    pure fn cmp(&self, other: &Self) -> Ordering;
+}
+
+pure fn icmp<T: Ord>(a: &T, b: &T) -> Ordering {
+    if *a < *b { Less }
+    else if *a > *b { Greater }
+    else { Equal }
+}
+
+impl TotalOrd for u8 {
+    #[inline(always)]
+    pure fn cmp(&self, other: &u8) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for u16 {
+    #[inline(always)]
+    pure fn cmp(&self, other: &u16) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for u32 {
+    #[inline(always)]
+    pure fn cmp(&self, other: &u32) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for u64 {
+    #[inline(always)]
+    pure fn cmp(&self, other: &u64) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for i8 {
+    #[inline(always)]
+    pure fn cmp(&self, other: &i8) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for i16 {
+    #[inline(always)]
+    pure fn cmp(&self, other: &i16) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for i32 {
+    #[inline(always)]
+    pure fn cmp(&self, other: &i32) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for i64 {
+    #[inline(always)]
+    pure fn cmp(&self, other: &i64) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for int {
+    #[inline(always)]
+    pure fn cmp(&self, other: &int) -> Ordering { icmp(self, other) }
+}
+
+impl TotalOrd for uint {
+    #[inline(always)]
+    pure fn cmp(&self, other: &uint) -> Ordering { icmp(self, other) }
+}
+
 /**
 * Trait for values that can be compared for a sort-order.
 *
@@ -94,3 +158,15 @@ pub pure fn min<T:Ord>(v1: T, v2: T) -> T {
 pub pure fn max<T:Ord>(v1: T, v2: T) -> T {
     if v1 > v2 { v1 } else { v2 }
 }
+
+#[cfg(test)]
+mod test {
+    #[test]
+    fn test_int() {
+        assert 5.cmp(&10) == Less;
+        assert 10.cmp(&5) == Greater;
+        assert 5.cmp(&5) == Equal;
+        assert (-5).cmp(&12) == Less;
+        assert 12.cmp(-5) == Greater;
+    }
+}
diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs
index 238207f12b6..94272f63e67 100644
--- a/src/libcore/comm.rs
+++ b/src/libcore/comm.rs
@@ -12,7 +12,7 @@ use either::{Either, Left, Right};
 use kinds::Owned;
 use option;
 use option::{Option, Some, None, unwrap};
-use private;
+use unstable;
 use vec;
 
 use pipes::{recv, try_recv, wait_many, peek, PacketHeader};
@@ -242,7 +242,7 @@ impl<T: Owned> Peekable<T> for PortSet<T> {
 }
 
 /// A channel that can be shared between many senders.
-pub type SharedChan<T> = private::Exclusive<Chan<T>>;
+pub type SharedChan<T> = unstable::Exclusive<Chan<T>>;
 
 impl<T: Owned> GenericChan<T> for SharedChan<T> {
     fn send(x: T) {
@@ -268,7 +268,7 @@ impl<T: Owned> GenericSmartChan<T> for SharedChan<T> {
 
 /// Converts a `chan` into a `shared_chan`.
 pub fn SharedChan<T:Owned>(c: Chan<T>) -> SharedChan<T> {
-    private::exclusive(c)
+    unstable::exclusive(c)
 }
 
 /// Receive a message from one of two endpoints.
diff --git a/src/libcore/core.rc b/src/libcore/core.rc
index 3e514ce249f..c8d2da28255 100644
--- a/src/libcore/core.rc
+++ b/src/libcore/core.rc
@@ -225,11 +225,13 @@ pub const debug : u32 = 4_u32;
 
 /* Unsupported interfaces */
 
-// The runtime interface used by the compiler
-#[cfg(notest)] pub mod rt;
 // Private APIs
-pub mod private;
-
+pub mod unstable;
+// NOTE: Remove after snapshot
+#[cfg(stage0)]
+pub mod private {
+    pub use super::unstable::extfmt;
+}
 
 /* For internal use, not exported */
 
diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs
index 1fef4ad42f1..7197de36404 100644
--- a/src/libcore/dvec.rs
+++ b/src/libcore/dvec.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -62,17 +62,17 @@ pub struct DVec<A> {
 
 /// Creates a new, empty dvec
 pub pure fn DVec<A>() -> DVec<A> {
-    DVec {mut data: ~[]}
+    DVec {data: ~[]}
 }
 
 /// Creates a new dvec with a single element
 pub pure fn from_elem<A>(e: A) -> DVec<A> {
-    DVec {mut data: ~[e]}
+    DVec {data: ~[e]}
 }
 
 /// Creates a new dvec with the contents of a vector
 pub pure fn from_vec<A>(v: ~[A]) -> DVec<A> {
-    DVec {mut data: v}
+    DVec {data: v}
 }
 
 /// Consumes the vector and returns its contents
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index c4f2704ab9f..d4808bd111f 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -18,7 +18,7 @@ use num::strconv;
 use num;
 use ops;
 use option::Option;
-use private::intrinsics::floorf32;
+use unstable::intrinsics::floorf32;
 use from_str;
 use to_str;
 
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index 8f3771312e4..5362a65f7ce 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -19,7 +19,7 @@ use num::strconv;
 use num;
 use ops;
 use option::Option;
-use private::intrinsics::floorf64;
+use unstable::intrinsics::floorf64;
 use to_str;
 use from_str;
 
diff --git a/src/libcore/os.rs b/src/libcore/os.rs
index 8b6d27496d9..cf74ec6d77a 100644
--- a/src/libcore/os.rs
+++ b/src/libcore/os.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -35,7 +35,6 @@ use libc::{mode_t, pid_t, FILE};
 use option;
 use option::{Some, None};
 use prelude::*;
-use private;
 use ptr;
 use str;
 use task;
@@ -145,8 +144,8 @@ This uses a per-runtime lock to serialize access.
 FIXME #4726: It would probably be appropriate to make this a real global
 */
 fn with_env_lock<T>(f: &fn() -> T) -> T {
-    use private::global::global_data_clone_create;
-    use private::{Exclusive, exclusive};
+    use unstable::global::global_data_clone_create;
+    use unstable::{Exclusive, exclusive};
 
     struct SharedValue(());
     type ValueMutex = Exclusive<SharedValue>;
@@ -322,8 +321,8 @@ pub struct Pipe { mut in: c_int, mut out: c_int }
 #[cfg(unix)]
 pub fn pipe() -> Pipe {
     unsafe {
-        let mut fds = Pipe {mut in: 0 as c_int,
-                        mut out: 0 as c_int };
+        let mut fds = Pipe {in: 0 as c_int,
+                        out: 0 as c_int };
         assert (libc::pipe(&mut fds.in) == (0 as c_int));
         return Pipe {in: fds.in, out: fds.out};
     }
@@ -339,8 +338,8 @@ pub fn pipe() -> Pipe {
         // fully understand. Here we explicitly make the pipe non-inheritable,
         // which means to pass it to a subprocess they need to be duplicated
         // first, as in rust_run_program.
-        let mut fds = Pipe { mut in: 0 as c_int,
-                    mut out: 0 as c_int };
+        let mut fds = Pipe {in: 0 as c_int,
+                    out: 0 as c_int };
         let res = libc::pipe(&mut fds.in, 1024 as c_uint,
                              (libc::O_BINARY | libc::O_NOINHERIT) as c_int);
         assert (res == 0 as c_int);
@@ -566,13 +565,17 @@ pub fn path_exists(p: &Path) -> bool {
  *
  * If the given path is relative, return it prepended with the current working
  * directory. If the given path is already an absolute path, return it
- * as is.  This is a shortcut for calling os::getcwd().unsafe_join(p)
+ * as is.
  */
 // NB: this is here rather than in path because it is a form of environment
 // querying; what it does depends on the process working directory, not just
 // the input paths.
 pub fn make_absolute(p: &Path) -> Path {
-    getcwd().unsafe_join(p)
+    if p.is_absolute {
+        copy *p
+    } else {
+        getcwd().push_many(p.components)
+    }
 }
 
 
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs
index 77554656913..58ab2ce78f5 100644
--- a/src/libcore/pipes.rs
+++ b/src/libcore/pipes.rs
@@ -91,9 +91,9 @@ use libc;
 use option;
 use option::{None, Option, Some, unwrap};
 use pipes;
-use private::intrinsics;
+use unstable::intrinsics;
 use ptr;
-use private;
+use unstable;
 use task;
 use vec;
 
diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs
index d0a16f7875b..e4be0cf98dd 100644
--- a/src/libcore/prelude.rs
+++ b/src/libcore/prelude.rs
@@ -24,10 +24,10 @@ pub use result::{Result, Ok, Err};
 /* Reexported types and traits */
 
 pub use clone::Clone;
-pub use cmp::{Eq, Ord};
+pub use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
 pub use container::{Container, Mutable, Map, Set};
 pub use hash::Hash;
-pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
+pub use iter::{BaseIter, ReverseIter, ExtendedIter, EqIter, CopyableIter};
 pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
 pub use num::NumCast;
 pub use path::GenericPath;
@@ -69,7 +69,7 @@ pub use option;
 pub use os;
 pub use path;
 pub use comm;
-pub use private;
+pub use unstable;
 pub use ptr;
 pub use rand;
 pub use result;
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 2266c2511f8..ecbce18e6da 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -14,7 +14,7 @@ use cast;
 use cmp::{Eq, Ord};
 use libc;
 use libc::{c_void, size_t};
-use private::intrinsics::{memmove32,memmove64};
+use unstable::intrinsics::{memmove32,memmove64};
 use ptr;
 use str;
 use sys;
@@ -300,7 +300,7 @@ impl<T:Ord> Ord for &const T {
 pub fn test() {
     unsafe {
         struct Pair {mut fst: int, mut snd: int};
-        let mut p = Pair {mut fst: 10, mut snd: 20};
+        let mut p = Pair {fst: 10, snd: 20};
         let pptr: *mut Pair = &mut p;
         let iptr: *mut int = cast::reinterpret_cast(&pptr);
         assert (*iptr == 10);;
@@ -308,7 +308,7 @@ pub fn test() {
         assert (*iptr == 30);
         assert (p.fst == 30);;
 
-        *pptr = Pair {mut fst: 50, mut snd: 60};
+        *pptr = Pair {fst: 50, snd: 60};
         assert (*iptr == 50);
         assert (p.fst == 50);
         assert (p.snd == 60);
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 7dfc52c458a..f1e23f01e7b 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -20,7 +20,7 @@
 use at_vec;
 use cast;
 use char;
-use cmp::{Eq, Ord};
+use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
 use libc;
 use libc::size_t;
 use io::WriterUtil;
@@ -773,6 +773,35 @@ pub pure fn eq(a: &~str, b: &~str) -> bool {
     eq_slice(*a, *b)
 }
 
+pure fn cmp(a: &str, b: &str) -> Ordering {
+    let low = uint::min(a.len(), b.len());
+
+    for uint::range(0, low) |idx| {
+        match a[idx].cmp(&b[idx]) {
+          Greater => return Greater,
+          Less => return Less,
+          Equal => ()
+        }
+    }
+
+    a.len().cmp(&b.len())
+}
+
+#[cfg(notest)]
+impl TotalOrd for &str {
+    pure fn cmp(&self, other: & &self/str) -> Ordering { cmp(*self, *other) }
+}
+
+#[cfg(notest)]
+impl TotalOrd for ~str {
+    pure fn cmp(&self, other: &~str) -> Ordering { cmp(*self, *other) }
+}
+
+#[cfg(notest)]
+impl TotalOrd for @str {
+    pure fn cmp(&self, other: &@str) -> Ordering { cmp(*self, *other) }
+}
+
 /// Bytewise slice less than
 pure fn lt(a: &str, b: &str) -> bool {
     let (a_len, b_len) = (a.len(), b.len());
@@ -2389,6 +2418,7 @@ mod tests {
     use ptr;
     use str::*;
     use vec;
+    use cmp::{TotalOrd, Less, Equal, Greater};
 
     #[test]
     fn test_eq() {
@@ -3395,4 +3425,12 @@ mod tests {
         assert view("abcdef", 1, 5).to_managed() == @"bcde";
     }
 
+    #[test]
+    fn test_total_ord() {
+        "1234".cmp(& &"123") == Greater;
+        "123".cmp(& &"1234") == Less;
+        "1234".cmp(& &"1234") == Equal;
+        "12345555".cmp(& &"123456") == Less;
+        "22".cmp(& &"1234") == Greater;
+    }
 }
diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs
index df5a5af74ca..fc152765322 100644
--- a/src/libcore/task/local_data_priv.rs
+++ b/src/libcore/task/local_data_priv.rs
@@ -19,11 +19,7 @@ use prelude::*;
 use task::rt;
 use task::local_data::LocalDataKey;
 
-#[cfg(notest)]
-use rt::rust_task;
-#[cfg(test)]
-#[allow(non_camel_case_types)]
-type rust_task = libc::c_void;
+use super::rt::rust_task;
 
 pub trait LocalData { }
 impl<T:Durable> LocalData for @T { }
diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs
index bf7209f9fc3..6cc3657a32b 100644
--- a/src/libcore/task/spawn.rs
+++ b/src/libcore/task/spawn.rs
@@ -79,7 +79,7 @@ use option;
 use comm::{Chan, GenericChan, GenericPort, Port, stream};
 use pipes;
 use prelude::*;
-use private;
+use unstable;
 use ptr;
 use hashmap::linear::LinearSet;
 use task::local_data_priv::{local_get, local_set};
@@ -123,7 +123,7 @@ struct TaskGroupData {
     // tasks in this group.
     mut descendants: TaskSet,
 }
-type TaskGroupArc = private::Exclusive<Option<TaskGroupData>>;
+type TaskGroupArc = unstable::Exclusive<Option<TaskGroupData>>;
 
 type TaskGroupInner = &mut Option<TaskGroupData>;
 
@@ -153,7 +153,7 @@ struct AncestorNode {
     mut ancestors:    AncestorList,
 }
 
-enum AncestorList = Option<private::Exclusive<AncestorNode>>;
+enum AncestorList = Option<unstable::Exclusive<AncestorNode>>;
 
 // Accessors for taskgroup arcs and ancestor arcs that wrap the unsafety.
 #[inline(always)]
@@ -162,7 +162,7 @@ fn access_group<U>(x: &TaskGroupArc, blk: fn(TaskGroupInner) -> U) -> U {
 }
 
 #[inline(always)]
-fn access_ancestors<U>(x: &private::Exclusive<AncestorNode>,
+fn access_ancestors<U>(x: &unstable::Exclusive<AncestorNode>,
                        blk: fn(x: &mut AncestorNode) -> U) -> U {
     unsafe { x.with(blk) }
 }
@@ -458,7 +458,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
                 // Main task, doing first spawn ever. Lazily initialise here.
                 let mut members = new_taskset();
                 taskset_insert(&mut members, spawner);
-                let tasks = private::exclusive(Some(TaskGroupData {
+                let tasks = unstable::exclusive(Some(TaskGroupData {
                     members: members,
                     descendants: new_taskset(),
                 }));
@@ -482,7 +482,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
             (g, a, spawner_group.is_main)
         } else {
             // Child is in a separate group from spawner.
-            let g = private::exclusive(Some(TaskGroupData {
+            let g = unstable::exclusive(Some(TaskGroupData {
                 members:     new_taskset(),
                 descendants: new_taskset(),
             }));
@@ -502,7 +502,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
                     };
                 assert new_generation < uint::max_value;
                 // Build a new node in the ancestor list.
-                AncestorList(Some(private::exclusive(AncestorNode {
+                AncestorList(Some(unstable::exclusive(AncestorNode {
                     generation: new_generation,
                     parent_group: Some(spawner_group.tasks.clone()),
                     ancestors: old_ancestors,
diff --git a/src/libcore/private.rs b/src/libcore/unstable.rs
index d19951e76db..8c0c029a90f 100644
--- a/src/libcore/private.rs
+++ b/src/libcore/unstable.rs
@@ -22,20 +22,23 @@ use task;
 use task::{TaskBuilder, atomically};
 use uint;
 
-#[path = "private/at_exit.rs"]
+#[path = "unstable/at_exit.rs"]
 pub mod at_exit;
-#[path = "private/global.rs"]
+#[path = "unstable/global.rs"]
 pub mod global;
-#[path = "private/finally.rs"]
+#[path = "unstable/finally.rs"]
 pub mod finally;
-#[path = "private/weak_task.rs"]
+#[path = "unstable/weak_task.rs"]
 pub mod weak_task;
-#[path = "private/exchange_alloc.rs"]
+#[path = "unstable/exchange_alloc.rs"]
 pub mod exchange_alloc;
-#[path = "private/intrinsics.rs"]
+#[path = "unstable/intrinsics.rs"]
 pub mod intrinsics;
-#[path = "private/extfmt.rs"]
+#[path = "unstable/extfmt.rs"]
 pub mod extfmt;
+#[path = "unstable/lang.rs"]
+#[cfg(notest)]
+pub mod lang;
 
 extern mod rustrt {
     pub unsafe fn rust_create_little_lock() -> rust_little_lock;
@@ -312,7 +315,7 @@ pub mod tests {
     use cell::Cell;
     use comm;
     use option;
-    use private::exclusive;
+    use super::exclusive;
     use result;
     use task;
     use uint;
diff --git a/src/libcore/private/at_exit.rs b/src/libcore/unstable/at_exit.rs
index 4785cb622cb..4785cb622cb 100644
--- a/src/libcore/private/at_exit.rs
+++ b/src/libcore/unstable/at_exit.rs
diff --git a/src/libcore/private/exchange_alloc.rs b/src/libcore/unstable/exchange_alloc.rs
index b6af9891e11..f59037445eb 100644
--- a/src/libcore/private/exchange_alloc.rs
+++ b/src/libcore/unstable/exchange_alloc.rs
@@ -14,7 +14,7 @@ use c_malloc = libc::malloc;
 use c_free = libc::free;
 use managed::raw::{BoxHeaderRepr, BoxRepr};
 use cast::transmute;
-use private::intrinsics::{atomic_xadd,atomic_xsub};
+use unstable::intrinsics::{atomic_xadd,atomic_xsub};
 use ptr::null;
 use intrinsic::TyDesc;
 
diff --git a/src/libcore/private/extfmt.rs b/src/libcore/unstable/extfmt.rs
index 616d37a133a..616d37a133a 100644
--- a/src/libcore/private/extfmt.rs
+++ b/src/libcore/unstable/extfmt.rs
diff --git a/src/libcore/private/finally.rs b/src/libcore/unstable/finally.rs
index ff75963511c..ff75963511c 100644
--- a/src/libcore/private/finally.rs
+++ b/src/libcore/unstable/finally.rs
diff --git a/src/libcore/private/global.rs b/src/libcore/unstable/global.rs
index 77b61347250..aa28310f7ba 100644
--- a/src/libcore/private/global.rs
+++ b/src/libcore/unstable/global.rs
@@ -32,11 +32,11 @@ use libc::{c_void, uintptr_t};
 use option::{Option, Some, None};
 use ops::Drop;
 use pipes;
-use private::{Exclusive, exclusive};
-use private::{SharedMutableState, shared_mutable_state};
-use private::{get_shared_immutable_state};
-use private::at_exit::at_exit;
-use private::intrinsics::atomic_cxchg;
+use unstable::{Exclusive, exclusive};
+use unstable::{SharedMutableState, shared_mutable_state};
+use unstable::{get_shared_immutable_state};
+use unstable::at_exit::at_exit;
+use unstable::intrinsics::atomic_cxchg;
 use hashmap::linear::LinearMap;
 use sys::Closure;
 use task::spawn;
diff --git a/src/libcore/private/intrinsics.rs b/src/libcore/unstable/intrinsics.rs
index 8f0067b7393..8f0067b7393 100644
--- a/src/libcore/private/intrinsics.rs
+++ b/src/libcore/unstable/intrinsics.rs
diff --git a/src/libcore/rt.rs b/src/libcore/unstable/lang.rs
index 5d0bad3ceb3..e74052995e6 100644
--- a/src/libcore/rt.rs
+++ b/src/libcore/unstable/lang.rs
@@ -15,14 +15,11 @@ use libc::{c_char, c_uchar, c_void, size_t, uintptr_t, c_int};
 use managed::raw::BoxRepr;
 use str;
 use sys;
-use private::exchange_alloc;
+use unstable::exchange_alloc;
 use cast::transmute;
 
 use gc::{cleanup_stack_for_failure, gc, Word};
 
-#[allow(non_camel_case_types)]
-pub type rust_task = c_void;
-
 #[cfg(target_word_size = "32")]
 pub const FROZEN_BIT: uint = 0x80000000;
 #[cfg(target_word_size = "64")]
diff --git a/src/libcore/private/weak_task.rs b/src/libcore/unstable/weak_task.rs
index 8445638850c..0e1181f43db 100644
--- a/src/libcore/private/weak_task.rs
+++ b/src/libcore/unstable/weak_task.rs
@@ -24,9 +24,9 @@ use comm::{Port, Chan, SharedChan, GenericChan, GenericPort};
 use hashmap::linear::LinearMap;
 use ops::Drop;
 use option::{Some, None, swap_unwrap};
-use private::at_exit::at_exit;
-use private::finally::Finally;
-use private::global::global_data_clone_create;
+use unstable::at_exit::at_exit;
+use unstable::finally::Finally;
+use unstable::global::global_data_clone_create;
 use task::rt::{task_id, get_task_id};
 use task::{Task, task, spawn};
 
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 4d28c769b18..925d78a3b81 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -15,14 +15,14 @@
 use container::{Container, Mutable};
 use cast::transmute;
 use cast;
-use cmp::{Eq, Ord};
+use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
 use iter::BaseIter;
 use iter;
 use kinds::Copy;
 use libc;
 use libc::size_t;
 use option::{None, Option, Some};
-use private::intrinsics;
+use unstable::intrinsics;
 use ptr;
 use ptr::addr_of;
 use sys;
@@ -1425,7 +1425,7 @@ pub pure fn rev_eachi<T>(v: &r/[T], blk: fn(i: uint, v: &r/T) -> bool) {
  * Both vectors must have the same length
  */
 #[inline]
-pub fn each2<U, T>(v1: &[U], v2: &[T], f: fn(u: &U, t: &T) -> bool) {
+pub pure fn each2<U, T>(v1: &[U], v2: &[T], f: fn(u: &U, t: &T) -> bool) {
     assert len(v1) == len(v2);
     for uint::range(0u, len(v1)) |i| {
         if !f(&v1[i], &v2[i]) {
@@ -1575,6 +1575,38 @@ impl<T:Eq> Eq for @[T] {
 
 // Lexicographical comparison
 
+pure fn cmp<T: TotalOrd>(a: &[T], b: &[T]) -> Ordering {
+    let low = uint::min(a.len(), b.len());
+
+    for uint::range(0, low) |idx| {
+        match a[idx].cmp(&b[idx]) {
+          Greater => return Greater,
+          Less => return Less,
+          Equal => ()
+        }
+    }
+
+    a.len().cmp(&b.len())
+}
+
+#[cfg(notest)]
+impl<T: TotalOrd> TotalOrd for &[T] {
+    #[inline(always)]
+    pure fn cmp(&self, other: & &self/[T]) -> Ordering { cmp(*self, *other) }
+}
+
+#[cfg(notest)]
+impl<T: TotalOrd> TotalOrd for ~[T] {
+    #[inline(always)]
+    pure fn cmp(&self, other: &~[T]) -> Ordering { cmp(*self, *other) }
+}
+
+#[cfg(notest)]
+impl<T: TotalOrd> TotalOrd for @[T] {
+    #[inline(always)]
+    pure fn cmp(&self, other: &@[T]) -> Ordering { cmp(*self, *other) }
+}
+
 pure fn lt<T:Ord>(a: &[T], b: &[T]) -> bool {
     let (a_len, b_len) = (a.len(), b.len());
     let mut end = uint::min(a_len, b_len);
@@ -2008,7 +2040,7 @@ pub mod raw {
     use managed;
     use option::{None, Some};
     use option;
-    use private::intrinsics;
+    use unstable::intrinsics;
     use ptr::addr_of;
     use ptr;
     use sys;
@@ -2151,7 +2183,7 @@ pub mod bytes {
     use vec;
 
     /// Bytewise string comparison
-    pub pure fn cmp(a: &~[u8], b: &~[u8]) -> int {
+    pub pure fn memcmp(a: &~[u8], b: &~[u8]) -> int {
         let a_len = len(*a);
         let b_len = len(*b);
         let n = uint::min(a_len, b_len) as libc::size_t;
@@ -2172,22 +2204,22 @@ pub mod bytes {
     }
 
     /// Bytewise less than or equal
-    pub pure fn lt(a: &~[u8], b: &~[u8]) -> bool { cmp(a, b) < 0 }
+    pub pure fn lt(a: &~[u8], b: &~[u8]) -> bool { memcmp(a, b) < 0 }
 
     /// Bytewise less than or equal
-    pub pure fn le(a: &~[u8], b: &~[u8]) -> bool { cmp(a, b) <= 0 }
+    pub pure fn le(a: &~[u8], b: &~[u8]) -> bool { memcmp(a, b) <= 0 }
 
     /// Bytewise equality
-    pub pure fn eq(a: &~[u8], b: &~[u8]) -> bool { cmp(a, b) == 0 }
+    pub pure fn eq(a: &~[u8], b: &~[u8]) -> bool { memcmp(a, b) == 0 }
 
     /// Bytewise inequality
-    pub pure fn ne(a: &~[u8], b: &~[u8]) -> bool { cmp(a, b) != 0 }
+    pub pure fn ne(a: &~[u8], b: &~[u8]) -> bool { memcmp(a, b) != 0 }
 
     /// Bytewise greater than or equal
-    pub pure fn ge(a: &~[u8], b: &~[u8]) -> bool { cmp(a, b) >= 0 }
+    pub pure fn ge(a: &~[u8], b: &~[u8]) -> bool { memcmp(a, b) >= 0 }
 
     /// Bytewise greater than
-    pub pure fn gt(a: &~[u8], b: &~[u8]) -> bool { cmp(a, b) > 0 }
+    pub pure fn gt(a: &~[u8], b: &~[u8]) -> bool { memcmp(a, b) > 0 }
 
     /**
       * Copies data from one vector to another.
@@ -2429,6 +2461,7 @@ mod tests {
     use option;
     use sys;
     use vec::*;
+    use cmp::*;
 
     fn square(n: uint) -> uint { return n * n; }
 
@@ -2622,8 +2655,8 @@ mod tests {
     #[test]
     fn test_swap_remove_noncopyable() {
         // Tests that we don't accidentally run destructors twice.
-        let mut v = ~[::private::exclusive(()), ::private::exclusive(()),
-                      ::private::exclusive(())];
+        let mut v = ~[::unstable::exclusive(()), ::unstable::exclusive(()),
+                      ::unstable::exclusive(())];
         let mut _e = v.swap_remove(0);
         assert (len(v) == 2);
         _e = v.swap_remove(1);
@@ -3942,6 +3975,14 @@ mod tests {
         }
     }
 
+    #[test]
+    fn test_total_ord() {
+        [1, 2, 3, 4].cmp(& &[1, 2, 3]) == Greater;
+        [1, 2, 3].cmp(& &[1, 2, 3, 4]) == Less;
+        [1, 2, 3, 4].cmp(& &[1, 2, 3, 4]) == Equal;
+        [1, 2, 3, 4, 5, 5, 5, 5].cmp(& &[1, 2, 3, 4, 5, 6]) == Less;
+        [2, 2].cmp(& &[1, 2, 3, 4]) == Greater;
+    }
 }
 
 // Local Variables: