diff options
| author | gnzlbg <gonzalobg88@gmail.com> | 2019-03-25 18:11:42 +0100 |
|---|---|---|
| committer | gnzlbg <gonzalobg88@gmail.com> | 2019-03-25 18:43:51 +0100 |
| commit | 24db5174191c915bb7a61809837aaa5cb98cfa11 (patch) | |
| tree | ce9295c723ae99e7f0923b95e74a1850afb5b352 | |
| parent | cfa76c438a907bf223e4487ab4da2500277474cc (diff) | |
| download | rust-24db5174191c915bb7a61809837aaa5cb98cfa11.tar.gz rust-24db5174191c915bb7a61809837aaa5cb98cfa11.zip | |
black_box should use inline assembly on wasm32
| -rw-r--r-- | src/libcore/hint.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs index abaf0b31b46..e73a1a28793 100644 --- a/src/libcore/hint.rs +++ b/src/libcore/hint.rs @@ -99,17 +99,17 @@ 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(any(target_arch = "asmjs", target_arch = "wasm32")))] { + #[cfg(not(target_arch = "asmjs"))] { // we need to "use" the argument in some way LLVM can't // introspect. unsafe { asm!("" : : "r"(&dummy)) } dummy } - #[cfg(any(target_arch = "asmjs", target_arch = "wasm32"))] { + #[cfg(target_arch = "asmjs")] { unsafe { let ret = crate::ptr::read_volatile(&dummy); crate::mem::forget(dummy); ret } - } + } } |
