Skip to content

Commit 636435f

Browse files
authored
async/stream/future support for wasmtime-wit-bindgen (#10044)
* 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 <[email protected]> remove obsolete TODO comment Signed-off-by: Joel Dice <[email protected]> make `futures` dep optional Signed-off-by: Joel Dice <[email protected]> update `wasm-tools` and `wit-bindgen` Signed-off-by: Joel Dice <[email protected]> * run cargo vet Signed-off-by: Joel Dice <[email protected]> --------- Signed-off-by: Joel Dice <[email protected]>
1 parent 5d6cd8c commit 636435f

File tree

145 files changed

+30324
-1020
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+30324
-1020
lines changed

Cargo.lock

+45-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+12-12
Original file line numberDiff line numberDiff line change
@@ -294,20 +294,20 @@ io-lifetimes = { version = "2.0.3", default-features = false }
294294
io-extras = "0.18.1"
295295
rustix = "0.38.43"
296296
# wit-bindgen:
297-
wit-bindgen = { version = "0.37.0", default-features = false }
298-
wit-bindgen-rust-macro = { version = "0.37.0", default-features = false }
297+
wit-bindgen = { version = "0.38.0", default-features = false }
298+
wit-bindgen-rust-macro = { version = "0.38.0", default-features = false }
299299

300300
# wasm-tools family:
301-
wasmparser = { version = "0.223.0", default-features = false, features = ['simd'] }
302-
wat = "1.223.0"
303-
wast = "223.0.0"
304-
wasmprinter = "0.223.0"
305-
wasm-encoder = "0.223.0"
306-
wasm-smith = "0.223.0"
307-
wasm-mutate = "0.223.0"
308-
wit-parser = "0.223.0"
309-
wit-component = "0.223.0"
310-
wasm-wave = "0.223.0"
301+
wasmparser = { version = "0.224.0", default-features = false, features = ['simd'] }
302+
wat = "1.224.0"
303+
wast = "224.0.0"
304+
wasmprinter = "0.224.0"
305+
wasm-encoder = "0.224.0"
306+
wasm-smith = "0.224.0"
307+
wasm-mutate = "0.224.0"
308+
wit-parser = "0.224.0"
309+
wit-component = "0.224.0"
310+
wasm-wave = "0.224.0"
311311

312312
# Non-Bytecode Alliance maintained dependencies:
313313
# --------------------------

crates/component-macro/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ wasmtime-wit-bindgen = { workspace = true }
2929
wit-parser = { workspace = true }
3030

3131
[dev-dependencies]
32-
wasmtime = { path = '../wasmtime', features = ['component-model'] }
32+
wasmtime = { path = '../wasmtime', features = ['component-model', 'component-model-async'] }
33+
wasmtime-wit-bindgen = { workspace = true, features = ['component-model-async'] }
3334
component-macro-test-helpers = { path = 'test-helpers' }
3435
tracing = { workspace = true }
3536
# For use with the custom attributes test
@@ -41,3 +42,4 @@ similar = { workspace = true }
4142
[features]
4243
async = []
4344
std = ['wasmtime-wit-bindgen/std']
45+
component-model-async = ['std', 'async', 'wasmtime-wit-bindgen/component-model-async']

0 commit comments

Comments
 (0)