Skip to content

Commit d189cab

Browse files
committed
Use fallback on emscripten targets
1 parent 24db517 commit d189cab

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/libcore/hint.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,29 @@ 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(target_arch = "asmjs"))] {
102+
#[cfg(not(
103+
any(
104+
target_arch = "asmjs",
105+
all(
106+
target_arch = "wasm32",
107+
target_os = "emscripten"
108+
)
109+
)
110+
))] {
103111
// we need to "use" the argument in some way LLVM can't
104112
// introspect.
105113
unsafe { asm!("" : : "r"(&dummy)) }
106114
dummy
107115
}
108-
#[cfg(target_arch = "asmjs")] {
116+
#[cfg(
117+
any(
118+
target_arch = "asmjs",
119+
all(
120+
target_arch = "wasm32",
121+
target_os = "emscripten"
122+
)
123+
)
124+
)] {
109125
unsafe {
110126
let ret = crate::ptr::read_volatile(&dummy);
111127
crate::mem::forget(dummy);

0 commit comments

Comments
 (0)