Rollup merge of #110070 - scottmcm:wrapping-neg, r=cuviper
The `wrapping_neg` example for unsigned types shouldn't use `i8` Probably it should have at least one example with an unsigned type.
This commit is contained in:
commit
75a46252ba
@ -1363,12 +1363,11 @@ pub const fn wrapping_rem_euclid(self, rhs: Self) -> Self {
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// Please note that this example is shared between integer types.
|
||||
/// Which explains why `i8` is used here.
|
||||
///
|
||||
/// ```
|
||||
/// assert_eq!(100i8.wrapping_neg(), -100);
|
||||
/// assert_eq!((-128i8).wrapping_neg(), -128);
|
||||
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".wrapping_neg(), 0);")]
|
||||
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.wrapping_neg(), 1);")]
|
||||
#[doc = concat!("assert_eq!(13_", stringify!($SelfT), ".wrapping_neg(), (!13) + 1);")]
|
||||
#[doc = concat!("assert_eq!(42_", stringify!($SelfT), ".wrapping_neg(), !(42 - 1));")]
|
||||
/// ```
|
||||
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
||||
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||
|
Loading…
Reference in New Issue
Block a user