diff options
| author | bors <bors@rust-lang.org> | 2021-02-08 05:05:55 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-02-08 05:05:55 +0000 | 
| commit | 4940dd483a8448c0f1ef28d304fad88a9d983c4e (patch) | |
| tree | 51a540860b706b2e0d27ca468d3f2bf6fbaab453 /src/test/ui/numeric/numeric-fields.stderr | |
| parent | 0b7a598e12649d7ab2415a82cbc3fea879fa9dab (diff) | |
| parent | f55029ab04e0d416db24af9b537be26e808f6f59 (diff) | |
| download | rust-4940dd483a8448c0f1ef28d304fad88a9d983c4e.tar.gz rust-4940dd483a8448c0f1ef28d304fad88a9d983c4e.zip  | |
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
Diffstat (limited to 'src/test/ui/numeric/numeric-fields.stderr')
0 files changed, 0 insertions, 0 deletions
