diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-01-15 10:07:52 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-01-16 11:03:10 -0800 |
| commit | 9a4f43b9b6558ab74b3e849a7770dc193bc1847b (patch) | |
| tree | 2bd3ab2adb8e8312ad3384b108f2ae8e1b589055 /src/libcore/num | |
| parent | c14b615534ebcd5667f594c86d18eebff6afc7cb (diff) | |
| download | rust-9a4f43b9b6558ab74b3e849a7770dc193bc1847b.tar.gz rust-9a4f43b9b6558ab74b3e849a7770dc193bc1847b.zip | |
std: Stabilize APIs for the 1.7 release
This commit stabilizes and deprecates the FCP (final comment period) APIs for
the upcoming 1.7 beta release. The specific APIs which changed were:
Stabilized
* `Path::strip_prefix` (renamed from `relative_from`)
* `path::StripPrefixError` (new error type returned from `strip_prefix`)
* `Ipv4Addr::is_loopback`
* `Ipv4Addr::is_private`
* `Ipv4Addr::is_link_local`
* `Ipv4Addr::is_multicast`
* `Ipv4Addr::is_broadcast`
* `Ipv4Addr::is_documentation`
* `Ipv6Addr::is_unspecified`
* `Ipv6Addr::is_loopback`
* `Ipv6Addr::is_unique_local`
* `Ipv6Addr::is_multicast`
* `Vec::as_slice`
* `Vec::as_mut_slice`
* `String::as_str`
* `String::as_mut_str`
* `<[T]>::clone_from_slice` - the `usize` return value is removed
* `<[T]>::sort_by_key`
* `i32::checked_rem` (and other signed types)
* `i32::checked_neg` (and other signed types)
* `i32::checked_shl` (and other signed types)
* `i32::checked_shr` (and other signed types)
* `i32::saturating_mul` (and other signed types)
* `i32::overflowing_add` (and other signed types)
* `i32::overflowing_sub` (and other signed types)
* `i32::overflowing_mul` (and other signed types)
* `i32::overflowing_div` (and other signed types)
* `i32::overflowing_rem` (and other signed types)
* `i32::overflowing_neg` (and other signed types)
* `i32::overflowing_shl` (and other signed types)
* `i32::overflowing_shr` (and other signed types)
* `u32::checked_rem` (and other unsigned types)
* `u32::checked_neg` (and other unsigned types)
* `u32::checked_shl` (and other unsigned types)
* `u32::saturating_mul` (and other unsigned types)
* `u32::overflowing_add` (and other unsigned types)
* `u32::overflowing_sub` (and other unsigned types)
* `u32::overflowing_mul` (and other unsigned types)
* `u32::overflowing_div` (and other unsigned types)
* `u32::overflowing_rem` (and other unsigned types)
* `u32::overflowing_neg` (and other unsigned types)
* `u32::overflowing_shl` (and other unsigned types)
* `u32::overflowing_shr` (and other unsigned types)
* `ffi::IntoStringError`
* `CString::into_string`
* `CString::into_bytes`
* `CString::into_bytes_with_nul`
* `From<CString> for Vec<u8>`
* `From<CString> for Vec<u8>`
* `IntoStringError::into_cstring`
* `IntoStringError::utf8_error`
* `Error for IntoStringError`
Deprecated
* `Path::relative_from` - renamed to `strip_prefix`
* `Path::prefix` - use `components().next()` instead
* `os::unix::fs` constants - moved to the `libc` crate
* `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize
* `IntoCow` - conflicts with `Into` and may come back later
* `i32::{BITS, BYTES}` (and other integers) - not pulling their weight
* `DebugTuple::formatter` - will be removed
* `sync::Semaphore` - not used enough and confused with system semaphores
Closes #23284
cc #27709 (still lots more methods though)
Closes #27712
Closes #27722
Closes #27728
Closes #27735
Closes #27729
Closes #27755
Closes #27782
Closes #27798
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/flt2dec/mod.rs | 4 | ||||
| -rw-r--r-- | src/libcore/num/int_macros.rs | 6 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 122 | ||||
| -rw-r--r-- | src/libcore/num/uint_macros.rs | 4 | ||||
| -rw-r--r-- | src/libcore/num/usize.rs | 5 | ||||
| -rw-r--r-- | src/libcore/num/wrapping.rs | 7 |
6 files changed, 66 insertions, 82 deletions
diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs index 46f3c463ff0..9f7672a52a1 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -210,7 +210,7 @@ impl<'a> Part<'a> { } } Part::Copy(buf) => { - out.clone_from_slice(buf); + out[..buf.len()].clone_from_slice(buf); } } Some(len) @@ -245,7 +245,7 @@ impl<'a> Formatted<'a> { /// (It may still leave partially written bytes in the buffer; do not rely on that.) pub fn write(&self, out: &mut [u8]) -> Option<usize> { if out.len() < self.sign.len() { return None; } - out.clone_from_slice(self.sign); + out[..self.sign.len()].clone_from_slice(self.sign); let mut written = self.sign.len(); for part in self.parts { diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 61dcbdff016..77f662723c8 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -17,6 +17,8 @@ macro_rules! int_module { ($T:ty, $bits:expr) => ( #[unstable(feature = "num_bits_bytes", reason = "may want to be an associated function", issue = "27753")] +#[rustc_deprecated(since = "1.7.0", + reason = "will be replaced via const fn or associated constants")] #[allow(missing_docs)] pub const BITS : usize = $bits; // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of @@ -24,6 +26,8 @@ pub const BITS : usize = $bits; #[unstable(feature = "num_bits_bytes", reason = "may want to be an associated function", issue = "27753")] +#[rustc_deprecated(since = "1.7.0", + reason = "will be replaced via const fn or associated constants")] #[allow(missing_docs)] pub const BYTES : usize = ($bits / 8); @@ -31,7 +35,7 @@ pub const BYTES : usize = ($bits / 8); // calling the `Bounded::min_value` function. #[stable(feature = "rust1", since = "1.0.0")] #[allow(missing_docs)] -pub const MIN: $T = (-1 as $T) << (BITS - 1); +pub const MIN: $T = (-1 as $T) << ($bits - 1); // FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0. // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `Bounded::max_value` function. diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 76214366dc6..e3e8bcab4f1 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -13,8 +13,6 @@ #![stable(feature = "rust1", since = "1.0.0")] #![allow(missing_docs)] -use self::wrapping::OverflowingOps; - use char::CharExt; use cmp::{Eq, PartialOrd}; use convert::From; @@ -464,15 +462,13 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// use std::i32; /// /// assert_eq!(5i32.checked_rem(2), Some(1)); /// assert_eq!(5i32.checked_rem(0), None); /// assert_eq!(i32::MIN.checked_rem(-1), None); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn checked_rem(self, other: Self) -> Option<Self> { if other == 0 { @@ -491,14 +487,12 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// use std::i32; /// /// assert_eq!(5i32.checked_neg(), Some(-5)); /// assert_eq!(i32::MIN.checked_neg(), None); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn checked_neg(self) -> Option<Self> { let (a, b) = self.overflowing_neg(); @@ -513,12 +507,10 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0x10i32.checked_shl(4), Some(0x100)); /// assert_eq!(0x10i32.checked_shl(33), None); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn checked_shl(self, rhs: u32) -> Option<Self> { let (a, b) = self.overflowing_shl(rhs); @@ -533,12 +525,10 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0x10i32.checked_shr(4), Some(0x1)); /// assert_eq!(0x10i32.checked_shr(33), None); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn checked_shr(self, rhs: u32) -> Option<Self> { let (a, b) = self.overflowing_shr(rhs); @@ -595,15 +585,13 @@ macro_rules! int_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// use std::i32; /// /// assert_eq!(100i32.saturating_mul(127), 12700); /// assert_eq!((1i32 << 23).saturating_mul(1 << 23), i32::MAX); /// assert_eq!((-1i32 << 23).saturating_mul(1 << 23), i32::MIN); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn saturating_mul(self, other: Self) -> Self { self.checked_mul(other).unwrap_or_else(|| { @@ -796,15 +784,13 @@ macro_rules! int_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// use std::i32; /// /// assert_eq!(5i32.overflowing_add(2), (7, false)); /// assert_eq!(i32::MAX.overflowing_add(1), (i32::MIN, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_add(self, rhs: Self) -> (Self, bool) { unsafe { let (a, b) = $add_with_overflow(self as $ActualT, @@ -824,15 +810,13 @@ macro_rules! int_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// use std::i32; /// /// assert_eq!(5i32.overflowing_sub(2), (3, false)); /// assert_eq!(i32::MIN.overflowing_sub(1), (i32::MAX, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) { unsafe { let (a, b) = $sub_with_overflow(self as $ActualT, @@ -852,13 +836,11 @@ macro_rules! int_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(5i32.overflowing_mul(2), (10, false)); /// assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) { unsafe { let (a, b) = $mul_with_overflow(self as $ActualT, @@ -882,15 +864,13 @@ macro_rules! int_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// use std::i32; /// /// assert_eq!(5i32.overflowing_div(2), (2, false)); /// assert_eq!(i32::MIN.overflowing_div(-1), (i32::MIN, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_div(self, rhs: Self) -> (Self, bool) { if self == Self::min_value() && rhs == -1 { (self, true) @@ -914,15 +894,13 @@ macro_rules! int_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// use std::i32; /// /// assert_eq!(5i32.overflowing_rem(2), (1, false)); /// assert_eq!(i32::MIN.overflowing_rem(-1), (0, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) { if self == Self::min_value() && rhs == -1 { (0, true) @@ -944,15 +922,13 @@ macro_rules! int_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// use std::i32; /// /// assert_eq!(2i32.overflowing_neg(), (-2, false)); /// assert_eq!(i32::MIN.overflowing_neg(), (i32::MIN, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_neg(self) -> (Self, bool) { if self == Self::min_value() { (Self::min_value(), true) @@ -974,13 +950,11 @@ macro_rules! int_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0x10i32.overflowing_shl(4), (0x100, false)); /// assert_eq!(0x10i32.overflowing_shl(36), (0x100, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) { (self << (rhs & ($BITS - 1)), (rhs > ($BITS - 1))) } @@ -998,13 +972,11 @@ macro_rules! int_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0x10i32.overflowing_shr(4), (0x1, false)); /// assert_eq!(0x10i32.overflowing_shr(36), (0x1, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) { (self >> (rhs & ($BITS - 1)), (rhs > ($BITS - 1))) } @@ -1542,12 +1514,10 @@ macro_rules! uint_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(5u32.checked_rem(2), Some(1)); /// assert_eq!(5u32.checked_rem(0), None); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn checked_rem(self, other: Self) -> Option<Self> { if other == 0 { @@ -1557,6 +1527,26 @@ macro_rules! uint_impl { } } + /// Checked negation. Computes `-self`, returning `None` unless `self == + /// 0`. + /// + /// Note that negating any positive integer will overflow. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// assert_eq!(0u32.checked_neg(), Some(0)); + /// assert_eq!(1u32.checked_neg(), None); + /// ``` + #[stable(feature = "wrapping", since = "1.7.0")] + #[inline] + pub fn checked_neg(self) -> Option<Self> { + let (a, b) = self.overflowing_neg(); + if b {None} else {Some(a)} + } + /// Checked shift left. Computes `self << rhs`, returning `None` /// if `rhs` is larger than or equal to the number of bits in `self`. /// @@ -1565,12 +1555,10 @@ macro_rules! uint_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0x10u32.checked_shl(4), Some(0x100)); /// assert_eq!(0x10u32.checked_shl(33), None); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn checked_shl(self, rhs: u32) -> Option<Self> { let (a, b) = self.overflowing_shl(rhs); @@ -1585,12 +1573,10 @@ macro_rules! uint_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0x10u32.checked_shr(4), Some(0x1)); /// assert_eq!(0x10u32.checked_shr(33), None); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn checked_shr(self, rhs: u32) -> Option<Self> { let (a, b) = self.overflowing_shr(rhs); @@ -1647,14 +1633,12 @@ macro_rules! uint_impl { /// Basic usage: /// /// ``` - /// #![feature(wrapping)] - /// /// use std::u32; /// /// assert_eq!(100u32.saturating_mul(127), 12700); /// assert_eq!((1u32 << 23).saturating_mul(1 << 23), u32::MAX); /// ``` - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] #[inline] pub fn saturating_mul(self, other: Self) -> Self { self.checked_mul(other).unwrap_or(Self::max_value()) @@ -1833,15 +1817,13 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// use std::u32; /// /// assert_eq!(5u32.overflowing_add(2), (7, false)); /// assert_eq!(u32::MAX.overflowing_add(1), (0, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_add(self, rhs: Self) -> (Self, bool) { unsafe { let (a, b) = $add_with_overflow(self as $ActualT, @@ -1861,15 +1843,13 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// use std::u32; /// /// assert_eq!(5u32.overflowing_sub(2), (3, false)); /// assert_eq!(0u32.overflowing_sub(1), (u32::MAX, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) { unsafe { let (a, b) = $sub_with_overflow(self as $ActualT, @@ -1889,13 +1869,11 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(5u32.overflowing_mul(2), (10, false)); /// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) { unsafe { let (a, b) = $mul_with_overflow(self as $ActualT, @@ -1920,12 +1898,10 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(5u32.overflowing_div(2), (2, false)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_div(self, rhs: Self) -> (Self, bool) { (self / rhs, false) } @@ -1946,12 +1922,10 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(5u32.overflowing_rem(2), (1, false)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) { (self % rhs, false) } @@ -1968,13 +1942,11 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0u32.overflowing_neg(), (0, false)); /// assert_eq!(2u32.overflowing_neg(), (-2i32 as u32, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_neg(self) -> (Self, bool) { ((!self).wrapping_add(1), self != 0) } @@ -1992,13 +1964,11 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0x10u32.overflowing_shl(4), (0x100, false)); /// assert_eq!(0x10u32.overflowing_shl(36), (0x100, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) { (self << (rhs & ($BITS - 1)), (rhs > ($BITS - 1))) } @@ -2016,13 +1986,11 @@ macro_rules! uint_impl { /// Basic usage /// /// ``` - /// #![feature(wrapping)] - /// /// assert_eq!(0x10u32.overflowing_shr(4), (0x1, false)); /// assert_eq!(0x10u32.overflowing_shr(36), (0x1, true)); /// ``` #[inline] - #[unstable(feature = "wrapping", issue = "27755")] + #[stable(feature = "wrapping", since = "1.7.0")] pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) { (self >> (rhs & ($BITS - 1)), (rhs > ($BITS - 1))) } diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index 35e1e988f3e..16d84cf81e1 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -15,11 +15,15 @@ macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => ( #[unstable(feature = "num_bits_bytes", reason = "may want to be an associated function", issue = "27753")] +#[rustc_deprecated(since = "1.7.0", + reason = "will be replaced via const fn or associated constants")] #[allow(missing_docs)] pub const BITS : usize = $bits; #[unstable(feature = "num_bits_bytes", reason = "may want to be an associated function", issue = "27753")] +#[rustc_deprecated(since = "1.7.0", + reason = "will be replaced via const fn or associated constants")] #[allow(missing_docs)] pub const BYTES : usize = ($bits / 8); diff --git a/src/libcore/num/usize.rs b/src/libcore/num/usize.rs index 70e790106e1..a6a7be023eb 100644 --- a/src/libcore/num/usize.rs +++ b/src/libcore/num/usize.rs @@ -14,4 +14,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -uint_module! { usize, isize, ::isize::BITS } +#[cfg(target_pointer_width = "32")] +uint_module! { usize, isize, 32 } +#[cfg(target_pointer_width = "64")] +uint_module! { usize, isize, 64 } diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 8f9e38bbdf9..a6b3dc74469 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -9,7 +9,7 @@ // except according to those terms. #![allow(missing_docs)] -#![unstable(feature = "wrapping", reason = "may be removed or relocated", +#![unstable(feature = "old_wrapping", reason = "may be removed or relocated", issue = "27755")] use intrinsics::{add_with_overflow, sub_with_overflow, mul_with_overflow}; @@ -20,6 +20,9 @@ use ops::*; use ::{i8, i16, i32, i64, isize}; +#[unstable(feature = "old_wrapping", reason = "may be removed or relocated", + issue = "27755")] +#[rustc_deprecated(since = "1.7.0", reason = "moved to inherent methods")] pub trait OverflowingOps { fn overflowing_add(self, rhs: Self) -> (Self, bool); fn overflowing_sub(self, rhs: Self) -> (Self, bool); @@ -331,6 +334,7 @@ mod shift_max { macro_rules! signed_overflowing_impl { ($($t:ident)*) => ($( + #[allow(deprecated)] impl OverflowingOps for $t { #[inline(always)] fn overflowing_add(self, rhs: $t) -> ($t, bool) { @@ -393,6 +397,7 @@ macro_rules! signed_overflowing_impl { macro_rules! unsigned_overflowing_impl { ($($t:ident)*) => ($( + #[allow(deprecated)] impl OverflowingOps for $t { #[inline(always)] fn overflowing_add(self, rhs: $t) -> ($t, bool) { |
