Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: future cannot be sent between threads safely when trying to build for wasm32-unknown-unknown #2234

Open
setoelkahfi opened this issue Sep 8, 2024 · 1 comment

Comments

@setoelkahfi
Copy link

I'm trying to include a crate successfully built with uiffi-rs for Swift for wasm. I created a new crate called crate-networking-wasm and referenced the base crate_networking. When running wasm-pack build in the crate-networking-wasm I got this error:

error: future cannot be sent between threads safely
  --> /path-to-repo/lib/crate_networking/src/content.rs:17:1
   |
17 | #[export(async_runtime = "tokio")]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
   |

Any pointers?

Related:

@badboy
Copy link
Member

badboy commented Sep 9, 2024

Hard to say without any code, so I can only guess:
one of your async functions in that block of code is holding things across waitpoints that are not Send and thus turn the whole future into not-Send.
You will have to restructure your code or wrap the parts into Send-able constructs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants