1
Fork 0

Auto merge of #80962 - jhpratt:const_int_fn-stabilization, r=dtolnay

Stabilize remaining integer methods as `const fn`

This pull request stabilizes the following methods as `const fn`:

- `i*::checked_div`
- `i*::checked_div_euclid`
- `i*::checked_rem`
- `i*::checked_rem_euclid`
- `i*::div_euclid`
- `i*::overflowing_div`
- `i*::overflowing_div_euclid`
- `i*::overflowing_rem`
- `i*::overflowing_rem_euclid`
- `i*::rem_euclid`
- `i*::wrapping_div`
- `i*::wrapping_div_euclid`
- `i*::wrapping_rem`
- `i*::wrapping_rem_euclid`
- `u*::checked_div`
- `u*::checked_div_euclid`
- `u*::checked_rem`
- `u*::checked_rem_euclid`
- `u*::div_euclid`
- `u*::overflowing_div`
- `u*::overflowing_div_euclid`
- `u*::overflowing_rem`
- `u*::overflowing_rem_euclid`
- `u*::rem_euclid`
- `u*::wrapping_div`
- `u*::wrapping_div_euclid`
- `u*::wrapping_rem`
- `u*::wrapping_rem_euclid`

These can all be implemented on the current stable (1.49). There are two unstable details: const likely/unlikely and unchecked division/remainder. Both of these are for optimizations, and are in no way required to make the methods function; there is no exposure of these details publicly. Per comments below, it seems best practice is to stabilize the intrinsics. As such, `intrinsics::unchecked_div` and `intrinsics::unchecked_rem` have been stabilized as `const` as part of this pull request as well. The methods themselves remain unstable.

I believe part of the reason these were not stabilized previously was the behavior around division by 0 and modulo 0. After testing on nightly, the diagnostic for something like `const _: i8 = 5i8 % 0i8;` is similar to that of `const _: i8 = 5i8.rem_euclid(0i8);` (assuming the appropriate feature flag is enabled). As such, I believe these methods are ready to be stabilized as `const fn`.

This pull request represents the final methods mentioned in #53718. As such, this PR closes #53718.

`@rustbot` modify labels to +A-const-fn, +T-libs
This commit is contained in:
bors 2021-02-08 05:05:55 +00:00
commit 4940dd483a
5 changed files with 30 additions and 38 deletions

View file

@ -1586,7 +1586,7 @@ extern "rust-intrinsic" {
/// Safe wrappers for this intrinsic are available on the integer /// Safe wrappers for this intrinsic are available on the integer
/// primitives via the `checked_div` method. For example, /// primitives via the `checked_div` method. For example,
/// [`u32::checked_div`] /// [`u32::checked_div`]
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")] #[rustc_const_stable(feature = "const_int_unchecked_arith", since = "1.51.0")]
pub fn unchecked_div<T: Copy>(x: T, y: T) -> T; pub fn unchecked_div<T: Copy>(x: T, y: T) -> T;
/// Returns the remainder of an unchecked division, resulting in /// Returns the remainder of an unchecked division, resulting in
/// undefined behavior when `y == 0` or `x == T::MIN && y == -1` /// undefined behavior when `y == 0` or `x == T::MIN && y == -1`
@ -1594,7 +1594,7 @@ extern "rust-intrinsic" {
/// Safe wrappers for this intrinsic are available on the integer /// Safe wrappers for this intrinsic are available on the integer
/// primitives via the `checked_rem` method. For example, /// primitives via the `checked_rem` method. For example,
/// [`u32::checked_rem`] /// [`u32::checked_rem`]
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")] #[rustc_const_stable(feature = "const_int_unchecked_arith", since = "1.51.0")]
pub fn unchecked_rem<T: Copy>(x: T, y: T) -> T; pub fn unchecked_rem<T: Copy>(x: T, y: T) -> T;
/// Performs an unchecked left shift, resulting in undefined behavior when /// Performs an unchecked left shift, resulting in undefined behavior when

View file

@ -73,11 +73,8 @@
#![feature(const_discriminant)] #![feature(const_discriminant)]
#![feature(const_cell_into_inner)] #![feature(const_cell_into_inner)]
#![feature(const_intrinsic_copy)] #![feature(const_intrinsic_copy)]
#![feature(const_checked_int_methods)]
#![feature(const_euclidean_int_methods)]
#![feature(const_float_classify)] #![feature(const_float_classify)]
#![feature(const_float_bits_conv)] #![feature(const_float_bits_conv)]
#![feature(const_overflowing_int_methods)]
#![feature(const_int_unchecked_arith)] #![feature(const_int_unchecked_arith)]
#![feature(const_mut_refs)] #![feature(const_mut_refs)]
#![feature(const_cttz)] #![feature(const_cttz)]

View file

@ -513,7 +513,7 @@ macro_rules! int_impl {
#[doc = concat!("assert_eq!((1", stringify!($SelfT), ").checked_div(0), None);")] #[doc = concat!("assert_eq!((1", stringify!($SelfT), ").checked_div(0), None);")]
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -539,7 +539,7 @@ macro_rules! int_impl {
#[doc = concat!("assert_eq!((1", stringify!($SelfT), ").checked_div_euclid(0), None);")] #[doc = concat!("assert_eq!((1", stringify!($SelfT), ").checked_div_euclid(0), None);")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -565,7 +565,7 @@ macro_rules! int_impl {
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_rem(-1), None);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_rem(-1), None);")]
/// ``` /// ```
#[stable(feature = "wrapping", since = "1.7.0")] #[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -591,7 +591,7 @@ macro_rules! int_impl {
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_rem_euclid(-1), None);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_rem_euclid(-1), None);")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -949,7 +949,7 @@ macro_rules! int_impl {
/// assert_eq!((-128i8).wrapping_div(-1), -128); /// assert_eq!((-128i8).wrapping_div(-1), -128);
/// ``` /// ```
#[stable(feature = "num_wrapping", since = "1.2.0")] #[stable(feature = "num_wrapping", since = "1.2.0")]
#[rustc_const_unstable(feature = "const_wrapping_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_wrapping_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -977,7 +977,7 @@ macro_rules! int_impl {
/// assert_eq!((-128i8).wrapping_div_euclid(-1), -128); /// assert_eq!((-128i8).wrapping_div_euclid(-1), -128);
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -1005,7 +1005,7 @@ macro_rules! int_impl {
/// assert_eq!((-128i8).wrapping_rem(-1), 0); /// assert_eq!((-128i8).wrapping_rem(-1), 0);
/// ``` /// ```
#[stable(feature = "num_wrapping", since = "1.2.0")] #[stable(feature = "num_wrapping", since = "1.2.0")]
#[rustc_const_unstable(feature = "const_wrapping_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_wrapping_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -1032,7 +1032,7 @@ macro_rules! int_impl {
/// assert_eq!((-128i8).wrapping_rem_euclid(-1), 0); /// assert_eq!((-128i8).wrapping_rem_euclid(-1), 0);
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -1299,7 +1299,7 @@ macro_rules! int_impl {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "wrapping", since = "1.7.0")] #[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_unstable(feature = "const_overflowing_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_overflowing_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool) { pub const fn overflowing_div(self, rhs: Self) -> (Self, bool) {
@ -1329,7 +1329,7 @@ macro_rules! int_impl {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) { pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
@ -1360,7 +1360,7 @@ macro_rules! int_impl {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "wrapping", since = "1.7.0")] #[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_unstable(feature = "const_overflowing_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_overflowing_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
pub const fn overflowing_rem(self, rhs: Self) -> (Self, bool) { pub const fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
@ -1390,7 +1390,7 @@ macro_rules! int_impl {
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem_euclid(-1), (0, true));")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem_euclid(-1), (0, true));")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -1615,7 +1615,7 @@ macro_rules! int_impl {
/// assert_eq!((-a).div_euclid(-b), 2); // -7 >= -4 * 2 /// assert_eq!((-a).div_euclid(-b), 2); // -7 >= -4 * 2
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -1653,7 +1653,7 @@ macro_rules! int_impl {
/// assert_eq!((-a).rem_euclid(-b), 1); /// assert_eq!((-a).rem_euclid(-b), 1);
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]

View file

@ -522,7 +522,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".checked_div(0), None);")] #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".checked_div(0), None);")]
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -548,7 +548,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".checked_div_euclid(0), None);")] #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".checked_div_euclid(0), None);")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -573,7 +573,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);")] #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);")]
/// ``` /// ```
#[stable(feature = "wrapping", since = "1.7.0")] #[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -599,7 +599,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(0), None);")] #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(0), None);")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -876,7 +876,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_div(10), 10);")] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_div(10), 10);")]
/// ``` /// ```
#[stable(feature = "num_wrapping", since = "1.2.0")] #[stable(feature = "num_wrapping", since = "1.2.0")]
#[rustc_const_unstable(feature = "const_wrapping_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_wrapping_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -901,7 +901,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_div_euclid(10), 10);")] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_div_euclid(10), 10);")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -924,7 +924,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_rem(10), 0);")] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_rem(10), 0);")]
/// ``` /// ```
#[stable(feature = "num_wrapping", since = "1.2.0")] #[stable(feature = "num_wrapping", since = "1.2.0")]
#[rustc_const_unstable(feature = "const_wrapping_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_wrapping_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -950,7 +950,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0);")] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0);")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -1185,7 +1185,7 @@ macro_rules! uint_impl {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "wrapping", since = "1.7.0")] #[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_unstable(feature = "const_overflowing_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_overflowing_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool) { pub const fn overflowing_div(self, rhs: Self) -> (Self, bool) {
@ -1215,7 +1215,7 @@ macro_rules! uint_impl {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) { pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
@ -1242,7 +1242,7 @@ macro_rules! uint_impl {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "wrapping", since = "1.7.0")] #[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_unstable(feature = "const_overflowing_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_overflowing_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
pub const fn overflowing_rem(self, rhs: Self) -> (Self, bool) { pub const fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
@ -1272,7 +1272,7 @@ macro_rules! uint_impl {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
pub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) { pub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
@ -1456,7 +1456,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(7", stringify!($SelfT), ".div_euclid(4), 1); // or any other integer type")] #[doc = concat!("assert_eq!(7", stringify!($SelfT), ".div_euclid(4), 1); // or any other integer type")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -1484,7 +1484,7 @@ macro_rules! uint_impl {
#[doc = concat!("assert_eq!(7", stringify!($SelfT), ".rem_euclid(4), 3); // or any other integer type")] #[doc = concat!("assert_eq!(7", stringify!($SelfT), ".rem_euclid(4), 3); // or any other integer type")]
/// ``` /// ```
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_unstable(feature = "const_euclidean_int_methods", issue = "53718")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.51.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]

View file

@ -1,10 +1,5 @@
// run-pass // run-pass
#![feature(const_checked_int_methods)]
#![feature(const_euclidean_int_methods)]
#![feature(const_overflowing_int_methods)]
#![feature(const_wrapping_int_methods)]
macro_rules! suite { macro_rules! suite {
($( ($(
$fn:ident -> $ty:ty { $( $label:ident : $expr:expr, $result:expr; )* } $fn:ident -> $ty:ty { $( $label:ident : $expr:expr, $result:expr; )* }