use self::Ordering::*;
-use marker::Sized;
-use option::Option::{self, Some};
-
/// Trait for equality comparisons which are [partial equivalence
/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation).
///
/// }
/// ```
///
-/// You may also find it useful to use `partial_cmp()` on your type`s fields. Here
+/// You may also find it useful to use `partial_cmp()` on your type's fields. Here
/// is an example of `Person` types who have a floating-point `height` field that
/// is the only field to be used for sorting:
///
// Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types
mod impls {
- use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering};
- use cmp::Ordering::{Less, Greater, Equal};
- use marker::Sized;
- use option::Option;
- use option::Option::{Some, None};
+ use cmp::Ordering::{self, Less, Greater, Equal};
macro_rules! partial_eq_impl {
($($t:ty)*) => ($(
ord_impl! { char usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
- // Note: This macro is a temporary hack that can be remove once we are building with a compiler
- // that supports `!`
- macro_rules! not_stage0 {
- () => {
- #[unstable(feature = "never_type", issue = "35121")]
- impl PartialEq for ! {
- fn eq(&self, _: &!) -> bool {
- *self
- }
- }
-
- #[unstable(feature = "never_type", issue = "35121")]
- impl Eq for ! {}
+ #[unstable(feature = "never_type", issue = "35121")]
+ impl PartialEq for ! {
+ fn eq(&self, _: &!) -> bool {
+ *self
+ }
+ }
- #[unstable(feature = "never_type", issue = "35121")]
- impl PartialOrd for ! {
- fn partial_cmp(&self, _: &!) -> Option<Ordering> {
- *self
- }
- }
+ #[unstable(feature = "never_type", issue = "35121")]
+ impl Eq for ! {}
- #[unstable(feature = "never_type", issue = "35121")]
- impl Ord for ! {
- fn cmp(&self, _: &!) -> Ordering {
- *self
- }
- }
+ #[unstable(feature = "never_type", issue = "35121")]
+ impl PartialOrd for ! {
+ fn partial_cmp(&self, _: &!) -> Option<Ordering> {
+ *self
}
}
- #[cfg(not(stage0))]
- not_stage0!();
+ #[unstable(feature = "never_type", issue = "35121")]
+ impl Ord for ! {
+ fn cmp(&self, _: &!) -> Ordering {
+ *self
+ }
+ }
// & pointers