diff options
| author | gnzlbg <gonzalobg88@gmail.com> | 2019-03-26 09:12:06 +0100 |
|---|---|---|
| committer | gnzlbg <gonzalobg88@gmail.com> | 2019-03-26 12:17:03 +0100 |
| commit | d189cab027bee94f4a4ef09484e30354c9843764 (patch) | |
| tree | ee37d265bf19296841df3df9cf93ce13d61729e5 | |
| parent | 24db5174191c915bb7a61809837aaa5cb98cfa11 (diff) | |
Use fallback on emscripten targets
| -rw-r--r-- | src/libcore/hint.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs index e73a1a28793..856720bd554 100644 --- a/src/libcore/hint.rs +++ b/src/libcore/hint.rs @@ -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); |
