Skip to content

Commit ab267cc

Browse files
committed
Fix native build
1 parent e8e60aa commit ab267cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/timer.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ impl Default for TimerHandle {
277277
// handle which will return errors when timer objects are attempted to
278278
// be associated.
279279
if fallback == 0 {
280-
#[cfg(not(feature = "wasm-bindgen"))]
280+
#[cfg(not(target_arch = "wasm32"))]
281281
{
282282
let helper = match crate::global_native::HelperThread::new() {
283283
Ok(helper) => helper,
@@ -298,7 +298,7 @@ impl Default for TimerHandle {
298298
}
299299
}
300300

301-
#[cfg(feature = "wasm-bindgen")]
301+
#[cfg(all(feature = "wasm-bindgen", target_arch = "wasm32"))]
302302
{
303303
let handle = crate::global_wasm::run();
304304

@@ -307,6 +307,8 @@ impl Default for TimerHandle {
307307
return handle;
308308
}
309309
}
310+
#[cfg(all(not(feature = "wasm-bindgen"), target_arch = "wasm32"))]
311+
compile_error!("The `wasm-bindgen` feature must be used when compiling to wasm.");
310312

311313
fallback = HANDLE_FALLBACK.load(SeqCst);
312314
}

0 commit comments

Comments
 (0)