diff options
| author | bors <bors@rust-lang.org> | 2015-01-07 05:31:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-01-07 05:31:23 +0000 |
| commit | 9e4e524e0eb17c8f463e731f23b544003e8709c6 (patch) | |
| tree | 916024d35e08f0826c20654f629ec596b5cb1f14 /src/liballoc | |
| parent | ea6f65c5f1a3f84e010d2cef02a0160804e9567a (diff) | |
| parent | a64000820f0fc32be4d7535a9a92418a434fa4ba (diff) | |
| download | rust-9e4e524e0eb17c8f463e731f23b544003e8709c6.tar.gz rust-9e4e524e0eb17c8f463e731f23b544003e8709c6.zip | |
auto merge of #20677 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 14 | ||||
| -rw-r--r-- | src/liballoc/boxed.rs | 10 | ||||
| -rw-r--r-- | src/liballoc/lib.rs | 26 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 10 |
4 files changed, 26 insertions, 34 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 25f80ad11bd..8def8ad7215 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -41,8 +41,8 @@ //! let five = five.clone(); //! //! Thread::spawn(move || { -//! println!("{}", five); -//! }).detach(); +//! println!("{:?}", five); +//! }); //! } //! ``` //! @@ -63,7 +63,7 @@ //! *number += 1; //! //! println!("{}", *number); // prints 6 -//! }).detach(); +//! }); //! } //! ``` @@ -74,7 +74,7 @@ use core::clone::Clone; use core::fmt::{self, Show}; use core::cmp::{Eq, Ord, PartialEq, PartialOrd, Ordering}; use core::default::Default; -use core::kinds::{Sync, Send}; +use core::marker::{Sync, Send}; use core::mem::{min_align_of, size_of, drop}; use core::mem; use core::nonzero::NonZero; @@ -106,7 +106,7 @@ use heap::deallocate; /// let local_numbers = child_numbers.as_slice(); /// /// // Work with the local numbers -/// }).detach(); +/// }); /// } /// } /// ``` @@ -581,7 +581,7 @@ impl<T: Eq> Eq for Arc<T> {} impl<T: fmt::Show> fmt::Show for Arc<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - (**self).fmt(f) + write!(f, "Arc({:?})", (**self)) } } @@ -794,7 +794,7 @@ mod tests { #[test] fn show_arc() { let a = Arc::new(5u32); - assert!(format!("{}", a) == "5") + assert!(format!("{:?}", a) == "Arc(5u32)") } // Make sure deriving works with Arc<T> diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 6df8bb5f7aa..d46f18abf97 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -18,7 +18,7 @@ use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; use core::default::Default; use core::fmt; use core::hash::{self, Hash}; -use core::kinds::Sized; +use core::marker::Sized; use core::mem; use core::option::Option; use core::ptr::Unique; @@ -145,7 +145,13 @@ impl BoxAny for Box<Any> { impl<T: ?Sized + fmt::Show> fmt::Show for Box<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - (**self).fmt(f) + write!(f, "Box({:?})", &**self) + } +} + +impl<T: ?Sized + fmt::String> fmt::String for Box<T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(&**self, f) } } diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 001e02f9c0d..ba6e89cdd76 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -65,36 +65,16 @@ #![no_std] #![allow(unknown_features)] -#![feature(lang_items, phase, unsafe_destructor, default_type_params, old_orphan_check)] -#![feature(associated_types)] +#![feature(lang_items, unsafe_destructor)] -#[cfg(stage0)] -#[phase(plugin, link)] -extern crate core; - -#[cfg(not(stage0))] #[macro_use] extern crate core; - extern crate libc; // Allow testing this library -#[cfg(all(test, stage0))] -#[phase(plugin, link)] -extern crate std; - -#[cfg(all(test, not(stage0)))] -#[macro_use] -extern crate std; - -#[cfg(all(test, stage0))] -#[phase(plugin, link)] -extern crate log; - -#[cfg(all(test, not(stage0)))] -#[macro_use] -extern crate log; +#[cfg(test)] #[macro_use] extern crate std; +#[cfg(test)] #[macro_use] extern crate log; // Heaps provided for low-level allocation strategies diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 175bba4e71d..67b25427710 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -148,7 +148,7 @@ use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; use core::default::Default; use core::fmt; use core::hash::{self, Hash}; -use core::kinds::marker; +use core::marker; use core::mem::{transmute, min_align_of, size_of, forget}; use core::nonzero::NonZero; use core::ops::{Deref, Drop}; @@ -607,7 +607,7 @@ impl<S: hash::Writer, T: Hash<S>> Hash<S> for Rc<T> { #[experimental = "Show is experimental."] impl<T: fmt::Show> fmt::Show for Rc<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - (**self).fmt(f) + write!(f, "Rc({:?})", **self) } } @@ -962,4 +962,10 @@ mod tests { assert!(cow1_weak.upgrade().is_none()); } + #[test] + fn test_show() { + let foo = Rc::new(75u); + assert!(format!("{:?}", foo) == "Rc(75u)") + } + } |
