From e2604a756aaddcd5919ee2f1b9cc0055d200f846 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Mon, 10 Dec 2018 21:00:27 -0800 Subject: Update libc crate to 0.2.45 This change updates the libc crate to version 0.2.45. Import subrepo libc/:libc at f5636fc618f8e16968b3178196d73c94ad9f7b05 --- libc/src/dox.rs | 100 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 16 deletions(-) (limited to 'libc/src/dox.rs') diff --git a/libc/src/dox.rs b/libc/src/dox.rs index 5c095b9..33a9c16 100644 --- a/libc/src/dox.rs +++ b/libc/src/dox.rs @@ -1,14 +1,14 @@ pub use self::imp::*; -#[cfg(not(dox))] +#[cfg(not(cross_platform_docs))] mod imp { - pub use core::option::Option; pub use core::clone::Clone; pub use core::marker::Copy; pub use core::mem; + pub use core::option::Option; } -#[cfg(dox)] +#[cfg(cross_platform_docs)] mod imp { pub enum Option { Some(T), @@ -16,7 +16,23 @@ mod imp { } impl Copy for Option {} impl Clone for Option { - fn clone(&self) -> Option { loop {} } + fn clone(&self) -> Option { + loop {} + } + } + + impl Copy for *mut T {} + impl Clone for *mut T { + fn clone(&self) -> *mut T { + loop {} + } + } + + impl Copy for *const T {} + impl Clone for *const T { + fn clone(&self) -> *const T { + loop {} + } } pub trait Clone { @@ -37,56 +53,83 @@ mod imp { pub trait Sized {} macro_rules! each_int { - ($mac:ident) => ( + ($mac:ident) => { $mac!(u8); $mac!(u16); $mac!(u32); $mac!(u64); $mac!(usize); each_signed_int!($mac); - ) + }; } macro_rules! each_signed_int { - ($mac:ident) => ( + ($mac:ident) => { $mac!(i8); $mac!(i16); $mac!(i32); $mac!(i64); $mac!(isize); - ) + }; } #[lang = "div"] - pub trait Div { + pub trait Div { type Output; fn div(self, rhs: RHS) -> Self::Output; } #[lang = "shl"] - pub trait Shl { + pub trait Shl { type Output; fn shl(self, rhs: RHS) -> Self::Output; } #[lang = "mul"] - pub trait Mul { + pub trait Mul { type Output; fn mul(self, rhs: RHS) -> Self::Output; } #[lang = "sub"] - pub trait Sub { + pub trait Sub { type Output; fn sub(self, rhs: RHS) -> Self::Output; } + #[lang = "bitand"] + pub trait BitAnd { + type Output; + fn bitand(self, rhs: RHS) -> Self::Output; + } + + #[lang = "bitand_assign"] + pub trait BitAndAssign { + fn bitand_assign(&mut self, rhs: RHS); + } + #[lang = "bitor"] - pub trait Bitor { + pub trait BitOr { type Output; fn bitor(self, rhs: RHS) -> Self::Output; } + #[lang = "bitor_assign"] + pub trait BitOrAssign { + fn bitor_assign(&mut self, rhs: RHS); + } + + #[lang = "bitxor"] + pub trait BitXor { + type Output; + fn bitxor(self, rhs: RHS) -> Self::Output; + } + + #[lang = "bitxor_assign"] + pub trait BitXorAssign { + fn bitxor_assign(&mut self, rhs: RHS); + } + #[lang = "neg"] pub trait Neg { type Output; @@ -124,10 +167,27 @@ mod imp { type Output = $i; fn sub(self, rhs: $i) -> $i { self - rhs } } - impl Bitor for $i { + impl BitAnd for $i { + type Output = $i; + fn bitand(self, rhs: $i) -> $i { self & rhs } + } + impl BitAndAssign for $i { + fn bitand_assign(&mut self, rhs: $i) { *self &= rhs; } + } + impl BitOr for $i { type Output = $i; fn bitor(self, rhs: $i) -> $i { self | rhs } } + impl BitOrAssign for $i { + fn bitor_assign(&mut self, rhs: $i) { *self |= rhs; } + } + impl BitXor for $i { + type Output = $i; + fn bitxor(self, rhs: $i) -> $i { self ^ rhs } + } + impl BitXorAssign for $i { + fn bitxor_assign(&mut self, rhs: $i) { *self ^= rhs; } + } impl Neg for $i { type Output = $i; fn neg(self) -> $i { -self } @@ -140,12 +200,20 @@ mod imp { type Output = $i; fn add(self, other: $i) -> $i { self + other } } + impl Copy for $i {} + impl Clone for $i { + fn clone(&self) -> $i { loop {} } + } )*) } each_int!(impl_traits); pub mod mem { - pub fn size_of_val(_: &T) -> usize { 4 } - pub fn size_of(_: &T) -> usize { 4 } + pub fn size_of_val(_: &T) -> usize { + 4 + } + pub const fn size_of() -> usize { + 4 + } } } -- cgit v1.2.1