diff options
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/owned.rs | 5 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/liballoc/owned.rs b/src/liballoc/owned.rs index 33afa806f4e..addec396bbe 100644 --- a/src/liballoc/owned.rs +++ b/src/liballoc/owned.rs @@ -18,6 +18,7 @@ use core::fmt; use core::intrinsics; use core::kinds::Send; use core::mem; +use core::option::Option; use core::raw::TraitObject; use core::result::{Ok, Err, Result}; @@ -65,6 +66,10 @@ impl<T:PartialEq> PartialEq for Box<T> { } impl<T:PartialOrd> PartialOrd for Box<T> { #[inline] + fn partial_cmp(&self, other: &Box<T>) -> Option<Ordering> { + (**self).partial_cmp(*other) + } + #[inline] fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) } #[inline] fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index e3127030842..83cc4a0b662 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -171,6 +171,11 @@ impl<T: Eq> Eq for Rc<T> {} impl<T: PartialOrd> PartialOrd for Rc<T> { #[inline(always)] + fn partial_cmp(&self, other: &Rc<T>) -> Option<Ordering> { + (**self).partial_cmp(&**other) + } + + #[inline(always)] fn lt(&self, other: &Rc<T>) -> bool { **self < **other } #[inline(always)] |
