Clean up const-hack from #58044
This commit is contained in:
parent
282635f2db
commit
91c2f78b50
1 changed files with 6 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue