about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2020-06-05 10:14:53 -0700
committerAlex Crichton <alex@alexcrichton.com>2020-06-05 10:14:53 -0700
commit05b2d3f7dc623fc5304fa0edc9efeaf08ea1db26 (patch)
treed47e19a25f5736cc4f6941a883c8f64a6b15b455 /src
parent219380d840877de97b0e17674be7212ebc929d51 (diff)
downloadrust-05b2d3f7dc623fc5304fa0edc9efeaf08ea1db26.tar.gz
rust-05b2d3f7dc623fc5304fa0edc9efeaf08ea1db26.zip
std: Enable atomic.fence emission on wasm32
This commit removes the `#[cfg]` guards in `atomic::fence` on wasm
targets. Since these guards were originally added the upstream wasm
specification for threads gained an `atomic.fence` instruction, so LLVM
no longer panics on these intrinsics.

Although there aren't a ton of tests in-repo for this right now I've
tested locally and all of these fences generate `atomic.fence`
instructions in wasm.

Closes #72997
Diffstat (limited to 'src')
-rw-r--r--src/libcore/sync/atomic.rs8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs
index 449aac85bc7..d3196017848 100644
--- a/src/libcore/sync/atomic.rs
+++ b/src/libcore/sync/atomic.rs
@@ -2536,15 +2536,7 @@ unsafe fn atomic_umin<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
 /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[cfg_attr(target_arch = "wasm32", allow(unused_variables))]
 pub fn fence(order: Ordering) {
-    // On wasm32 it looks like fences aren't implemented in LLVM yet in that
-    // they will cause LLVM to abort. The wasm instruction set doesn't have
-    // fences right now. There's discussion online about the best way for tools
-    // to conventionally implement fences at
-    // https://github.com/WebAssembly/tool-conventions/issues/59. We should
-    // follow that discussion and implement a solution when one comes about!
-    #[cfg(not(target_arch = "wasm32"))]
     // SAFETY: using an atomic fence is safe.
     unsafe {
         match order {