Skip to content

Commit 24db517

Browse files
committed
black_box should use inline assembly on wasm32
1 parent cfa76c4 commit 24db517

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libcore/hint.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,17 @@ pub fn spin_loop() {
9999
/// This function is a no-op, and does not even read from `dummy`.
100100
#[unstable(feature = "test", issue = "27812")]
101101
pub fn black_box<T>(dummy: T) -> T {
102-
#[cfg(not(any(target_arch = "asmjs", target_arch = "wasm32")))] {
102+
#[cfg(not(target_arch = "asmjs"))] {
103103
// we need to "use" the argument in some way LLVM can't
104104
// introspect.
105105
unsafe { asm!("" : : "r"(&dummy)) }
106106
dummy
107107
}
108-
#[cfg(any(target_arch = "asmjs", target_arch = "wasm32"))] {
108+
#[cfg(target_arch = "asmjs")] {
109109
unsafe {
110110
let ret = crate::ptr::read_volatile(&dummy);
111111
crate::mem::forget(dummy);
112112
ret
113113
}
114-
}
114+
}
115115
}

0 commit comments

Comments
 (0)