diff options
author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-01-03 00:29:27 +0200 |
---|---|---|
committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-01-03 00:29:27 +0200 |
commit | 974f7ba2e0e25e5611ed99e0206fc98a1e8a6220 (patch) | |
tree | 49271ffb2271d96c259d30fe415210836f650405 | |
parent | 98589876259e19f13eab81b033ced95bbb6deca0 (diff) | |
download | rust-libc-974f7ba2e0e25e5611ed99e0206fc98a1e8a6220.tar.gz |
Support Neg and Not in no_core mode.
-rw-r--r-- | src/dox.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/dox.rs b/src/dox.rs index c7d3dc9c2d..fbec3f2d4e 100644 --- a/src/dox.rs +++ b/src/dox.rs @@ -40,6 +40,12 @@ mod imp { $mac!(u32); $mac!(u64); $mac!(usize); + each_signed_int!($mac); + ) + } + + macro_rules! each_signed_int { + ($mac:ident) => ( $mac!(i8); $mac!(i16); $mac!(i32); @@ -128,6 +134,38 @@ mod imp { } each_int!(impl_bitor); + #[lang = "neg"] + pub trait Neg { + type Output; + fn neg(self) -> Self::Output; + } + + macro_rules! impl_neg { + ($($i:ident)*) => ($( + impl Neg for $i { + type Output = $i; + fn neg(self) -> $i { -self } + } + )*) + } + each_signed_int!(impl_neg); + + #[lang = "not"] + pub trait Not { + type Output; + fn not(self) -> Self::Output; + } + + macro_rules! impl_not { + ($($i:ident)*) => ($( + impl Not for $i { + type Output = $i; + fn not(self) -> $i { !self } + } + )*) + } + each_int!(impl_not); + pub mod mem { pub fn size_of_val<T>(_: &T) -> usize { 4 } } |