$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[rustc_const_unstable(feature = "const_int_checked", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn checked_div(self, rhs: Self) -> Option<Self> {
+ pub const fn checked_div(self, rhs: Self) -> Option<Self> {
if rhs == 0 || (self == Self::min_value() && rhs == -1) {
None
} else {
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[rustc_const_unstable(feature = "const_int_checked", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn checked_rem(self, rhs: Self) -> Option<Self> {
+ pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
if rhs == 0 || (self == Self::min_value() && rhs == -1) {
None
} else {
assert_eq!(1", stringify!($SelfT), ".checked_div(0), None);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[rustc_const_unstable(feature = "const_int_checked", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn checked_div(self, rhs: Self) -> Option<Self> {
+ pub const fn checked_div(self, rhs: Self) -> Option<Self> {
match rhs {
0 => None,
// SAFETY: div by zero has been checked above and unsigned types have no other
assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[rustc_const_unstable(feature = "const_int_checked", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- pub fn checked_rem(self, rhs: Self) -> Option<Self> {
+ pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
if rhs == 0 {
None
} else {