From 1ea9991921d2969517e445230997b8771d84bdb4 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Mon, 23 Jun 2014 19:09:19 -0400 Subject: alloc: impl Default for Rc --- src/liballoc/rc.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/liballoc') 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 Clone for Rc { } } +impl Default for Rc { + #[inline] + fn default() -> Rc { + Rc::new(Default::default()) + } +} + impl PartialEq for Rc { #[inline(always)] fn eq(&self, other: &Rc) -> bool { **self == **other } -- cgit 1.4.1-3-g733a5