about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/num/wrapping.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs
index e28a36af2f3..04e8bc4913b 100644
--- a/src/libcore/num/wrapping.rs
+++ b/src/libcore/num/wrapping.rs
@@ -275,6 +275,15 @@ macro_rules! wrapping_impl {
                 *self = *self & other;
             }
         }
+
+        #[stable(feature = "wrapping_neg", since = "1.10.0")]
+        impl Neg for Wrapping<$t> {
+            type Output = Self;
+            #[inline(always)]
+            fn neg(self) -> Self {
+                Wrapping(0) - self
+            }
+        }
     )*)
 }