about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-14 14:14:47 +0000
committerbors <bors@rust-lang.org>2020-04-14 14:14:47 +0000
commit6805906fba0bca2bc77da9ad09cc9f91c3cea3eb (patch)
tree387ee6e30eec34b94999b8b49bd2770a5313c07c /src/libcore
parentba72b15666b2491415aec703a02c2364fe5e2790 (diff)
parent816443e6cfbd07443ec9c26f9b83fdd9ffa5715c (diff)
downloadrust-6805906fba0bca2bc77da9ad09cc9f91c3cea3eb.tar.gz
rust-6805906fba0bca2bc77da9ad09cc9f91c3cea3eb.zip
Auto merge of #71125 - Dylan-DPC:rollup-3b8prjh, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71112 (Remove the last remnant of unsigned Neg)
 - #71120 (Clean up E0517 explanation)
 - #71121 (Fix broken link in documentation for String::from_utf8)
 - #71122 (update `FnCtxt::lookup_method` docs)
 - #71124 (Add missing comma)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ops/arith.rs21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs
index e9ec81394e3..622a138abe9 100644
--- a/src/libcore/ops/arith.rs
+++ b/src/libcore/ops/arith.rs
@@ -617,35 +617,22 @@ pub trait Neg {
     fn neg(self) -> Self::Output;
 }
 
-macro_rules! neg_impl_core {
-    ($id:ident => $body:expr, $($t:ty)*) => ($(
+macro_rules! neg_impl {
+    ($($t:ty)*) => ($(
         #[stable(feature = "rust1", since = "1.0.0")]
         impl Neg for $t {
             type Output = $t;
 
             #[inline]
             #[rustc_inherit_overflow_checks]
-            fn neg(self) -> $t { let $id = self; $body }
+            fn neg(self) -> $t { -self }
         }
 
         forward_ref_unop! { impl Neg, neg for $t }
     )*)
 }
 
-macro_rules! neg_impl_numeric {
-    ($($t:ty)*) => { neg_impl_core!{ x => -x, $($t)*} }
-}
-
-#[allow(unused_macros)]
-macro_rules! neg_impl_unsigned {
-    ($($t:ty)*) => {
-        neg_impl_core!{ x => {
-            !x.wrapping_add(1)
-        }, $($t)*} }
-}
-
-// neg_impl_unsigned! { usize u8 u16 u32 u64 }
-neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 }
+neg_impl! { isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The addition assignment operator `+=`.
 ///