diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fmt/parse.rs | 4 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 4 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 4 | ||||
| -rw-r--r-- | src/libstd/ptr.rs | 8 | ||||
| -rw-r--r-- | src/libstd/rc.rs | 9 |
5 files changed, 23 insertions, 6 deletions
diff --git a/src/libstd/fmt/parse.rs b/src/libstd/fmt/parse.rs index 948f85ca1c2..67088e6f4f8 100644 --- a/src/libstd/fmt/parse.rs +++ b/src/libstd/fmt/parse.rs @@ -121,7 +121,7 @@ pub enum Method<'a> { } /// A selector for what pluralization a plural method should take -#[deriving(Eq, Hash)] +#[deriving(Eq, TotalEq, Hash)] pub enum PluralSelector { /// One of the plural keywords should be used Keyword(PluralKeyword), @@ -143,7 +143,7 @@ pub struct PluralArm<'a> { /// specially placed in the `Plural` variant of `Method` /// /// http://www.icu-project.org/apiref/icu4c/classicu_1_1PluralRules.html -#[deriving(Eq, Hash)] +#[deriving(Eq, TotalEq, Hash)] #[allow(missing_doc)] pub enum PluralKeyword { Zero, One, Two, Few, Many diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index f654f59266a..512b20ebf4c 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -13,7 +13,7 @@ use container::Container; use c_str::{CString, ToCStr}; use clone::Clone; -use cmp::Eq; +use cmp::{Eq, TotalEq}; use from_str::FromStr; use io::Writer; use iter::{AdditiveIterator, Extendable, Iterator, Map}; @@ -69,6 +69,8 @@ impl Eq for Path { } } +impl TotalEq for Path {} + impl FromStr for Path { fn from_str(s: &str) -> Option<Path> { Path::new_opt(s) diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index dba8af4128b..81da2f50f8d 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -15,7 +15,7 @@ use c_str::{CString, ToCStr}; use cast; use clone::Clone; use container::Container; -use cmp::Eq; +use cmp::{Eq, TotalEq}; use from_str::FromStr; use io::Writer; use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Rev, Iterator, Map}; @@ -93,6 +93,8 @@ impl Eq for Path { } } +impl TotalEq for Path {} + impl FromStr for Path { fn from_str(s: &str) -> Option<Path> { Path::new_opt(s) diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index 179100255c4..504c613bf4c 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -19,7 +19,7 @@ use mem; use option::{Option, Some, None}; use intrinsics; -#[cfg(not(test))] use cmp::{Eq, Ord}; +#[cfg(not(test))] use cmp::{Eq, TotalEq, Ord}; /// Return the offset of the first null pointer in `buf`. #[inline] @@ -273,6 +273,9 @@ impl<T> Eq for *T { } #[cfg(not(test))] +impl<T> TotalEq for *T {} + +#[cfg(not(test))] impl<T> Eq for *mut T { #[inline] fn eq(&self, other: &*mut T) -> bool { @@ -282,6 +285,9 @@ impl<T> Eq for *mut T { fn ne(&self, other: &*mut T) -> bool { !self.eq(other) } } +#[cfg(not(test))] +impl<T> TotalEq for *mut T {} + // Equivalence for pointers #[cfg(not(test))] impl<T> Equiv<*mut T> for *T { diff --git a/src/libstd/rc.rs b/src/libstd/rc.rs index 8dd06cb9232..d26038f508f 100644 --- a/src/libstd/rc.rs +++ b/src/libstd/rc.rs @@ -26,7 +26,7 @@ pointers, and then storing the parent pointers as `Weak` pointers. use cast::transmute; use cell::Cell; use clone::Clone; -use cmp::{Eq, Ord}; +use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering}; use kinds::marker; use ops::{Deref, Drop}; use option::{Option, Some, None}; @@ -127,6 +127,8 @@ impl<T: Eq> Eq for Rc<T> { fn ne(&self, other: &Rc<T>) -> bool { **self != **other } } +impl<T: TotalEq> TotalEq for Rc<T> {} + impl<T: Ord> Ord for Rc<T> { #[inline(always)] fn lt(&self, other: &Rc<T>) -> bool { **self < **other } @@ -141,6 +143,11 @@ impl<T: Ord> Ord for Rc<T> { fn ge(&self, other: &Rc<T>) -> bool { **self >= **other } } +impl<T: TotalOrd> TotalOrd for Rc<T> { + #[inline] + fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) } +} + /// Weak reference to a reference-counted box #[unsafe_no_drop_flag] pub struct Weak<T> { |
