diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-09-25 20:31:54 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-25 20:31:54 +1000 |
| commit | 8e62f95376e40f3eb81e5f1b29cb4eb997c36fb5 (patch) | |
| tree | b2d69fb08a5da2318f88e50c6fe4fbe87400dc49 /library/std/src | |
| parent | fab06469ee33664739620ede53ed18b8c3c40644 (diff) | |
| parent | a00f24116e9bcecc8c73f9f7ec0c399964b37a92 (diff) | |
| download | rust-8e62f95376e40f3eb81e5f1b29cb4eb997c36fb5.tar.gz rust-8e62f95376e40f3eb81e5f1b29cb4eb997c36fb5.zip | |
Rollup merge of #146735 - Qelxiros:const_mul_add, r=tgross35,RalfJung
unstably constify float mul_add methods Tracking issue: rust-lang/rust#146724 r? `@tgross35`
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/lib.rs | 1 | ||||
| -rw-r--r-- | library/std/src/num/f32.rs | 3 | ||||
| -rw-r--r-- | library/std/src/num/f64.rs | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 45abd6bca8a..233e41aa345 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -332,6 +332,7 @@ #![feature(char_internals)] #![feature(clone_to_uninit)] #![feature(const_convert)] +#![feature(const_mul_add)] #![feature(core_intrinsics)] #![feature(core_io_borrowed_buf)] #![feature(drop_guard)] diff --git a/library/std/src/num/f32.rs b/library/std/src/num/f32.rs index ac1d889cc37..e7810e77e76 100644 --- a/library/std/src/num/f32.rs +++ b/library/std/src/num/f32.rs @@ -217,7 +217,8 @@ impl f32 { #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn mul_add(self, a: f32, b: f32) -> f32 { + #[rustc_const_unstable(feature = "const_mul_add", issue = "146724")] + pub const fn mul_add(self, a: f32, b: f32) -> f32 { core::f32::math::mul_add(self, a, b) } diff --git a/library/std/src/num/f64.rs b/library/std/src/num/f64.rs index 55c8593a0c0..cbebbfb1be1 100644 --- a/library/std/src/num/f64.rs +++ b/library/std/src/num/f64.rs @@ -217,7 +217,8 @@ impl f64 { #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn mul_add(self, a: f64, b: f64) -> f64 { + #[rustc_const_unstable(feature = "const_mul_add", issue = "146724")] + pub const fn mul_add(self, a: f64, b: f64) -> f64 { core::f64::math::mul_add(self, a, b) } |
