implement std::cmp::* traits for !

This commit is contained in:
Andrew Cann 2016-08-01 12:56:43 +08:00
parent b22beed737
commit 51c6ae25e2

View File

@ -699,6 +699,39 @@ mod impls {
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! argh {
() => {
#[unstable(feature = "bang_type", issue = "35121")]
impl PartialEq for ! {
fn eq(&self, _: &!) -> bool {
*self
}
}
#[unstable(feature = "bang_type", issue = "35121")]
impl Eq for ! {}
#[unstable(feature = "bang_type", issue = "35121")]
impl PartialOrd for ! {
fn partial_cmp(&self, _: &!) -> Option<Ordering> {
*self
}
}
#[unstable(feature = "bang_type", issue = "35121")]
impl Ord for ! {
fn cmp(&self, _: &!) -> Ordering {
*self
}
}
}
}
#[cfg(not(stage0))]
argh!();
// & pointers
#[stable(feature = "rust1", since = "1.0.0")]