rust/src/libcore
Dylan DPC 16555ac861
Rollup merge of #68809 - ecstatic-morse:const-int-functions, r=oli-obk
Make more arithmetic functions unstably const

This is a smaller version of #66884 (thanks @9999years) that constifies many of the arithmetic functions on integer primitives from #53718 that were blocked on #49146.

This makes the following things unstably const.

- `feature = const_int_unchecked_arith`
  - `intrinsics::unchecked_add`
  - `intrinsics::unchecked_sub`
  - `intrinsics::unchecked_mul`
  - `intrinsics::unchecked_div`
  - `intrinsics::unchecked_rem`

- `feature = const_checked_int_methods`
  - `checked_add`
  - `checked_sub`
  - `checked_mul`
  - `checked_div` (Uses `intrinsics::unchecked_div` internally)
  - `checked_rem` (Uses `intrinsics::unchecked_rem` internally)
  - `checked_neg`
  - `checked_shl`
  - `checked_shr`
  - `checked_abs`

- `feature = const_saturating_int_methods`
  - `saturating_mul`
  - `saturating_neg`  (Uses `intrinsics::unchecked_sub` internally)
  - `saturating_abs` (Uses `intrinsics::unchecked_sub` internally)

- `feature = const_wrapping_int_methods`
  - `wrapping_div`
  - `wrapping_rem`

- `feature = const_overflowing_int_methods`
  - `overflowing_div`
  - `overflowing_rem`

- `feature = const_euclidean_int_methods`
  - `checked_div_euclid`
  - `checked_rem_euclid`
  - `wrapping_div_euclid`
  - `wrapping_rem_euclid`
  - `overflowing_div_euclid`
  - `overflowing_rem_euclid`

Exponentiation and operations on the `NonZero` types are left to a later PR.

r? @oli-obk
cc @rust-lang/wg-const-eval @rust-lang/libs
2020-02-05 13:14:28 +01:00
..
array Format the world 2019-12-22 17:42:47 -05:00
benches Format the world 2019-12-22 17:42:47 -05:00
char Replace old tables with new unicode data 2020-01-14 19:11:28 -05:00
convert Use Self instead of $type 2020-01-06 04:33:31 +00:00
fmt Drop cfg(bootstrap) code 2020-01-31 12:31:09 -05:00
future Revert "core: add IntoFuture trait and support for await" 2019-12-31 19:18:08 -05:00
hash Require issue = "none" over issue = "0" in unstable attributes 2019-12-21 13:16:18 +02:00
iter Remove Copy impl from OnceWith 2020-02-03 22:30:17 +00:00
macros macros: typo fix 2020-01-06 01:55:24 +00:00
mem stabalize ManuallyDrop::take 2020-01-09 13:32:10 -05:00
num Use consistent feature naming 2020-02-04 20:36:18 -08:00
ops Convert collapsed to shortcut reference links 2019-12-26 05:27:55 -08:00
prelude Format libcore with rustfmt 2019-11-26 23:02:11 -08:00
ptr Optimize core::ptr::align_offset 2020-02-03 01:03:33 +01:00
slice Use NonNull in slice::Iter and slice::IterMut. 2019-12-26 20:18:31 +01:00
str Fix formatting: ./x.py fmt 2020-01-16 18:50:53 -08:00
sync Add SAFETY comment for atomic example 2020-01-16 19:26:02 -08:00
task Use matches macro in libcore and libstd 2020-01-08 07:10:28 +03:00
tests Auto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbini 2020-02-04 14:16:18 +00:00
unicode Replace old tables with new unicode data 2020-01-14 19:11:28 -05:00
alloc.rs Remove Alloc in favor of AllocRef 2020-02-01 18:40:12 +01:00
any.rs Minor: note why we can rely on Any trait for safety 2020-01-28 20:53:45 -05:00
ascii.rs Format libcore with rustfmt 2019-11-26 23:02:11 -08:00
bool.rs Format libcore with rustfmt (including tests and benches) 2019-12-06 20:20:51 -08:00
borrow.rs Format the world 2019-12-22 17:42:47 -05:00
Cargo.toml Move the matches! macro to the prelude 2019-10-23 15:35:36 +02:00
cell.rs Elaborate on SAFETY comments 2020-01-16 18:32:21 -08:00
clone.rs Require issue = "none" over issue = "0" in unstable attributes 2019-12-21 13:16:18 +02:00
cmp.rs Add missing links for cmp traits 2020-01-30 13:58:33 +01:00
default.rs Format libcore with rustfmt 2019-11-26 23:02:11 -08:00
ffi.rs Require issue = "none" over issue = "0" in unstable attributes 2019-12-21 13:16:18 +02:00
hint.rs Format libcore with rustfmt (including tests and benches) 2019-12-06 20:20:51 -08:00
internal_macros.rs Require issue = "none" over issue = "0" in unstable attributes 2019-12-21 13:16:18 +02:00
intrinsics.rs Const-stabilize some arithmetic intrinsics 2020-02-04 11:04:04 -08:00
lib.rs Use consistent feature naming 2020-02-04 20:36:18 -08:00
marker.rs Use Self instead of $type 2020-01-06 04:33:31 +00:00
option.rs Update option.rs 2020-02-01 19:05:50 +02:00
panic.rs Format the world 2019-12-22 17:42:47 -05:00
panicking.rs core and std macros and panic internals use panic::Location::caller. 2020-01-04 10:02:17 -08:00
pin.rs Relax the Sized bounds on Pin::map_unchecked(_mut) 2020-01-06 15:41:09 +01:00
raw.rs Fix more tests after revert of rustdoc cfg(test) feature 2019-06-09 18:15:53 +01:00
result.rs use diagnostic_item and modify wording 2020-01-23 11:51:56 -08:00
time.rs no longer promote non-pattern const functions 2019-12-22 18:37:22 +01:00
tuple.rs Format libcore with rustfmt 2019-11-26 23:02:11 -08:00
unit.rs Format libcore with rustfmt 2019-11-26 23:02:11 -08:00