Skip to content

WebAudio wasm build fails with wasm-bindgen panic=unwind closures #1394

Open

Description

@Quat3rnion

With Rust panic=unwind and current wasm-bindgen (0.2.129), cpal 0.18.2 fails to compile for wasm32-unknown-unknown in src/host/webaudio/mod.rs at Closure::wrap(Box::new(move || { ... })). The boxed callback type Box<dyn FnMut()> does not implement wasm-bindgen's MaybeUnwindSafe bound.

A local one-line fix is:

Closure::wrap_assert_unwind_safe(Box::new(move || { ... }))

The callback is owned by the WebAudio host and does not cross Rust threads. Would you consider this change, or another supported closure construction, in cpal?

Activity

  1. Quat3rnion commented on Oct 8, 2026

    @Quat3rnion
    Author

    Update: our browser build no longer uses panic=unwind for Rust. Stable Rust with panic=abort compiles the full web dependency graph, and the Lua callback/pcall wasm reproducer passes with Lua exceptions compiled as C++ wasm EH. The cpal change is therefore not required for our build. The report still applies to projects that choose panic=unwind; we removed our local cpal patch.

  2. added theissue type on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions