Skip to content

Commit

Permalink
alloc: impl Default for Rc
Browse files Browse the repository at this point in the history
  • Loading branch information
erickt committed Jun 29, 2014
1 parent 2317840 commit 1ea9991
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/liballoc/rc.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit 1ea9991

Please sign in to comment.