]> git.lizzy.rs Git - rust.git/commitdiff
Use fallback on emscripten targets
authorgnzlbg <gonzalobg88@gmail.com>
Tue, 26 Mar 2019 08:12:06 +0000 (09:12 +0100)
committergnzlbg <gonzalobg88@gmail.com>
Tue, 26 Mar 2019 11:17:03 +0000 (12:17 +0100)
src/libcore/hint.rs

index e73a1a28793471ca2d433b22df82e8b655b50f50..856720bd55427853e12dfb513b5ed0a8e040c730 100644 (file)
@@ -99,13 +99,29 @@ pub fn spin_loop() {
 /// This function is a no-op, and does not even read from `dummy`.
 #[unstable(feature = "test", issue = "27812")]
 pub fn black_box<T>(dummy: T) -> T {
-    #[cfg(not(target_arch = "asmjs"))] {
+    #[cfg(not(
+        any(
+            target_arch = "asmjs",
+            all(
+                target_arch = "wasm32",
+                target_os = "emscripten"
+            )
+        )
+    ))] {
         // we need to "use" the argument in some way LLVM can't
         // introspect.
         unsafe { asm!("" : : "r"(&dummy)) }
         dummy
     }
-    #[cfg(target_arch = "asmjs")] {
+    #[cfg(
+        any(
+            target_arch = "asmjs",
+            all(
+                target_arch = "wasm32",
+                target_os = "emscripten"
+            )
+        )
+    )] {
         unsafe {
             let ret = crate::ptr::read_volatile(&dummy);
             crate::mem::forget(dummy);