Michael Goulet
2f3f001423
Rollup merge of #130568 - eduardosm:const-float-methods, r=RalfJung,tgross35
Make some float methods unstable `const fn`
Some float methods are now `const fn` under the `const_float_methods` feature gate.
I also made some unstable methods `const fn`, keeping their constness under their respective feature gate.
In order to support `min`, `max`, `abs` and `copysign`, the implementation of some intrinsics had to be moved from Miri to rustc_const_eval (cc `@RalfJung).`
Tracking issue: https://github.com/rust-lang/rust/issues/130843
```rust
impl <float> {
// #[feature(const_float_methods)]
pub const fn recip(self) -> Self;
pub const fn to_degrees(self) -> Self;
pub const fn to_radians(self) -> Self;
pub const fn max(self, other: Self) -> Self;
pub const fn min(self, other: Self) -> Self;
pub const fn clamp(self, min: Self, max: Self) -> Self;
pub const fn abs(self) -> Self;
pub const fn signum(self) -> Self;
pub const fn copysign(self, sign: Self) -> Self;
// #[feature(float_minimum_maximum)]
pub const fn maximum(self, other: Self) -> Self;
pub const fn minimum(self, other: Self) -> Self;
// Only f16/f128 (f32/f64 already const)
pub const fn is_sign_positive(self) -> bool;
pub const fn is_sign_negative(self) -> bool;
pub const fn next_up(self) -> Self;
pub const fn next_down(self) -> Self;
}
```
r? libs-api
try-job: dist-s390x-linux
2024-10-15 12:33:35 -04:00
..
2024-09-30 20:58:37 +02:00
2024-10-15 10:46:33 +02:00
2024-09-14 18:07:06 +02:00
2024-09-26 13:21:15 +02:00
2024-09-15 09:51:32 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2024-08-22 02:20:05 +00:00
2024-09-15 10:20:47 +02:00
2024-09-13 14:10:56 +03:00
2024-09-15 09:51:32 +02:00
2024-08-22 08:25:54 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2024-09-27 21:35:08 +02:00
2024-09-27 21:35:08 +02:00
2024-09-26 13:21:15 +02:00
2024-09-15 10:20:47 +02:00
2024-09-15 09:51:32 +02:00
2024-08-18 19:46:53 +02:00
2024-08-01 14:25:19 +02:00
2024-07-27 21:12:54 +02:00
2024-07-24 16:00:48 +00:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 10:20:47 +02:00
2024-09-15 10:20:47 +02:00
2024-09-15 10:20:47 +02:00
2024-09-08 19:07:46 +02:00
2024-09-08 19:07:46 +02:00
2024-09-26 13:21:15 +02:00
2024-09-15 10:20:47 +02:00
2024-09-15 10:20:47 +02:00
2024-10-12 17:07:13 -04:00
2024-10-12 17:07:13 -04:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 10:20:47 +02:00
2024-09-15 10:20:47 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2024-09-12 13:56:01 -04:00
2024-09-15 09:51:32 +02:00
2024-10-06 19:58:35 -04:00
2024-10-06 19:58:35 -04:00
2024-09-29 23:40:43 -05:00
2024-09-29 23:40:43 -05:00
2024-09-20 20:26:20 -04:00
2024-09-20 20:26:20 -04:00
2024-10-07 16:29:52 +00:00
2024-10-12 00:02:36 -07:00
2024-09-04 20:06:33 +02:00
2024-09-04 20:06:33 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2024-08-01 14:25:19 +02:00
2024-08-01 14:25:19 +02:00
2024-08-01 14:25:19 +02:00
2024-08-01 14:38:58 +02:00
2024-08-19 21:39:57 +02:00
2024-08-19 21:39:57 +02:00
2024-08-25 13:49:16 +02:00
2024-08-25 13:49:16 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 10:20:47 +02:00
2024-09-15 10:20:47 +02:00
2024-10-04 14:06:48 +02:00
2024-09-14 10:00:07 +02:00
2024-09-14 10:00:07 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-13 14:10:56 +03:00
2024-09-30 20:58:37 +02:00
2024-09-30 20:58:37 +02:00
2024-09-14 18:07:06 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00
2024-09-15 09:51:32 +02:00