From 2fb3a1871bc95dbaf9a19a4bab0e7f0d042d209c Mon Sep 17 00:00:00 2001 From: ltdk Date: Wed, 17 Sep 2025 14:07:23 -0400 Subject: [PATCH 1/3] Mark float intrinsics with no preconditions as safe --- libm/src/math/support/float_traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libm/src/math/support/float_traits.rs b/libm/src/math/support/float_traits.rs index fb790e696..b5ee6413d 100644 --- a/libm/src/math/support/float_traits.rs +++ b/libm/src/math/support/float_traits.rs @@ -289,7 +289,7 @@ macro_rules! float_impl { cfg_if! { // fma is not yet available in `core` if #[cfg(intrinsics_enabled)] { - unsafe{ core::intrinsics::$fma_intrinsic(self, y, z) } + core::intrinsics::$fma_intrinsic(self, y, z) } else { super::super::$fma_fn(self, y, z) } From dd9ea5343dae811c12c02fdae8bd01484c51f841 Mon Sep 17 00:00:00 2001 From: The rustc-josh-sync Cronjob Bot Date: Thu, 25 Sep 2025 04:12:30 +0000 Subject: [PATCH 2/3] Prepare for merging from rust-lang/rust This updates the rust-version file to caccb4d0368bd918ef6668af8e13834d07040417. --- rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-version b/rust-version index 7420b6200..8854fb959 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -9385c64c95d971329e62917adc4349c8ccdbafe0 +caccb4d0368bd918ef6668af8e13834d07040417 From 82a32c6bd1b82b55de5aea0cddb707732b54855f Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 25 Sep 2025 19:58:00 +0000 Subject: [PATCH 3/3] Add back the `unsafe` for `intrinsics::fma` but `allow(unused_unsafe)` Rustc commit 055e05a338af / builtins commit 2fb3a1871bc9 ("Mark float intrinsics with no preconditions as safe") changed `fma` and other intrinsics to not be unsafe to call. Unfortunately we can't remove the `unsafe` just yet since the rustc we pin for benchmarks is older than this. Add back `unsafe` but allow it to be unused. --- libm/src/math/support/float_traits.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libm/src/math/support/float_traits.rs b/libm/src/math/support/float_traits.rs index b5ee6413d..4e5011f62 100644 --- a/libm/src/math/support/float_traits.rs +++ b/libm/src/math/support/float_traits.rs @@ -289,7 +289,10 @@ macro_rules! float_impl { cfg_if! { // fma is not yet available in `core` if #[cfg(intrinsics_enabled)] { - core::intrinsics::$fma_intrinsic(self, y, z) + // FIXME(msrv,bench): once our benchmark rustc version is above the + // 2022-09-23 nightly, this can be removed. + #[allow(unused_unsafe)] + unsafe { core::intrinsics::$fma_intrinsic(self, y, z) } } else { super::super::$fma_fn(self, y, z) }