about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-11-21 17:19:54 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2024-11-22 22:01:09 +0100
commit67bdc9b33710c21b4e19abd3e2b8aa95c1ccfaed (patch)
tree799487c5ec3c5a23cfcac0eb26ed8967cd5946f1
parent717f5df2c308dfb4b7b8e6c002c11fe8269c4011 (diff)
downloadrust-67bdc9b33710c21b4e19abd3e2b8aa95c1ccfaed.tar.gz
rust-67bdc9b33710c21b4e19abd3e2b8aa95c1ccfaed.zip
Add code example for `wrapping_neg` method for signed integers
-rw-r--r--library/core/src/num/int_macros.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs
index 318bb8ee4cd..64dcb4c91e6 100644
--- a/library/core/src/num/int_macros.rs
+++ b/library/core/src/num/int_macros.rs
@@ -2101,6 +2101,7 @@ macro_rules! int_impl {
         ///
         /// ```
         #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_neg(), -100);")]
+        #[doc = concat!("assert_eq!((-100", stringify!($SelfT), ").wrapping_neg(), 100);")]
         #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.wrapping_neg(), ", stringify!($SelfT), "::MIN);")]
         /// ```
         #[stable(feature = "num_wrapping", since = "1.2.0")]