From e75851f4fa9684f9f4690bc2b6765234300d9694 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Wed, 12 Jun 2024 12:32:07 +0200 Subject: [PATCH] Revert "web: No longer set the `web_sys_unstable_apis` config variable" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5b7c48e43d429525cf2b1f4632a607f9bf893aba. Co-authored-by: TÖRÖK Attila --- .cargo/config.toml | 8 ++++++++ web/packages/core/tools/build_wasm.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index c1c64baf8..404470391 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,11 @@ +[target.'cfg(all())'] +# NOTE that the web build overrides this setting in package.json via the RUSTFLAGS environment variable +rustflags = [ + # We need to specify this flag for all targets because Clippy checks all of our code against all targets + # and our web code does not compile without this flag + "--cfg=web_sys_unstable_apis", +] + [target.x86_64-pc-windows-msvc] # Use the LLD linker, it should be faster than the default. # See: https://github.com/rust-lang/rust/issues/71520 diff --git a/web/packages/core/tools/build_wasm.ts b/web/packages/core/tools/build_wasm.ts index 8e4affd47..61c93ea52 100644 --- a/web/packages/core/tools/build_wasm.ts +++ b/web/packages/core/tools/build_wasm.ts @@ -84,7 +84,7 @@ function buildWasm( extensions: boolean, wasmSource: string, ) { - const rustFlags = ["-Aunknown_lints"]; + const rustFlags = ["--cfg=web_sys_unstable_apis", "-Aunknown_lints"]; const wasmBindgenFlags = []; const wasmOptFlags = []; const flavor = extensions ? "extensions" : "vanilla";