diff options
| author | bors <bors@rust-lang.org> | 2016-05-05 00:37:56 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-05-05 00:37:56 -0700 |
| commit | 3f65afa6946ee4a6b1d619aee69e1f638edfb662 (patch) | |
| tree | b4bca2defc22350ba377f0205db75c7a77c6fcde | |
| parent | 8655587c1e758ebc7fc49189a1fd89a14c851208 (diff) | |
| parent | 8a8c432f7471a76bdb9179fe622968f6eb381c85 (diff) | |
| download | rust-3f65afa6946ee4a6b1d619aee69e1f638edfb662.tar.gz rust-3f65afa6946ee4a6b1d619aee69e1f638edfb662.zip | |
Auto merge of #33067 - notriddle:wrapping_neg, r=alexcrichton
Implement negation for wrapping numerals. Fixes #33037
| -rw-r--r-- | src/libcore/num/wrapping.rs | 9 |
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 + } + } )*) } |
