mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Clean up const-hack from #58044
This commit is contained in:
parent
282635f2db
commit
91c2f78b50
@ -1709,8 +1709,13 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
|
||||
#[inline]
|
||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||
#[allow_internal_unstable(const_if_match)]
|
||||
pub const fn overflowing_neg(self) -> (Self, bool) {
|
||||
((!self).wrapping_add(1), self == Self::min_value())
|
||||
if self == Self::min_value() {
|
||||
(Self::min_value(), true)
|
||||
} else {
|
||||
(-self, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user