HKalbasi added the bug label to Issue #9487.
HKalbasi opened issue #9487:
I have this macro:
bindgen!({ world: "gav", with: { "wasi": wasmtime_wasi::bindings, "wasi:http": wasmtime_wasi_http::bindings::http, }, });
And its generated code fails to compile with this error:
error[E0277]: `T` cannot be sent between threads safely --> src/main.rs:5:1 | 5 | / bindgen!({ 6 | | world: "gav", 7 | | 8 | | with: { ... | 11 | | }, 12 | | }); | |__^ `T` cannot be sent between threads safely | note: required by a bound in `wasmtime_wasi::bindings::sync::io::poll::add_to_linker` --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-wasi-25.0.2/src/bindings.rs:148:9 | 148 | / wasmtime::component::bindgen!({ 149 | | path: "wit", 150 | | world: "wasi:cli/command", 151 | | tracing: true, ... | 181 | | require_store_data_send: true, 182 | | }); | |__________^ required by this bound in `add_to_linker` = note: this error originates in the macro `bindgen` which comes from the expansion of the macro `wasmtime::component::bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `T` | 12 | }), T: std::marker::Send; | ++++++++++++++++++++++
It seems some
Send
bounds are missing from theadd_to_linker
functions. Usingwasmtime_wasi::bindings::sync
instead ofwasmtime_wasi::bindings
didn't help.
bjorn3 commented on issue #9487:
Does it work if you add
async: true
to the bindgen invocation?
HKalbasi commented on issue #9487:
Yes, but I don't want async I think.
bjorn3 commented on issue #9487:
In that case I think you have to do:
bindgen!({ world: "gav", with: { "wasi": wasmtime_wasi::bindings::sync, "wasi:http": wasmtime_wasi_http::bindings::sync::http, }, });
HKalbasi commented on issue #9487:
This one doesn't work. It fails with the same error of original post.
alexcrichton commented on issue #9487:
Does this option, notably
require_store_data_send: true
, work for you? (it's sort of buried in the documentation)
HKalbasi closed issue #9487:
I have this macro:
bindgen!({ world: "gav", with: { "wasi": wasmtime_wasi::bindings, "wasi:http": wasmtime_wasi_http::bindings::http, }, });
And its generated code fails to compile with this error:
error[E0277]: `T` cannot be sent between threads safely --> src/main.rs:5:1 | 5 | / bindgen!({ 6 | | world: "gav", 7 | | 8 | | with: { ... | 11 | | }, 12 | | }); | |__^ `T` cannot be sent between threads safely | note: required by a bound in `wasmtime_wasi::bindings::sync::io::poll::add_to_linker` --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-wasi-25.0.2/src/bindings.rs:148:9 | 148 | / wasmtime::component::bindgen!({ 149 | | path: "wit", 150 | | world: "wasi:cli/command", 151 | | tracing: true, ... | 181 | | require_store_data_send: true, 182 | | }); | |__________^ required by this bound in `add_to_linker` = note: this error originates in the macro `bindgen` which comes from the expansion of the macro `wasmtime::component::bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `T` | 12 | }), T: std::marker::Send; | ++++++++++++++++++++++
It seems some
Send
bounds are missing from theadd_to_linker
functions. Usingwasmtime_wasi::bindings::sync
instead ofwasmtime_wasi::bindings
didn't help.
HKalbasi commented on issue #9487:
This works, thanks!
Last updated: Dec 23 2024 at 12:05 UTC