@@ -59,11 +59,23 @@ pub mod arch {
5959 /// Platform-specific intrinsics for the `wasm32` platform.
6060 ///
6161 /// This module provides intrinsics specific to the WebAssembly
62- /// architecture. Here you'll find intrinsics necessary for leveraging
63- /// WebAssembly proposals such as [atomics] and [simd]. These proposals are
64- /// evolving over time and as such the support here is unstable and requires
65- /// the nightly channel. As WebAssembly proposals stabilize these functions
66- /// will also become stable.
62+ /// architecture. Here you'll find intrinsics specific to WebAssembly that
63+ /// aren't otherwise surfaced somewhere in a cross-platform abstraction of
64+ /// `std`, and you'll also find functions for leveraging WebAssembly
65+ /// proposals such as [atomics] and [simd].
66+ ///
67+ /// Intrinsics in the `wasm32` module are modeled after the WebAssembly
68+ /// instructions that they represent. All functions are named after the
69+ /// instruction they intend to correspond to, and the arguments/results
70+ /// correspond to the type signature of the instruction itself. Stable
71+ /// WebAssembly instructions are [documented online][instrdoc].
72+ ///
73+ /// [instrdoc]: https://webassembly.github.io/spec/core/valid/instructions.html
74+ ///
75+ /// If a proposal is not yet stable in WebAssembly itself then the functions
76+ /// within this function may be unstable and require the nightly channel of
77+ /// Rust to use. As the proposal itself stabilizes the intrinsics in this
78+ /// module should stabilize as well.
6779 ///
6880 /// [atomics]: https://github.com/webassembly/threads
6981 /// [simd]: https://github.com/webassembly/simd
@@ -74,18 +86,22 @@ pub mod arch {
7486 /// ## Atomics
7587 ///
7688 /// The [threads proposal][atomics] for WebAssembly adds a number of
77- /// instructions for dealing with multithreaded programs. Atomic
78- /// instructions can all be generated through `std::sync::atomic` types, but
79- /// some instructions have no equivalent in Rust such as
80- /// `memory.atomic.notify` so this module will provide these intrinsics.
81- ///
82- /// At this time, however, these intrinsics are only available **when the
83- /// standard library itself is compiled with atomics**. Compiling with
84- /// atomics is not enabled by default and requires passing
85- /// `-Ctarget-feature=+atomics` to rustc. The standard library shipped via
86- /// `rustup` is not compiled with atomics. To get access to these intrinsics
87- /// you'll need to compile the standard library from source with the
88- /// requisite compiler flags.
89+ /// instructions for dealing with multithreaded programs. Most instructions
90+ /// added in the [atomics] proposal are exposed in Rust through the
91+ /// `std::sync::atomic` module. Some instructions, however, don't have
92+ /// direct equivalents in Rust so they're exposed here instead.
93+ ///
94+ /// Note that the instructions added in the [atomics] proposal can work in
95+ /// either a context with a shared wasm memory and without. These intrinsics
96+ /// are always available in the standard library, but you likely won't be
97+ /// able to use them too productively unless you recompile the standard
98+ /// library (and all your code) with `-Ctarget-feature=+atomics`.
99+ ///
100+ /// It's also worth pointing out that multi-threaded WebAssembly and its
101+ /// story in Rust is still in a somewhat "early days" phase as of the time
102+ /// of this writing. Pieces should mostly work but it generally requires a
103+ /// good deal of manual setup. At this time it's not as simple as "just call
104+ /// `std::thread::spawn`", but it will hopefully get there one day!
89105 ///
90106 /// ## SIMD
91107 ///
0 commit comments