Skip to content

Commit a6401b5

Browse files
committed
auto merge of #14616 : forticulous/rust/rc-show, r=alexcrichton
Show impl for Rc
2 parents d130acc + c6f10f8 commit a6401b5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/liballoc/rc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use core::option::{Option, Some, None};
3333
use core::ptr;
3434
use core::ptr::RawPtr;
3535
use core::mem::{min_align_of, size_of};
36+
use core::fmt;
3637

3738
use heap::deallocate;
3839

@@ -178,6 +179,12 @@ impl<T: Ord> Ord for Rc<T> {
178179
fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) }
179180
}
180181

182+
impl<T: fmt::Show> fmt::Show for Rc<T> {
183+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
184+
(**self).fmt(f)
185+
}
186+
}
187+
181188
/// Weak reference to a reference-counted box
182189
#[unsafe_no_drop_flag]
183190
pub struct Weak<T> {

0 commit comments

Comments
 (0)