diff options
| author | bors <bors@rust-lang.org> | 2018-09-30 01:45:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-09-30 01:45:50 +0000 |
| commit | 6310be458f4665f537419f033a764b0644c7e5ab (patch) | |
| tree | 89427e9623f634be3528a30ca9441475d83b7e58 /src/libcore/num | |
| parent | e0a1ab6374340a4b9ca9f0c6d387763cf163526e (diff) | |
| parent | d40b6cf086734109ec402aa546eca4d3925732ca (diff) | |
| download | rust-6310be458f4665f537419f033a764b0644c7e5ab.tar.gz rust-6310be458f4665f537419f033a764b0644c7e5ab.zip | |
Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum
Bump to 1.31.0 and bootstrap from 1.30 beta Closes #54594.
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/mod.rs | 406 |
1 files changed, 1 insertions, 405 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index c4b59738478..f054580cba7 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -348,14 +348,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn rotate_left(self, n: u32) -> Self { - (self as $UnsignedT).rotate_left(n) as Self - } - doc_comment! { concat!("Shifts the bits to the left by a specified amount, `n`, wrapping the truncated bits to the end of the resulting integer. @@ -375,20 +367,11 @@ assert_eq!(n.rotate_left(", $rot, "), m); #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_rotate")] #[inline] - #[cfg(not(stage0))] pub const fn rotate_left(self, n: u32) -> Self { (self as $UnsignedT).rotate_left(n) as Self } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn rotate_right(self, n: u32) -> Self { - (self as $UnsignedT).rotate_right(n) as Self - } - doc_comment! { concat!("Shifts the bits to the right by a specified amount, `n`, wrapping the truncated bits to the beginning of the resulting @@ -409,7 +392,6 @@ assert_eq!(n.rotate_right(", $rot, "), m); #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_rotate")] #[inline] - #[cfg(not(stage0))] pub const fn rotate_right(self, n: u32) -> Self { (self as $UnsignedT).rotate_right(n) as Self } @@ -437,14 +419,6 @@ assert_eq!(m, ", $swapped, "); } } - /// no docs here - #[unstable(feature = "reverse_bits", issue = "48763")] - #[inline] - #[cfg(stage0)] - pub fn reverse_bits(self) -> Self { - (self as $UnsignedT).reverse_bits() as Self - } - doc_comment! { concat!("Reverses the bit pattern of the integer. @@ -463,7 +437,6 @@ assert_eq!(m, ", $reversed, "); #[unstable(feature = "reverse_bits", issue = "48763")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn reverse_bits(self) -> Self { (self as $UnsignedT).reverse_bits() as Self } @@ -1014,16 +987,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_add(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_add(self, rhs) - } - } - doc_comment! { concat!("Wrapping (modular) addition. Computes `self + rhs`, wrapping around at the boundary of the type. @@ -1041,7 +1004,6 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_add(self, rhs: Self) -> Self { unsafe { intrinsics::overflowing_add(self, rhs) @@ -1049,16 +1011,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_sub(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_sub(self, rhs) - } - } - doc_comment! { concat!("Wrapping (modular) subtraction. Computes `self - rhs`, wrapping around at the boundary of the type. @@ -1076,7 +1028,6 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_sub(self, rhs: Self) -> Self { unsafe { intrinsics::overflowing_sub(self, rhs) @@ -1084,16 +1035,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_mul(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_mul(self, rhs) - } - } - doc_comment! { concat!("Wrapping (modular) multiplication. Computes `self * rhs`, wrapping around at the boundary of the type. @@ -1110,7 +1051,6 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_mul(self, rhs: Self) -> Self { unsafe { intrinsics::overflowing_mul(self, rhs) @@ -1254,16 +1194,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "num_wrapping", since = "1.2.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_shl(self, rhs: u32) -> Self { - unsafe { - intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT) - } - } - doc_comment! { concat!("Panic-free bitwise shift-left; yields `self << mask(rhs)`, where `mask` removes any high-order bits of `rhs` that would cause the shift to exceed the bitwidth of the type. @@ -1285,7 +1215,6 @@ $EndFeature, " #[stable(feature = "num_wrapping", since = "1.2.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_shl(self, rhs: u32) -> Self { unsafe { intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT) @@ -1293,16 +1222,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "num_wrapping", since = "1.2.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_shr(self, rhs: u32) -> Self { - unsafe { - intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT) - } - } - doc_comment! { concat!("Panic-free bitwise shift-right; yields `self >> mask(rhs)`, where `mask` removes any high-order bits of `rhs` that would cause the shift to exceed the bitwidth of the type. @@ -1324,7 +1243,6 @@ $EndFeature, " #[stable(feature = "num_wrapping", since = "1.2.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_shr(self, rhs: u32) -> Self { unsafe { intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT) @@ -1403,18 +1321,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_add(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::add_with_overflow(self as $ActualT, - rhs as $ActualT) - }; - (a as Self, b) - } - doc_comment! { concat!("Calculates `self` + `rhs` @@ -1435,7 +1341,6 @@ assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($Sel #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_add(self, rhs: Self) -> (Self, bool) { let (a, b) = unsafe { intrinsics::add_with_overflow(self as $ActualT, @@ -1445,18 +1350,6 @@ assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($Sel } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::sub_with_overflow(self as $ActualT, - rhs as $ActualT) - }; - (a as Self, b) - } - doc_comment! { concat!("Calculates `self` - `rhs` @@ -1477,7 +1370,6 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($Sel #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool) { let (a, b) = unsafe { intrinsics::sub_with_overflow(self as $ActualT, @@ -1487,18 +1379,6 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($Sel } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::mul_with_overflow(self as $ActualT, - rhs as $ActualT) - }; - (a as Self, b) - } - doc_comment! { concat!("Calculates the multiplication of `self` and `rhs`. @@ -1517,7 +1397,6 @@ $EndFeature, " #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) { let (a, b) = unsafe { intrinsics::mul_with_overflow(self as $ActualT, @@ -1688,14 +1567,6 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) { - (self.wrapping_shl(rhs), (rhs > ($BITS - 1))) - } - doc_comment! { concat!("Shifts self left by `rhs` bits. @@ -1715,20 +1586,11 @@ $EndFeature, " #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool) { (self.wrapping_shl(rhs), (rhs > ($BITS - 1))) } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) { - (self.wrapping_shr(rhs), (rhs > ($BITS - 1))) - } - doc_comment! { concat!("Shifts self right by `rhs` bits. @@ -1748,7 +1610,6 @@ $EndFeature, " #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) { (self.wrapping_shr(rhs), (rhs > ($BITS - 1))) } @@ -2013,12 +1874,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn is_positive(self) -> bool { self > 0 } - doc_comment! { concat!("Returns `true` if `self` is positive and `false` if the number is zero or negative. @@ -2035,16 +1890,9 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_sign")] #[inline] - #[cfg(not(stage0))] pub const fn is_positive(self) -> bool { self > 0 } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn is_negative(self) -> bool { self < 0 } - doc_comment! { concat!("Returns `true` if `self` is negative and `false` if the number is zero or positive. @@ -2061,18 +1909,9 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_sign")] #[inline] - #[cfg(not(stage0))] pub const fn is_negative(self) -> bool { self < 0 } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] { - self.to_be().to_ne_bytes() - } - doc_comment! { concat!("Return the memory representation of this integer as a byte array in big-endian (network) byte order. @@ -2088,20 +1927,11 @@ assert_eq!(bytes, ", $be_bytes, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] { self.to_be().to_ne_bytes() } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] { - self.to_le().to_ne_bytes() - } - doc_comment! { concat!("Return the memory representation of this integer as a byte array in little-endian byte order. @@ -2117,20 +1947,11 @@ assert_eq!(bytes, ", $le_bytes, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] { self.to_le().to_ne_bytes() } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] { - unsafe { mem::transmute(self) } - } - doc_comment! { concat!(" Return the memory representation of this integer as a byte array in @@ -2158,20 +1979,11 @@ assert_eq!(bytes, if cfg!(target_endian = \"big\") { #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] { unsafe { mem::transmute(self) } } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - Self::from_be(Self::from_ne_bytes(bytes)) - } - doc_comment! { concat!("Create an integer value from its representation as a byte array in big endian. @@ -2187,20 +1999,11 @@ assert_eq!(value, ", $swap_op, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { Self::from_be(Self::from_ne_bytes(bytes)) } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - Self::from_le(Self::from_ne_bytes(bytes)) - } - doc_comment! { concat!(" Create an integer value from its representation as a byte array in @@ -2217,20 +2020,11 @@ assert_eq!(value, ", $swap_op, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { Self::from_le(Self::from_ne_bytes(bytes)) } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - unsafe { mem::transmute(bytes) } - } - doc_comment! { concat!("Create an integer value from its memory representation as a byte array in native endianness. @@ -2257,7 +2051,6 @@ assert_eq!(value, ", $swap_op, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { unsafe { mem::transmute(bytes) } } @@ -2486,16 +2279,6 @@ assert_eq!(n.trailing_zeros(), 3);", $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn rotate_left(self, n: u32) -> Self { - // Protect against undefined behaviour for over-long bit shifts - let n = n % $BITS; - (self << n) | (self >> (($BITS - n) % $BITS)) - } - doc_comment! { concat!("Shifts the bits to the left by a specified amount, `n`, wrapping the truncated bits to the end of the resulting integer. @@ -2515,22 +2298,11 @@ assert_eq!(n.rotate_left(", $rot, "), m); #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_rotate")] #[inline] - #[cfg(not(stage0))] pub const fn rotate_left(self, n: u32) -> Self { (self << (n % $BITS)) | (self >> (($BITS - (n % $BITS)) % $BITS)) } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn rotate_right(self, n: u32) -> Self { - // Protect against undefined behaviour for over-long bit shifts - let n = n % $BITS; - (self >> n) | (self << (($BITS - n) % $BITS)) - } - doc_comment! { concat!("Shifts the bits to the right by a specified amount, `n`, wrapping the truncated bits to the beginning of the resulting @@ -2551,7 +2323,6 @@ assert_eq!(n.rotate_right(", $rot, "), m); #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_rotate")] #[inline] - #[cfg(not(stage0))] pub const fn rotate_right(self, n: u32) -> Self { (self >> (n % $BITS)) | (self << (($BITS - (n % $BITS)) % $BITS)) } @@ -2579,14 +2350,6 @@ assert_eq!(m, ", $swapped, "); } } - /// no docs here - #[unstable(feature = "reverse_bits", issue = "48763")] - #[inline] - #[cfg(stage0)] - pub fn reverse_bits(self) -> Self { - unsafe { intrinsics::bitreverse(self as $ActualT) as Self } - } - doc_comment! { concat!("Reverses the bit pattern of the integer. @@ -2605,7 +2368,6 @@ assert_eq!(m, ", $reversed, "); #[unstable(feature = "reverse_bits", issue = "48763")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn reverse_bits(self) -> Self { unsafe { intrinsics::bitreverse(self as $ActualT) as Self } } @@ -3094,16 +2856,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_add(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_add(self, rhs) - } - } - doc_comment! { concat!("Wrapping (modular) addition. Computes `self + rhs`, wrapping around at the boundary of the type. @@ -3120,7 +2872,6 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_add(self, rhs: Self) -> Self { unsafe { intrinsics::overflowing_add(self, rhs) @@ -3128,16 +2879,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_sub(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_sub(self, rhs) - } - } - doc_comment! { concat!("Wrapping (modular) subtraction. Computes `self - rhs`, wrapping around at the boundary of the type. @@ -3154,7 +2895,6 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_sub(self, rhs: Self) -> Self { unsafe { intrinsics::overflowing_sub(self, rhs) @@ -3162,16 +2902,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_mul(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_mul(self, rhs) - } - } - /// Wrapping (modular) multiplication. Computes `self * /// rhs`, wrapping around at the boundary of the type. /// @@ -3189,7 +2919,6 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_mul(self, rhs: Self) -> Self { unsafe { intrinsics::overflowing_mul(self, rhs) @@ -3311,16 +3040,6 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0); self.overflowing_neg().0 } - /// no docs here - #[stable(feature = "num_wrapping", since = "1.2.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_shl(self, rhs: u32) -> Self { - unsafe { - intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT) - } - } - doc_comment! { concat!("Panic-free bitwise shift-left; yields `self << mask(rhs)`, where `mask` removes any high-order bits of `rhs` that @@ -3344,7 +3063,6 @@ assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, " #[stable(feature = "num_wrapping", since = "1.2.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_shl(self, rhs: u32) -> Self { unsafe { intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT) @@ -3352,16 +3070,6 @@ assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, " } } - /// no docs here - #[stable(feature = "num_wrapping", since = "1.2.0")] - #[inline] - #[cfg(stage0)] - pub fn wrapping_shr(self, rhs: u32) -> Self { - unsafe { - intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT) - } - } - doc_comment! { concat!("Panic-free bitwise shift-right; yields `self >> mask(rhs)`, where `mask` removes any high-order bits of `rhs` that @@ -3385,7 +3093,6 @@ assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, " #[stable(feature = "num_wrapping", since = "1.2.0")] #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] - #[cfg(not(stage0))] pub const fn wrapping_shr(self, rhs: u32) -> Self { unsafe { intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT) @@ -3431,18 +3138,6 @@ assert_eq!(3u8.wrapping_pow(6), 217);", $EndFeature, " } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_add(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::add_with_overflow(self as $ActualT, - rhs as $ActualT) - }; - (a as Self, b) - } - doc_comment! { concat!("Calculates `self` + `rhs` @@ -3463,7 +3158,6 @@ assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));", $EndF #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_add(self, rhs: Self) -> (Self, bool) { let (a, b) = unsafe { intrinsics::add_with_overflow(self as $ActualT, @@ -3473,18 +3167,6 @@ assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));", $EndF } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::sub_with_overflow(self as $ActualT, - rhs as $ActualT) - }; - (a as Self, b) - } - doc_comment! { concat!("Calculates `self` - `rhs` @@ -3506,7 +3188,6 @@ $EndFeature, " #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool) { let (a, b) = unsafe { intrinsics::sub_with_overflow(self as $ActualT, @@ -3516,18 +3197,6 @@ $EndFeature, " } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::mul_with_overflow(self as $ActualT, - rhs as $ActualT) - }; - (a as Self, b) - } - /// Calculates the multiplication of `self` and `rhs`. /// /// Returns a tuple of the multiplication along with a boolean @@ -3548,7 +3217,6 @@ $EndFeature, " #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) { let (a, b) = unsafe { intrinsics::mul_with_overflow(self as $ActualT, @@ -3687,14 +3355,6 @@ assert_eq!(2", stringify!($SelfT), ".overflowing_neg(), (-2i32 as ", stringify!( } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) { - (self.wrapping_shl(rhs), (rhs > ($BITS - 1))) - } - doc_comment! { concat!("Shifts self left by `rhs` bits. @@ -3715,20 +3375,11 @@ assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(132), (0x10, true));", $E #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool) { (self.wrapping_shl(rhs), (rhs > ($BITS - 1))) } } - /// no docs here - #[stable(feature = "wrapping", since = "1.7.0")] - #[inline] - #[cfg(stage0)] - pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) { - (self.wrapping_shr(rhs), (rhs > ($BITS - 1))) - } - doc_comment! { concat!("Shifts self right by `rhs` bits. @@ -3749,7 +3400,6 @@ assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $E #[stable(feature = "wrapping", since = "1.7.0")] #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] - #[cfg(not(stage0))] pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) { (self.wrapping_shr(rhs), (rhs > ($BITS - 1))) } @@ -3992,15 +3642,7 @@ $EndFeature, " } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] { - self.to_be().to_ne_bytes() - } - - doc_comment! { + doc_comment! { concat!("Return the memory representation of this integer as a byte array in big-endian (network) byte order. @@ -4015,20 +3657,11 @@ assert_eq!(bytes, ", $be_bytes, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] { self.to_be().to_ne_bytes() } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] { - self.to_le().to_ne_bytes() - } - doc_comment! { concat!("Return the memory representation of this integer as a byte array in little-endian byte order. @@ -4044,20 +3677,11 @@ assert_eq!(bytes, ", $le_bytes, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] { self.to_le().to_ne_bytes() } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] { - unsafe { mem::transmute(self) } - } - doc_comment! { concat!(" Return the memory representation of this integer as a byte array in @@ -4085,20 +3709,11 @@ assert_eq!(bytes, if cfg!(target_endian = \"big\") { #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] { unsafe { mem::transmute(self) } } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - Self::from_be(Self::from_ne_bytes(bytes)) - } - doc_comment! { concat!("Create an integer value from its representation as a byte array in big endian. @@ -4114,20 +3729,11 @@ assert_eq!(value, ", $swap_op, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { Self::from_be(Self::from_ne_bytes(bytes)) } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - Self::from_le(Self::from_ne_bytes(bytes)) - } - doc_comment! { concat!(" Create an integer value from its representation as a byte array in @@ -4144,20 +3750,11 @@ assert_eq!(value, ", $swap_op, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { Self::from_le(Self::from_ne_bytes(bytes)) } } - /// no docs here - #[unstable(feature = "int_to_from_bytes", issue = "52963")] - #[inline] - #[cfg(stage0)] - pub fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - unsafe { mem::transmute(bytes) } - } - doc_comment! { concat!("Create an integer value from its memory representation as a byte array in native endianness. @@ -4184,7 +3781,6 @@ assert_eq!(value, ", $swap_op, "); #[unstable(feature = "int_to_from_bytes", issue = "52963")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] - #[cfg(not(stage0))] pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { unsafe { mem::transmute(bytes) } } |
