Skip to content

Commit d6889da

Browse files
committed
Add back the unsafe for intrinsics::fma but allow(unused_unsafe)
Rustc commit 055e05a338af / builtins commit 2fb3a18 ("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. (cherry picked from commit 82a32c6)
1 parent ccf3420 commit d6889da

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libm/src/math/support/float_traits.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,10 @@ macro_rules! float_impl {
289289
cfg_if! {
290290
// fma is not yet available in `core`
291291
if #[cfg(intrinsics_enabled)] {
292-
core::intrinsics::$fma_intrinsic(self, y, z)
292+
// FIXME(msrv,bench): once our benchmark rustc version is above the
293+
// 2022-09-23 nightly, this can be removed.
294+
#[allow(unused_unsafe)]
295+
unsafe { core::intrinsics::$fma_intrinsic(self, y, z) }
293296
} else {
294297
super::super::$fma_fn(self, y, z)
295298
}

0 commit comments

Comments
 (0)