diff --git a/sdk/typespec/typespec_client_core/src/async_runtime/mod.rs b/sdk/typespec/typespec_client_core/src/async_runtime/mod.rs index 65a58b2e8f..fa76e9a5b1 100644 --- a/sdk/typespec/typespec_client_core/src/async_runtime/mod.rs +++ b/sdk/typespec/typespec_client_core/src/async_runtime/mod.rs @@ -185,6 +185,11 @@ pub fn set_async_runtime(runtime: Arc) -> crate::Result<()> { } fn create_async_runtime() -> Arc { + #[cfg(all(feature = "wasm_bindgen", feature = "tokio"))] + compile_error!( + "feature \"wasm_bindgen\" and feature \"tokio\" cannot be enabled at the same time" + ); + #[cfg(all(target_arch = "wasm32", feature = "wasm_bindgen"))] { Arc::new(web_runtime::WasmBindgenRuntime) as Arc @@ -193,7 +198,10 @@ fn create_async_runtime() -> Arc { { Arc::new(tokio_runtime::TokioRuntime) as Arc } - #[cfg(not(any(feature = "tokio", feature = "wasm_bindgen")))] + #[cfg(not(any( + feature = "tokio", + all(target_arch = "wasm32", feature = "wasm_bindgen") + )))] { Arc::new(standard_runtime::StdRuntime) as Arc }