about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-07 08:20:22 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-07 11:03:12 -0700
commit07caa224501817c93be3f5c57a013ed5db6c04e1 (patch)
tree4a7df32c0c34f78282e842b308c2751f3d3cd5ee
parenta289ebefb8c3584d91484f0bb62f696dffadda02 (diff)
downloadrust-07caa224501817c93be3f5c57a013ed5db6c04e1.tar.gz
rust-07caa224501817c93be3f5c57a013ed5db6c04e1.zip
Test fixes and rebase conflicts
-rw-r--r--src/doc/rust.md2
-rw-r--r--src/libcore/any.rs12
-rw-r--r--src/libcore/clone.rs5
-rw-r--r--src/libcore/cmp.rs25
-rw-r--r--src/libcore/lib.rs4
-rw-r--r--src/libcore/owned.rs (renamed from src/libstd/owned.rs)5
-rw-r--r--src/libstd/comm/mod.rs2
-rw-r--r--src/libstd/lib.rs7
-rw-r--r--src/libstd/option.rs10
-rw-r--r--src/libstd/os.rs8
-rw-r--r--src/libstd/repr.rs1
-rw-r--r--src/libstd/slice.rs1
-rw-r--r--src/libstd/sync/mpmc_bounded_queue.rs1
13 files changed, 39 insertions, 44 deletions
diff --git a/src/doc/rust.md b/src/doc/rust.md
index b6237e2a20f..44e7a304e67 100644
--- a/src/doc/rust.md
+++ b/src/doc/rust.md
@@ -3274,7 +3274,7 @@ The machine types are the following:
 
 * The signed two's complement word types `i8`, `i16`, `i32` and `i64`, with
   values drawn from the integer intervals [-(2^(7)), 2^7 - 1],
-  [-(2^(15)), 2^15 - 1], $[-(2^(31)), 2^31 - 1], [-(2^(63)), 2^63 - 1]
+  [-(2^(15)), 2^15 - 1], [-(2^(31)), 2^31 - 1], [-(2^(63)), 2^63 - 1]
   respectively.
 
 * The IEEE 754-2008 `binary32` and `binary64` floating-point types: `f32` and
