Skip to content

Always inline arithmetic operators #62095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/libcore/ops/arith.rs
Original file line number Diff line number Diff line change
@@ -95,8 +95,8 @@ macro_rules! add_impl {
impl Add for $t {
type Output = $t;

#[inline]
#[rustc_inherit_overflow_checks]
#[inline(always)]
fn add(self, other: $t) -> $t { self + other }
}

@@ -193,7 +193,7 @@ macro_rules! sub_impl {
impl Sub for $t {
type Output = $t;

#[inline]
#[inline(always)]
#[rustc_inherit_overflow_checks]
fn sub(self, other: $t) -> $t { self - other }
}
@@ -313,7 +313,7 @@ macro_rules! mul_impl {
impl Mul for $t {
type Output = $t;

#[inline]
#[inline(always)]
#[rustc_inherit_overflow_checks]
fn mul(self, other: $t) -> $t { self * other }
}
@@ -439,7 +439,7 @@ macro_rules! div_impl_integer {
impl Div for $t {
type Output = $t;

#[inline]
#[inline(always)]
fn div(self, other: $t) -> $t { self / other }
}

@@ -455,7 +455,7 @@ macro_rules! div_impl_float {
impl Div for $t {
type Output = $t;

#[inline]
#[inline(always)]
fn div(self, other: $t) -> $t { self / other }
}

@@ -524,7 +524,7 @@ macro_rules! rem_impl_integer {
impl Rem for $t {
type Output = $t;

#[inline]
#[inline(always)]
fn rem(self, other: $t) -> $t { self % other }
}

@@ -556,7 +556,7 @@ macro_rules! rem_impl_float {
impl Rem for $t {
type Output = $t;

#[inline]
#[inline(always)]
fn rem(self, other: $t) -> $t { self % other }
}

@@ -624,7 +624,7 @@ macro_rules! neg_impl_core {
impl Neg for $t {
type Output = $t;

#[inline]
#[inline(always)]
#[rustc_inherit_overflow_checks]
fn neg(self) -> $t { let $id = self; $body }
}
@@ -693,7 +693,7 @@ macro_rules! add_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl AddAssign for $t {
#[inline]
#[inline(always)]
#[rustc_inherit_overflow_checks]
fn add_assign(&mut self, other: $t) { *self += other }
}
@@ -749,7 +749,7 @@ macro_rules! sub_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl SubAssign for $t {
#[inline]
#[inline(always)]
#[rustc_inherit_overflow_checks]
fn sub_assign(&mut self, other: $t) { *self -= other }
}
@@ -796,7 +796,7 @@ macro_rules! mul_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl MulAssign for $t {
#[inline]
#[inline(always)]
#[rustc_inherit_overflow_checks]
fn mul_assign(&mut self, other: $t) { *self *= other }
}
@@ -843,7 +843,7 @@ macro_rules! div_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl DivAssign for $t {
#[inline]
#[inline(always)]
fn div_assign(&mut self, other: $t) { *self /= other }
}

@@ -893,7 +893,7 @@ macro_rules! rem_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl RemAssign for $t {
#[inline]
#[inline(always)]
fn rem_assign(&mut self, other: $t) { *self %= other }
}