Skip to content

Commit 91c2f78

Browse files
committed
Clean up const-hack from #58044
1 parent 282635f commit 91c2f78

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libcore/num/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1709,8 +1709,13 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
17091709
#[inline]
17101710
#[stable(feature = "wrapping", since = "1.7.0")]
17111711
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
1712+
#[allow_internal_unstable(const_if_match)]
17121713
pub const fn overflowing_neg(self) -> (Self, bool) {
1713-
((!self).wrapping_add(1), self == Self::min_value())
1714+
if self == Self::min_value() {
1715+
(Self::min_value(), true)
1716+
} else {
1717+
(-self, false)
1718+
}
17141719
}
17151720
}
17161721

0 commit comments

Comments
 (0)