Open
Description
Since commit 07728a35c5e0736c3cec99e7fd9ec33161dbc6fb, webassembly builds fail with this error:
error[E0277]: `(dyn FnOnce(std::result::Result<(), BufferAccessError>) + 'static)` cannot be shared between threads safely
--> src\lib.rs:4120:41
|
4120 | handle_error_fatal(context, cause, "wgpuDevicePoll");
| ------------------ ^^^^^ `(dyn FnOnce(std::result::Result<(), BufferAccessError>) + 'static)` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
(and more similar errors)
It seems like the error happens because in lib.rs, the handle_error_fatal
and handle_error
functions require the cause
parameter to be Send + Sync, but this should only be required in non-webassembly builds (in wgpu-core/src/error.rs, ContextError
doesn't have this requirement in webassembly builds).
Adding cfg-s to disable the requirements in webassembly builds seems to fix the issue.
(lib.rs, the cause
parameter of error handling functions, and the variants of Error
enum)