async/stream/future support for wasmtime-wit-bindgen#10044
async/stream/future support for wasmtime-wit-bindgen#10044dicej merged 2 commits intobytecodealliance:mainfrom
Conversation
In case it helps: Since
That's the same workaround used in Another |
|
Thanks for the links, @rvolosatovs. The compiler error I'm seeing doesn't match the ones in those issues, so I suspect it's something different. Here's a (somewhat) minimal example of what I'm seeing: |
crates/wasmtime/Cargo.toml
Outdated
| @@ -62,6 +62,7 @@ semver = { workspace = true, optional = true } | |||
| smallvec = { workspace = true, optional = true } | |||
| hashbrown = { workspace = true, features = ["default-hasher"] } | |||
| bitflags = { workspace = true } | |||
| futures = { workspace = true, features = ["alloc"] } | |||
There was a problem hiding this comment.
Could this be made an optional dependency activated by component-model-async?
I've split this out of bytecodealliance#9582 to make review easier. This patch adds async/stream/future/error-context support to the host binding generator, along with placeholder type and function definitions in the `wasmtime` crate which the generated bindings can refer to. See https://github.com/dicej/rfcs/blob/component-async/accepted/component-model-async.md#componentbindgen-updates for the design and rationale. Note that I've added temporary `[patch.crates-io]` overrides in Cargo.toml until bytecodealliance/wit-bindgen#1130 and bytecodealliance/wasm-tools#1978 have been released. Also note that we emit a `T: 'static` bound for `AsContextMut<Data = T>` when generating bindings with `concurrent_imports: true`. This is only because `rustc` insists that the closure we're passing to `LinkerInstance::func_wrap_concurrent` captures the lifetime of `T` despite my best efforts to convince it otherwise. Alex and I suspect this is a limitation in the compiler, and I asked about it on the rust-lang Zulip, but we haven't been able to determine a workaround so far. Signed-off-by: Joel Dice <joel.dice@fermyon.com> remove obsolete TODO comment Signed-off-by: Joel Dice <joel.dice@fermyon.com> make `futures` dep optional Signed-off-by: Joel Dice <joel.dice@fermyon.com> update `wasm-tools` and `wit-bindgen` Signed-off-by: Joel Dice <joel.dice@fermyon.com>
24365da to
f04b932
Compare
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Accidental regression from bytecodealliance#10044. Closes bytecodealliance#10677
Accidental regression from bytecodealliance#10044. Closes bytecodealliance#10677
I've split this out of #9582 to make review easier.
This patch adds async/stream/future/error-context support to the host binding generator, along with placeholder type and function definitions in the
wasmtimecrate which the generated bindings can refer to. See https://github.com/dicej/rfcs/blob/component-async/accepted/component-model-async.md#componentbindgen-updates for the design and rationale.Note that I've added temporary
[patch.crates-io]overrides in Cargo.toml until bytecodealliance/wit-bindgen#1130 and bytecodealliance/wasm-tools#1978 have been released.Also note that we emit a
T: 'staticbound forAsContextMut<Data = T>when generating bindings withconcurrent_imports: true. This is only becauserustcinsists that the closure we're passing toLinkerInstance::func_wrap_concurrentcaptures the lifetime ofTdespite my best efforts to convince it otherwise. Alex and I suspect this is a limitation in the compiler, and I asked about it on the rust-lang Zulip, but we haven't been able to determine a workaround so far.