Skip to content

Commit 9ede5b0

Browse files
committed
Remove the last remnant of unsigned Neg
It's been gone since #23945, before Rust 1.0. The former wrapping semantics have also been available as inherent methods for a long time now. There's no reason to keep this unused macro around.
1 parent 8e18e26 commit 9ede5b0

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src/libcore/ops/arith.rs

+4-17
Original file line numberDiff line numberDiff line change
@@ -617,35 +617,22 @@ pub trait Neg {
617617
fn neg(self) -> Self::Output;
618618
}
619619

620-
macro_rules! neg_impl_core {
621-
($id:ident => $body:expr, $($t:ty)*) => ($(
620+
macro_rules! neg_impl {
621+
($($t:ty)*) => ($(
622622
#[stable(feature = "rust1", since = "1.0.0")]
623623
impl Neg for $t {
624624
type Output = $t;
625625

626626
#[inline]
627627
#[rustc_inherit_overflow_checks]
628-
fn neg(self) -> $t { let $id = self; $body }
628+
fn neg(self) -> $t { -self }
629629
}
630630

631631
forward_ref_unop! { impl Neg, neg for $t }
632632
)*)
633633
}
634634

635-
macro_rules! neg_impl_numeric {
636-
($($t:ty)*) => { neg_impl_core!{ x => -x, $($t)*} }
637-
}
638-
639-
#[allow(unused_macros)]
640-
macro_rules! neg_impl_unsigned {
641-
($($t:ty)*) => {
642-
neg_impl_core!{ x => {
643-
!x.wrapping_add(1)
644-
}, $($t)*} }
645-
}
646-
647-
// neg_impl_unsigned! { usize u8 u16 u32 u64 }
648-
neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 }
635+
neg_impl! { isize i8 i16 i32 i64 i128 f32 f64 }
649636

650637
/// The addition assignment operator `+=`.
651638
///

0 commit comments

Comments
 (0)