assert_eq!((1", stringify!($SelfT), ").checked_div_euclid(0), None);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn checked_div_euclid(self, rhs: Self) -> Option<Self> {
+ pub const fn checked_div_euclid(self, rhs: Self) -> Option<Self> {
if rhs == 0 || (self == Self::min_value() && rhs == -1) {
None
} else {
assert_eq!(", stringify!($SelfT), "::MIN.checked_rem_euclid(-1), None);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn checked_rem_euclid(self, rhs: Self) -> Option<Self> {
+ pub const fn checked_rem_euclid(self, rhs: Self) -> Option<Self> {
if rhs == 0 || (self == Self::min_value() && rhs == -1) {
None
} else {
assert_eq!((-128i8).wrapping_div_euclid(-1), -128);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn wrapping_div_euclid(self, rhs: Self) -> Self {
+ pub const fn wrapping_div_euclid(self, rhs: Self) -> Self {
self.overflowing_div_euclid(rhs).0
}
}
assert_eq!((-128i8).wrapping_rem_euclid(-1), 0);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn wrapping_rem_euclid(self, rhs: Self) -> Self {
+ pub const fn wrapping_rem_euclid(self, rhs: Self) -> Self {
self.overflowing_rem_euclid(rhs).0
}
}
```"),
#[inline]
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
- pub fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
+ pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
if self == Self::min_value() && rhs == -1 {
(self, true)
} else {
assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem_euclid(-1), (0, true));
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
+ pub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
if self == Self::min_value() && rhs == -1 {
(0, true)
} else {
assert_eq!((-a).div_euclid(-b), 2); // -7 >= -4 * 2
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[rustc_inherit_overflow_checks]
- pub fn div_euclid(self, rhs: Self) -> Self {
+ pub const fn div_euclid(self, rhs: Self) -> Self {
let q = self / rhs;
if self % rhs < 0 {
return if rhs > 0 { q - 1 } else { q + 1 }
assert_eq!((-a).rem_euclid(-b), 1);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[rustc_inherit_overflow_checks]
- pub fn rem_euclid(self, rhs: Self) -> Self {
+ pub const fn rem_euclid(self, rhs: Self) -> Self {
let r = self % rhs;
if r < 0 {
if rhs < 0 {
assert_eq!(1", stringify!($SelfT), ".checked_div_euclid(0), None);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn checked_div_euclid(self, rhs: Self) -> Option<Self> {
+ pub const fn checked_div_euclid(self, rhs: Self) -> Option<Self> {
if rhs == 0 {
None
} else {
assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(0), None);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn checked_rem_euclid(self, rhs: Self) -> Option<Self> {
+ pub const fn checked_rem_euclid(self, rhs: Self) -> Option<Self> {
if rhs == 0 {
None
} else {
assert_eq!(100", stringify!($SelfT), ".wrapping_div_euclid(10), 10);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn wrapping_div_euclid(self, rhs: Self) -> Self {
+ pub const fn wrapping_div_euclid(self, rhs: Self) -> Self {
self / rhs
}
}
assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0);
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn wrapping_rem_euclid(self, rhs: Self) -> Self {
+ pub const fn wrapping_rem_euclid(self, rhs: Self) -> Self {
self % rhs
}
}
```"),
#[inline]
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
- pub fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
+ pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
(self / rhs, false)
}
}
```"),
#[inline]
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
- pub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
+ pub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
(self % rhs, false)
}
}
assert_eq!(7", stringify!($SelfT), ".div_euclid(4), 1); // or any other integer type
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[rustc_inherit_overflow_checks]
- pub fn div_euclid(self, rhs: Self) -> Self {
+ pub const fn div_euclid(self, rhs: Self) -> Self {
self / rhs
}
}
assert_eq!(7", stringify!($SelfT), ".rem_euclid(4), 3); // or any other integer type
```"),
#[stable(feature = "euclidean_division", since = "1.38.0")]
+ #[rustc_const_unstable(feature = "const_int_euclidean", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[rustc_inherit_overflow_checks]
- pub fn rem_euclid(self, rhs: Self) -> Self {
+ pub const fn rem_euclid(self, rhs: Self) -> Self {
self % rhs
}
}