diff --git a/src/libcore/any.rs b/src/libcore/any.rs
index 0c07bf91bd2..459015445eb 100644
--- a/src/libcore/any.rs
+++ b/src/libcore/any.rs
@@ -149,7 +149,6 @@ mod tests {
     use prelude::*;
     use super::*;
     use owned::Box;
-    use str::StrSlice;
     use realstd::str::StrAllocating;
 
     #[deriving(Eq, Show)]
@@ -275,17 +274,10 @@ mod tests {
 
     #[test]
     fn test_show() {
-<<<<<<< HEAD
-        let a = box 8u as Box<Any>;
-        let b = box Test as Box<Any>;
+        let a = box 8u as Box<::realcore::any::Any>;
+        let b = box Test as Box<::realcore::any::Any>;
         assert_eq!(format!("{}", a), "Box<Any>".to_owned());
         assert_eq!(format!("{}", b), "Box<Any>".to_owned());
-=======
-        let a = ~8u as ~::realcore::any::Any;
-        let b = ~Test as ~::realcore::any::Any;
-        assert_eq!(format!("{}", a), "~Any".to_owned());
-        assert_eq!(format!("{}", b), "~Any".to_owned());
->>>>>>> core: Get coretest working
 
         let a = &8u as &::realcore::any::Any;
         let b = &Test as &::realcore::any::Any;
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs
index 659d797bc67..06cbaf19812 100644
--- a/src/libcore/clone.rs
+++ b/src/libcore/clone.rs
@@ -129,6 +129,7 @@ extern_fn_clone!(A, B, C, D, E, F, G, H)
 #[cfg(test)]
 mod test {
     use prelude::*;
+    use owned::Box;
 
     #[test]
     fn test_owned_clone() {
@@ -154,8 +155,8 @@ mod test {
 
     #[test]
     fn test_clone_from() {
-        let a = ~5;
-        let mut b = ~10;
+        let a = box 5;
+        let mut b = box 10;
         b.clone_from(&a);
         assert_eq!(*b, 5);
     }
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 0ad2a465522..af611cd94e5 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -193,6 +193,7 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
 #[cfg(not(test))]
 mod impls {
     use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
+    use owned::Box;
 
     // & pointers
     impl<'a, T: Eq> Eq for &'a T {
@@ -240,28 +241,28 @@ mod impls {
     }
     impl<T: TotalEq> TotalEq for @T {}
 
-    // ~ pointers
-    impl<T:Eq> Eq for ~T {
+    // box pointers
+    impl<T:Eq> Eq for Box<T> {
         #[inline]
-        fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
+        fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
         #[inline]
-        fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
+        fn ne(&self, other: &Box<T>) -> bool { *(*self) != *(*other) }
     }
-    impl<T:Ord> Ord for ~T {
+    impl<T:Ord> Ord for Box<T> {
         #[inline]
-        fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
+        fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
         #[inline]
-        fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
+        fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) }
         #[inline]
-        fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
+        fn ge(&self, other: &Box<T>) -> bool { *(*self) >= *(*other) }
         #[inline]
-        fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
+        fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) }
     }
-    impl<T: TotalOrd> TotalOrd for ~T {
+    impl<T: TotalOrd> TotalOrd for Box<T> {
         #[inline]
-        fn cmp(&self, other: &~T) -> Ordering { (**self).cmp(*other) }
+        fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) }
     }
-    impl<T: TotalEq> TotalEq for ~T {}
+    impl<T: TotalEq> TotalEq for Box<T> {}
 }
 
 #[cfg(test)]
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 5aef169cd57..53de765b89c 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -27,9 +27,10 @@
 #[phase(syntax, link)] #[cfg(test)] extern crate realstd = "std";
 #[phase(syntax, link)] #[cfg(test)] extern crate log;
 
-#[cfg(test)] pub use kinds = realcore::kinds;
 #[cfg(test)] pub use cmp = realcore::cmp;
+#[cfg(test)] pub use kinds = realcore::kinds;
 #[cfg(test)] pub use ops = realcore::ops;
+#[cfg(test)] pub use owned = realcore::owned;
 #[cfg(test)] pub use ty = realcore::ty;
 
 #[cfg(not(test))]
@@ -73,6 +74,7 @@ pub mod ptr;
 #[cfg(not(test))] pub mod ops;
 #[cfg(not(test))] pub mod ty;
 #[cfg(not(test))] pub mod cmp;
+#[cfg(not(test))] pub mod owned;
 pub mod clone;
 pub mod default;
 pub mod container;
diff --git a/src/libstd/owned.rs b/src/libcore/owned.rs
index 4f282c5c9e9..d5cdd9c39b6 100644
--- a/src/libstd/owned.rs
+++ b/src/libcore/owned.rs
@@ -10,6 +10,11 @@
 
 //! Operations on unique pointer types
 
+// FIXME: this module should not exist in libcore. It must currently because the
+//        Box implementation is quite ad-hoc in the compiler. Once there is
+//        proper support in the compiler this type will be able to be defined in
+//        its own module.
+
 /// A value that represents the global exchange heap. This is the default
 /// place that the `box` keyword allocates into when no place is supplied.
 ///
diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs
index bd1def518f0..df0c6f3b8d3 100644
--- a/src/libstd/comm/mod.rs
+++ b/src/libstd/comm/mod.rs
@@ -981,7 +981,6 @@ mod test {
 
     use native;
     use os;
-    use owned::Box;
     use super::*;
 
     pub fn stress_factor() -> uint {
@@ -1516,7 +1515,6 @@ mod test {
 mod sync_tests {
     use prelude::*;
     use os;
-    use owned::Box;
 
     pub fn stress_factor() -> uint {
         match os::getenv("RUST_TEST_STRESS") {
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index abcc1f099b4..72d41ae1dd2 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -133,9 +133,10 @@ extern crate core;
 #[cfg(test)] pub use ty = realstd::ty;
 #[cfg(test)] pub use owned = realstd::owned;
 
+#[cfg(not(test))] pub use cmp = core::cmp;
 #[cfg(not(test))] pub use kinds = core::kinds;
 #[cfg(not(test))] pub use ops = core::ops;
-#[cfg(not(test))] pub use cmp = core::cmp;
+#[cfg(not(test))] pub use owned = core::owned;
 #[cfg(not(test))] pub use ty = core::ty;
 
 pub use core::any;
@@ -206,10 +207,6 @@ pub mod ascii;
 pub mod rc;
 pub mod gc;
 
-/* Core language traits */
-
-#[cfg(not(test))] pub mod owned;
-
 /* Common traits */
 
 pub mod from_str;
diff --git a/src/libstd/option.rs b/src/libstd/option.rs
index 17249f567e5..8fbcd529b63 100644
--- a/src/libstd/option.rs
+++ b/src/libstd/option.rs
@@ -54,7 +54,7 @@
 //!
 //! Rust's pointer types must always point to a valid location; there are
 //! no "null" pointers. Instead, Rust has *optional* pointers, like
-//! the optional owned box, `Option<~T>`.
+//! the optional owned box, `Option<Box<T>>`.
 //!
 //! The following example uses `Option` to create an optional box of
 //! `int`. Notice that in order to use the inner `int` value first the
@@ -63,13 +63,13 @@
 //! not (`None`).
 //!
 //! ```
-//! let optional: Option<~int> = None;
+//! let optional: Option<Box<int>> = None;
 //! check_optional(&optional);
 //!
-//! let optional: Option<~int> = Some(~9000);
+//! let optional: Option<Box<int>> = Some(box 9000);
 //! check_optional(&optional);
 //!
-//! fn check_optional(optional: &Option<~int>) {
+//! fn check_optional(optional: &Option<Box<int>>) {
 //!     match *optional {
 //!         Some(ref p) => println!("have value {}", p),
 //!         None => println!("have no value")
@@ -79,7 +79,7 @@
 //!
 //! This usage of `Option` to create safe nullable pointers is so
 //! common that Rust does special optimizations to make the
-//! representation of `Option<~T>` a single pointer. Optional pointers
+//! representation of `Option<Box<T>>` a single pointer. Optional pointers
 //! in Rust are stored as efficiently as any other pointer type.
 //!
 //! # Examples
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 47d316f75ab..809757aaf4d 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -81,6 +81,8 @@ pub fn getcwd() -> Path {
 pub fn getcwd() -> Path {
     use libc::DWORD;
     use libc::GetCurrentDirectoryW;
+    use option::Expect;
+
     let mut buf = [0 as u16, ..BUF_BYTES];
     unsafe {
         if libc::GetCurrentDirectoryW(buf.len() as DWORD, buf.as_mut_ptr()) == 0 as DWORD {
@@ -96,11 +98,11 @@ pub mod win32 {
     use iter::Iterator;
     use libc::types::os::arch::extra::DWORD;
     use libc;
-    use option::{None, Option};
+    use option::{None, Option, Expect};
     use option;
     use os::TMPBUF_SZ;
     use slice::{MutableVector, ImmutableVector, OwnedVector};
-    use str::StrSlice;
+    use str::{StrSlice, StrAllocating};
     use str;
     use vec::Vec;
 
@@ -182,7 +184,6 @@ pub fn env_as_bytes() -> ~[(~[u8],~[u8])] {
         #[cfg(windows)]
         unsafe fn get_env_pairs() -> Vec<~[u8]> {
             use c_str;
-            use str::StrSlice;
 
             use libc::funcs::extra::kernel32::{
                 GetEnvironmentStringsA,
@@ -830,6 +831,7 @@ fn real_args() -> ~[~str] {
 #[cfg(windows)]
 fn real_args() -> ~[~str] {
     use slice;
+    use option::Expect;
 
     let mut nArgs: c_int = 0;
     let lpArgCount: *mut c_int = &mut nArgs;
diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs
index 2fe4c7eafde..35c5cbc85c3 100644
--- a/src/libstd/repr.rs
+++ b/src/libstd/repr.rs
@@ -625,7 +625,6 @@ fn test_repr() {
     use io::stdio::println;
     use char::is_alphabetic;
     use mem::swap;
-    use owned::Box;
 
     fn exact_test<T>(t: &T, e:&str) {
         let mut m = io::MemWriter::new();
diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs
index 3f5ac535113..c7cefbb28ee 100644
--- a/src/libstd/slice.rs
+++ b/src/libstd/slice.rs
@@ -1577,7 +1577,6 @@ mod tests {
     #[test]
     #[should_fail]
     fn test_from_elem_fail() {
-        use cast;
         use cell::Cell;
         use rc::Rc;
 
diff --git a/src/libstd/sync/mpmc_bounded_queue.rs b/src/libstd/sync/mpmc_bounded_queue.rs
index b392cc8ff9a..2df5031b482 100644
--- a/src/libstd/sync/mpmc_bounded_queue.rs
+++ b/src/libstd/sync/mpmc_bounded_queue.rs
@@ -162,7 +162,6 @@ impl<T: Send> Clone for Queue<T> {
 #[cfg(test)]
 mod tests {
     use prelude::*;
-    use option::*;
     use super::Queue;
     use native;