core: mark relevant functions with #[rustc_inherit_overflow_checks].
This commit is contained in:
parent
4adc967ed1
commit
702c47baae
4 changed files with 19 additions and 3 deletions
|
@ -208,6 +208,7 @@ macro_rules! add_impl {
|
|||
type Output = $t;
|
||||
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn add(self, other: $t) -> $t { self + other }
|
||||
}
|
||||
|
||||
|
@ -261,6 +262,7 @@ macro_rules! sub_impl {
|
|||
type Output = $t;
|
||||
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn sub(self, other: $t) -> $t { self - other }
|
||||
}
|
||||
|
||||
|
@ -314,6 +316,7 @@ macro_rules! mul_impl {
|
|||
type Output = $t;
|
||||
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn mul(self, other: $t) -> $t { self * other }
|
||||
}
|
||||
|
||||
|
@ -511,6 +514,7 @@ macro_rules! neg_impl_core {
|
|||
type Output = $t;
|
||||
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn neg(self) -> $t { let $id = self; $body }
|
||||
}
|
||||
|
||||
|
@ -788,6 +792,7 @@ macro_rules! shl_impl {
|
|||
type Output = $t;
|
||||
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn shl(self, other: $f) -> $t {
|
||||
self << other
|
||||
}
|
||||
|
@ -859,6 +864,7 @@ macro_rules! shr_impl {
|
|||
type Output = $t;
|
||||
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn shr(self, other: $f) -> $t {
|
||||
self >> other
|
||||
}
|
||||
|
@ -923,6 +929,7 @@ macro_rules! add_assign_impl {
|
|||
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||
impl AddAssign for $t {
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn add_assign(&mut self, other: $t) { *self += other }
|
||||
}
|
||||
)+)
|
||||
|
@ -967,6 +974,7 @@ macro_rules! sub_assign_impl {
|
|||
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||
impl SubAssign for $t {
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn sub_assign(&mut self, other: $t) { *self -= other }
|
||||
}
|
||||
)+)
|
||||
|
@ -1011,6 +1019,7 @@ macro_rules! mul_assign_impl {
|
|||
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||
impl MulAssign for $t {
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn mul_assign(&mut self, other: $t) { *self *= other }
|
||||
}
|
||||
)+)
|
||||
|
@ -1275,6 +1284,7 @@ macro_rules! shl_assign_impl {
|
|||
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||
impl ShlAssign<$f> for $t {
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn shl_assign(&mut self, other: $f) {
|
||||
*self <<= other
|
||||
}
|
||||
|
@ -1337,6 +1347,7 @@ macro_rules! shr_assign_impl {
|
|||
#[stable(feature = "op_assign_traits", since = "1.8.0")]
|
||||
impl ShrAssign<$f> for $t {
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
fn shr_assign(&mut self, other: $f) {
|
||||
*self >>= other
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue