feat: add support for stream with no <T>#1130
Conversation
8a8e5ac to
7a8f757
Compare
|
I'm not sure what the policy on pulling in bleeding-edge changes from https://github.com/bytecodealliance/wasm-tools is, I feel like I'll probably have to wait for a new release, but I'm also not sure how soon that would happen, so marking the PR ready for review with the git deps |
|
Ah yes to merge this it'll need to be a crates.io-based dependency. There's some documentation on releases for wasm-tools but the tl;dr; is that it's on-demand. I personally prefer to spread out releases where possible, so if it's ok I'd prefer that this were integrated into other in-development systems first to make sure it works and then once it's reasonably confident no major changes are needed here the cranks can be turned. |
|
@rvolosatovs I'm about to update my Wasmtime async branch to use both |
Actually, I'll use the |
Actually, actually, I used the |
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>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> test: return `future` in future return test WIT Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> build: update wasm-tools Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> avoid divide-by-zero in `StreamReader::poll_next` I hit this when testing "unit streams" (i.e. streams with no payload type) end-to-end. BTW, I can't wait to get some runtime tests going in this repo so we can catch this kind of thing in CI. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
94c0ff3 to
43ba064
Compare
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
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>
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 `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. remove obsolete TODO comment make `futures` dep optional update `wasm-tools` and `wit-bindgen` Signed-off-by: Joel Dice <joel.dice@fermyon.com>
* async/stream/future support for wasmtime-wit-bindgen 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 `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> * run cargo vet Signed-off-by: Joel Dice <joel.dice@fermyon.com> --------- Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Refs bytecodealliance/wasm-tools#1978
Refs WebAssembly/component-model#440