Skip to content

Commit 9cb0dae

Browse files
authored
Unrolled build for #148052
Rollup merge of #148052 - tgross35:stabilize-const_mul_add, r=RalfJung Stabilize `const_mul_add` Newly stable API: ```rust impl {f32, f64} { pub const fn mul_add(self, a: Self, b: Self) -> Self; } ``` This includes making the intrinsics `fmaf{16,32,64,128}` const stable for indirect use, matching similar intrinsics. Closes: #146724
2 parents a9ac706 + 033711c commit 9cb0dae

File tree

9 files changed

+6
-8
lines changed

9 files changed

+6
-8
lines changed

library/core/src/intrinsics/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,27 +1310,31 @@ pub fn log2f128(x: f128) -> f128;
13101310
///
13111311
/// The stabilized version of this intrinsic is
13121312
/// [`f16::mul_add`](../../std/primitive.f16.html#method.mul_add)
1313+
#[rustc_intrinsic_const_stable_indirect]
13131314
#[rustc_intrinsic]
13141315
#[rustc_nounwind]
13151316
pub const fn fmaf16(a: f16, b: f16, c: f16) -> f16;
13161317
/// Returns `a * b + c` for `f32` values.
13171318
///
13181319
/// The stabilized version of this intrinsic is
13191320
/// [`f32::mul_add`](../../std/primitive.f32.html#method.mul_add)
1321+
#[rustc_intrinsic_const_stable_indirect]
13201322
#[rustc_intrinsic]
13211323
#[rustc_nounwind]
13221324
pub const fn fmaf32(a: f32, b: f32, c: f32) -> f32;
13231325
/// Returns `a * b + c` for `f64` values.
13241326
///
13251327
/// The stabilized version of this intrinsic is
13261328
/// [`f64::mul_add`](../../std/primitive.f64.html#method.mul_add)
1329+
#[rustc_intrinsic_const_stable_indirect]
13271330
#[rustc_intrinsic]
13281331
#[rustc_nounwind]
13291332
pub const fn fmaf64(a: f64, b: f64, c: f64) -> f64;
13301333
/// Returns `a * b + c` for `f128` values.
13311334
///
13321335
/// The stabilized version of this intrinsic is
13331336
/// [`f128::mul_add`](../../std/primitive.f128.html#method.mul_add)
1337+
#[rustc_intrinsic_const_stable_indirect]
13341338
#[rustc_intrinsic]
13351339
#[rustc_nounwind]
13361340
pub const fn fmaf128(a: f128, b: f128, c: f128) -> f128;

library/core/src/num/f128.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,6 @@ impl f128 {
17091709
#[doc(alias = "fmaf128", alias = "fusedMultiplyAdd")]
17101710
#[unstable(feature = "f128", issue = "116909")]
17111711
#[must_use = "method returns a new number and does not mutate the original value"]
1712-
#[rustc_const_unstable(feature = "const_mul_add", issue = "146724")]
17131712
pub const fn mul_add(self, a: f128, b: f128) -> f128 {
17141713
intrinsics::fmaf128(self, a, b)
17151714
}

library/core/src/num/f16.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,6 @@ impl f16 {
16841684
#[unstable(feature = "f16", issue = "116909")]
16851685
#[doc(alias = "fmaf16", alias = "fusedMultiplyAdd")]
16861686
#[must_use = "method returns a new number and does not mutate the original value"]
1687-
#[rustc_const_unstable(feature = "const_mul_add", issue = "146724")]
16881687
pub const fn mul_add(self, a: f16, b: f16) -> f16 {
16891688
intrinsics::fmaf16(self, a, b)
16901689
}

library/core/src/num/f32.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,6 @@ pub mod math {
18451845
#[doc(alias = "fmaf", alias = "fusedMultiplyAdd")]
18461846
#[must_use = "method returns a new number and does not mutate the original value"]
18471847
#[unstable(feature = "core_float_math", issue = "137578")]
1848-
#[rustc_const_unstable(feature = "const_mul_add", issue = "146724")]
18491848
pub const fn mul_add(x: f32, y: f32, z: f32) -> f32 {
18501849
intrinsics::fmaf32(x, y, z)
18511850
}

library/core/src/num/f64.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,6 @@ pub mod math {
18431843
#[doc(alias = "fma", alias = "fusedMultiplyAdd")]
18441844
#[unstable(feature = "core_float_math", issue = "137578")]
18451845
#[must_use = "method returns a new number and does not mutate the original value"]
1846-
#[rustc_const_unstable(feature = "const_mul_add", issue = "146724")]
18471846
pub const fn mul_add(x: f64, a: f64, b: f64) -> f64 {
18481847
intrinsics::fmaf64(x, a, b)
18491848
}

library/coretests/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(const_destruct)]
2525
#![feature(const_drop_in_place)]
2626
#![feature(const_eval_select)]
27-
#![feature(const_mul_add)]
2827
#![feature(const_ops)]
2928
#![feature(const_option_ops)]
3029
#![feature(const_ref_cell)]

library/std/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@
323323
#![feature(char_internals)]
324324
#![feature(clone_to_uninit)]
325325
#![feature(const_convert)]
326-
#![feature(const_mul_add)]
327326
#![feature(core_intrinsics)]
328327
#![feature(core_io_borrowed_buf)]
329328
#![feature(drop_guard)]

library/std/src/num/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl f32 {
217217
#[must_use = "method returns a new number and does not mutate the original value"]
218218
#[stable(feature = "rust1", since = "1.0.0")]
219219
#[inline]
220-
#[rustc_const_unstable(feature = "const_mul_add", issue = "146724")]
220+
#[rustc_const_stable(feature = "const_mul_add", since = "CURRENT_RUSTC_VERSION")]
221221
pub const fn mul_add(self, a: f32, b: f32) -> f32 {
222222
core::f32::math::mul_add(self, a, b)
223223
}

library/std/src/num/f64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl f64 {
217217
#[must_use = "method returns a new number and does not mutate the original value"]
218218
#[stable(feature = "rust1", since = "1.0.0")]
219219
#[inline]
220-
#[rustc_const_unstable(feature = "const_mul_add", issue = "146724")]
220+
#[rustc_const_stable(feature = "const_mul_add", since = "CURRENT_RUSTC_VERSION")]
221221
pub const fn mul_add(self, a: f64, b: f64) -> f64 {
222222
core::f64::math::mul_add(self, a, b)
223223
}

0 commit comments

Comments
 (0)