about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-02-20 10:49:12 +0100
committerGitHub <noreply@github.com>2020-02-20 10:49:12 +0100
commitd96951f5543869567e30ab1c63c0ac44d0d74c30 (patch)
tree0820b7f10d8c88a997a1df000f7ffbfe02546019 /src/libstd/sys/unix/stack_overflow.rs
parent588f00841b430b12b39fb75d778bd670df8c59f5 (diff)
parent7fe5eaf7d8cb23ceb71d8e509be13d20ef836114 (diff)
downloadrust-d96951f5543869567e30ab1c63c0ac44d0d74c30.tar.gz
rust-d96951f5543869567e30ab1c63c0ac44d0d74c30.zip
Rollup merge of #68978 - ecstatic-morse:const-int-pow, r=oli-obk
Make integer exponentiation methods unstably const

cc #53718

This makes the following inherent methods on integer primitives into unstable `const fn`:
- `pow`
- `checked_pow`
- `wrapping_pow`
- `overflowing_pow`
- `saturating_pow`
- `next_power_of_two`
- `checked_next_power_of_two`
- `wrapping_next_power_of_two`

Only two changes were made to the implementation of these methods. First, I had to switch from the `?` operator, which is not yet implemented in a const context, to a `try_opt` macro. Second, `next_power_of_two` was using `ops::Add::add` (see the first commit) to "get overflow checks", so I switched to `#[rustc_inherit_overflow_checks]`. I'm not quite sure why the attribute wasn't used in the first place.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions