about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-27 23:02:55 +0000
committerbors <bors@rust-lang.org>2014-10-27 23:02:55 +0000
commitbd7138dd698dde29fb4d7fd34529a863b85d947e (patch)
treeb0d85f6266675501dce79b4802325e0d60b147e3 /src/liballoc
parente05c3b7799b45b78baf49f05763865be838f5b43 (diff)
parent4dc06dceb2bbb7ced9ea137b5280f7ce413b4d01 (diff)
downloadrust-bd7138dd698dde29fb4d7fd34529a863b85d947e.tar.gz
rust-bd7138dd698dde29fb4d7fd34529a863b85d947e.zip
auto merge of #18368 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/arc.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index c447cb46c53..0e62fbb0144 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -15,6 +15,7 @@
 
 use core::atomic;
 use core::clone::Clone;
+use core::fmt::{mod, Show};
 use core::kinds::{Sync, Send};
 use core::mem::{min_align_of, size_of, drop};
 use core::mem;
@@ -147,6 +148,12 @@ impl<T: Send + Sync> Deref<T> for Arc<T> {
     }
 }
 
+impl<T: Send + Sync + Show> Show for Arc<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        (**self).fmt(f)
+    }
+}
+
 impl<T: Send + Sync + Clone> Arc<T> {
     /// Acquires a mutable pointer to the inner contents by guaranteeing that
     /// the reference count is one (no sharing is possible).
@@ -280,6 +287,7 @@ mod tests {
     use std::mem::drop;
     use std::ops::Drop;
     use std::option::{Option, Some, None};
+    use std::str::Str;
     use std::sync::atomic;
     use std::task;
     use std::vec::Vec;
@@ -426,4 +434,10 @@ mod tests {
         assert!(canary.load(atomic::Acquire) == 1);
         drop(arc_weak);
     }
+
+    #[test]
+    fn show_arc() {
+        let a = Arc::new(5u32);
+        assert!(format!("{}", a).as_slice() == "5")
+    }
 }