From 0e673facfbd09bde540af808726181f7b4397378 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 9 Oct 2018 11:00:10 -0700 Subject: [PATCH] Add wasm intrinsics to documentation --- library/stdarch/coresimd/mod.rs | 9 +++++++-- library/stdarch/coresimd/wasm32/atomic.rs | 23 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/library/stdarch/coresimd/mod.rs b/library/stdarch/coresimd/mod.rs index 8a8a7b9a990b..295b0a989800 100644 --- a/library/stdarch/coresimd/mod.rs +++ b/library/stdarch/coresimd/mod.rs @@ -26,6 +26,7 @@ mod simd; /// * [`PowerPC`] /// * [`PowerPC64`] /// * [`NVPTX`] +/// * [`wasm32`] /// /// [`x86`]: https://rust-lang-nursery.github.io/stdsimd/x86/stdsimd/arch/index.html /// [`x86_64`]: https://rust-lang-nursery.github.io/stdsimd/x86_64/stdsimd/arch/index.html @@ -36,6 +37,7 @@ mod simd; /// [`PowerPC`]: https://rust-lang-nursery.github.io/stdsimd/powerpc/stdsimd/arch/index.html /// [`PowerPC64`]: https://rust-lang-nursery.github.io/stdsimd/powerpc64/stdsimd/arch/index.html /// [`NVPTX`]: https://rust-lang-nursery.github.io/stdsimd/nvptx/stdsimd/arch/index.html +/// [`wasm32`]: https://rust-lang-nursery.github.io/stdsimd/wasm32/stdsimd/arch/index.html #[stable(feature = "simd_arch", since = "1.27.0")] pub mod arch { /// Platform-specific intrinsics for the `x86` platform. @@ -86,6 +88,7 @@ pub mod arch { /// Platform-specific intrinsics for the `wasm32` platform. /// /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "wasm32", dox))] #[cfg(target_arch = "wasm32")] #[unstable(feature = "stdsimd", issue = "27731")] pub mod wasm32 { @@ -131,7 +134,7 @@ pub mod arch { pub mod powerpc64 { pub use coresimd::powerpc64::*; } - + /// Platform-specific intrinsics for the `NVPTX` platform. /// /// See the [module documentation](../index.html) for more details. @@ -158,7 +161,9 @@ mod aarch64; #[cfg(any(target_arch = "arm", target_arch = "aarch64", dox))] #[doc(cfg(any(target_arch = "arm", target_arch = "aarch64")))] mod arm; -#[cfg(target_arch = "wasm32")] + +#[cfg(any(target_arch = "wasm32", dox))] +#[doc(cfg(target_arch = "wasm32"))] mod wasm32; #[cfg(any(target_arch = "mips", target_arch = "mips64", dox))] diff --git a/library/stdarch/coresimd/wasm32/atomic.rs b/library/stdarch/coresimd/wasm32/atomic.rs index 3dddeaf69074..de36f9f08718 100644 --- a/library/stdarch/coresimd/wasm32/atomic.rs +++ b/library/stdarch/coresimd/wasm32/atomic.rs @@ -6,7 +6,7 @@ //! //! [spec]: https://github.com/WebAssembly/threads -#![cfg(target_feature = "atomics")] +#![cfg(any(target_feature = "atomics", dox))] #[cfg(test)] use stdsimd_test::assert_instr; @@ -43,6 +43,13 @@ extern "C" { /// didn't block /// * 2 - the thread blocked, but the timeout expired. /// +/// # Availability +/// +/// This intrinsic is only available **when the standard library itself is +/// compiled with the `atomics` target feature**. This version of the standard +/// library is not obtainable via `rustup`, but rather will require the standard +/// library to be compiled from source. +/// /// [instr]: https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wait #[inline] #[cfg_attr(test, assert_instr("i32.atomic.wait"))] @@ -71,6 +78,13 @@ pub unsafe fn wait_i32(ptr: *mut i32, expression: i32, timeout_ns: i64) -> i32 { /// didn't block /// * 2 - the thread blocked, but the timeout expired. /// +/// # Availability +/// +/// This intrinsic is only available **when the standard library itself is +/// compiled with the `atomics` target feature**. This version of the standard +/// library is not obtainable via `rustup`, but rather will require the standard +/// library to be compiled from source. +/// /// [instr]: https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wait #[inline] #[cfg_attr(test, assert_instr("i64.atomic.wait"))] @@ -92,6 +106,13 @@ pub unsafe fn wait_i64(ptr: *mut i64, expression: i64, timeout_ns: i64) -> i32 { /// /// Returns the number of waiters which were actually woken up. /// +/// # Availability +/// +/// This intrinsic is only available **when the standard library itself is +/// compiled with the `atomics` target feature**. This version of the standard +/// library is not obtainable via `rustup`, but rather will require the standard +/// library to be compiled from source. +/// /// [instr]: https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wake #[inline] #[cfg_attr(test, assert_instr("atomic.wake"))]