diff options
Diffstat (limited to 'src/liballoc/rc.rs')
| -rw-r--r-- | src/liballoc/rc.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index a3ca72f1547..e3127030842 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -27,6 +27,7 @@ use core::mem::transmute; use core::cell::Cell; use core::clone::Clone; use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; +use core::default::Default; use core::kinds::marker; use core::ops::{Deref, Drop}; use core::option::{Option, Some, None}; @@ -152,6 +153,13 @@ impl<T> Clone for Rc<T> { } } +impl<T: Default> Default for Rc<T> { + #[inline] + fn default() -> Rc<T> { + Rc::new(Default::default()) + } +} + impl<T: PartialEq> PartialEq for Rc<T> { #[inline(always)] fn eq(&self, other: &Rc<T>) -> bool { **self == **other } |
