Skip to content

Commit 896533d

Browse files
pub use std::simd::StdFloat;
Make available the remaining float intrinsics that require runtime support from a platform's libm, and thus cannot be included in a no-deps libcore, by exposing them through a sealed trait, `std::simd::StdFloat`. We might use the trait approach a bit more in the future, or maybe not. Ideally, this trait doesn't stick around, even if so. If we don't need to intermesh it with std, it can be used as a crate, but currently that is somewhat uncertain.
1 parent 80c881f commit 896533d

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

std/src/lib.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@
313313
#![feature(panic_internals)]
314314
#![feature(panic_unwind)]
315315
#![feature(pin_static_ref)]
316+
#![feature(platform_intrinsics)]
316317
#![feature(portable_simd)]
317318
#![feature(prelude_import)]
318319
#![feature(ptr_as_uninit)]
@@ -465,8 +466,6 @@ pub use core::pin;
465466
pub use core::ptr;
466467
#[stable(feature = "rust1", since = "1.0.0")]
467468
pub use core::result;
468-
#[unstable(feature = "portable_simd", issue = "86656")]
469-
pub use core::simd;
470469
#[unstable(feature = "async_stream", issue = "79024")]
471470
pub use core::stream;
472471
#[stable(feature = "i128", since = "1.26.0")]
@@ -513,6 +512,25 @@ pub mod time;
513512
#[unstable(feature = "once_cell", issue = "74465")]
514513
pub mod lazy;
515514

515+
// Pull in `std_float` crate into libstd. The contents of
516+
// `std_float` are in a different repository: rust-lang/portable-simd.
517+
#[path = "../../portable-simd/crates/std_float/src/lib.rs"]
518+
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
519+
#[allow(rustdoc::bare_urls)]
520+
#[unstable(feature = "portable_simd", issue = "86656")]
521+
#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
522+
mod std_float;
523+
524+
#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
525+
#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
526+
#[unstable(feature = "portable_simd", issue = "86656")]
527+
pub mod simd {
528+
#[doc(inline)]
529+
pub use crate::std_float::StdFloat;
530+
#[doc(inline)]
531+
pub use core::simd::*;
532+
}
533+
516534
#[stable(feature = "futures_api", since = "1.36.0")]
517535
pub mod task {
518536
//! Types and Traits for working with asynchronous tasks.

0 commit comments

Comments
 (0)