diff --git a/Cargo.lock b/Cargo.lock
index 877eeae09edf..932b93ad747d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -258,6 +258,15 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+[[package]]
+name = "bitmaps"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
+dependencies = [
+ "typenum",
+]
+
[[package]]
name = "block-buffer"
version = "0.10.2"
@@ -610,6 +619,24 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
+[[package]]
+name = "component-async-tests"
+version = "0.0.0"
+dependencies = [
+ "anyhow",
+ "flate2",
+ "futures",
+ "pretty_env_logger",
+ "tempfile",
+ "test-programs-artifacts",
+ "tokio",
+ "wasi-http-draft",
+ "wasm-compose",
+ "wasmparser",
+ "wasmtime",
+ "wasmtime-wasi",
+]
+
[[package]]
name = "component-fuzz-util"
version = "0.0.0"
@@ -1345,6 +1372,12 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "fixedbitset"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
+
[[package]]
name = "flagset"
version = "0.4.3"
@@ -1405,12 +1438,13 @@ dependencies = [
[[package]]
name = "futures"
-version = "0.3.27"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549"
+checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
dependencies = [
"futures-channel",
"futures-core",
+ "futures-executor",
"futures-io",
"futures-sink",
"futures-task",
@@ -1419,9 +1453,9 @@ dependencies = [
[[package]]
name = "futures-channel"
-version = "0.3.27"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac"
+checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
"futures-sink",
@@ -1433,11 +1467,33 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
+[[package]]
+name = "futures-executor"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
[[package]]
name = "futures-io"
-version = "0.3.28"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
+checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
+
+[[package]]
+name = "futures-macro"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.90",
+]
[[package]]
name = "futures-sink"
@@ -1457,11 +1513,16 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
+ "futures-channel",
"futures-core",
+ "futures-io",
+ "futures-macro",
"futures-sink",
"futures-task",
+ "memchr",
"pin-project-lite",
"pin-utils",
+ "slab",
]
[[package]]
@@ -1740,6 +1801,20 @@ dependencies = [
"unicode-normalization",
]
+[[package]]
+name = "im-rc"
+version = "15.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe"
+dependencies = [
+ "bitmaps",
+ "rand_core",
+ "rand_xoshiro",
+ "sized-chunks",
+ "typenum",
+ "version_check",
+]
+
[[package]]
name = "indexmap"
version = "1.9.1"
@@ -2378,6 +2453,16 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
+[[package]]
+name = "petgraph"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
+dependencies = [
+ "fixedbitset",
+ "indexmap 2.2.6",
+]
+
[[package]]
name = "pin-project-lite"
version = "0.2.14"
@@ -2560,6 +2645,15 @@ dependencies = [
"rand_core",
]
+[[package]]
+name = "rand_xoshiro"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
+dependencies = [
+ "rand_core",
+]
+
[[package]]
name = "rawpointer"
version = "0.2.1"
@@ -2879,6 +2973,19 @@ dependencies = [
"serde",
]
+[[package]]
+name = "serde_yaml"
+version = "0.9.34+deprecated"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
+dependencies = [
+ "indexmap 2.2.6",
+ "itoa",
+ "ryu",
+ "serde",
+ "unsafe-libyaml",
+]
+
[[package]]
name = "sha1"
version = "0.10.6"
@@ -2952,6 +3059,16 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62ac7f900db32bf3fd12e0117dd3dc4da74bc52ebaac97f39668446d89694803"
+[[package]]
+name = "sized-chunks"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e"
+dependencies = [
+ "bitmaps",
+ "typenum",
+]
+
[[package]]
name = "slab"
version = "0.4.7"
@@ -3191,14 +3308,17 @@ version = "0.0.0"
dependencies = [
"anyhow",
"base64 0.21.0",
+ "flate2",
"futures",
"getrandom",
"libc",
+ "once_cell",
"sha2",
"url",
"wasi",
"wasi-nn",
"wit-bindgen",
+ "wit-bindgen-rt",
]
[[package]]
@@ -3207,8 +3327,9 @@ version = "0.0.0"
dependencies = [
"cargo_metadata",
"heck 0.5.0",
+ "wasmparser",
"wasmtime",
- "wit-component 0.221.2",
+ "wit-component",
]
[[package]]
@@ -3523,6 +3644,12 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04"
+[[package]]
+name = "unsafe-libyaml"
+version = "0.2.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
+
[[package]]
name = "untrusted"
version = "0.9.0"
@@ -3617,7 +3744,7 @@ name = "verify-component-adapter"
version = "29.0.0"
dependencies = [
"anyhow",
- "wasmparser 0.221.2",
+ "wasmparser",
"wat",
]
@@ -3692,6 +3819,15 @@ dependencies = [
"windows-sys 0.59.0",
]
+[[package]]
+name = "wasi-http-draft"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "futures",
+ "wasmtime",
+]
+
[[package]]
name = "wasi-nn"
version = "0.6.0"
@@ -3709,7 +3845,7 @@ dependencies = [
"byte-array-literals",
"object",
"wasi",
- "wasm-encoder 0.221.2",
+ "wasm-encoder",
"wit-bindgen-rust-macro",
]
@@ -3769,46 +3905,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49"
[[package]]
-name = "wasm-encoder"
-version = "0.220.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7"
+name = "wasm-compose"
+version = "0.221.2"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
- "leb128",
- "wasmparser 0.220.0",
+ "anyhow",
+ "heck 0.4.1",
+ "im-rc",
+ "indexmap 2.2.6",
+ "log",
+ "petgraph",
+ "serde",
+ "serde_derive",
+ "serde_yaml",
+ "smallvec",
+ "wasm-encoder",
+ "wasmparser",
+ "wat",
]
[[package]]
name = "wasm-encoder"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c17a3bd88f2155da63a1f2fcb8a56377a24f0b6dfed12733bb5f544e86f690c5"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"leb128",
- "wasmparser 0.221.2",
-]
-
-[[package]]
-name = "wasm-metadata"
-version = "0.220.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f3e5f5920c5abfc45573c89b07b38efdaae1515ef86f83dad12d60e50ecd62b"
-dependencies = [
- "anyhow",
- "indexmap 2.2.6",
- "serde",
- "serde_derive",
- "serde_json",
- "spdx",
- "wasm-encoder 0.220.0",
- "wasmparser 0.220.0",
+ "wasmparser",
]
[[package]]
name = "wasm-metadata"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9a7018a96c4f55a8f339954c66e09728f2d6112689000e58f15f6a6d7436e8f"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"anyhow",
"indexmap 2.2.6",
@@ -3816,36 +3944,34 @@ dependencies = [
"serde_derive",
"serde_json",
"spdx",
- "wasm-encoder 0.221.2",
- "wasmparser 0.221.2",
+ "wasm-encoder",
+ "wasmparser",
]
[[package]]
name = "wasm-mutate"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2512b64553d7c800b798e8e0d0e2e209e76f9330f66ed59991893590ae03cfa3"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"egg",
"log",
"rand",
"thiserror",
- "wasm-encoder 0.221.2",
- "wasmparser 0.221.2",
+ "wasm-encoder",
+ "wasmparser",
]
[[package]]
name = "wasm-smith"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ebbaf9c781fb7091b79ad3baa40862b3afccb2949575bb73bdd77643ed40338c"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"anyhow",
"arbitrary",
"flagset",
"indexmap 2.2.6",
"leb128",
- "wasm-encoder 0.221.2",
+ "wasm-encoder",
]
[[package]]
@@ -3859,13 +3985,12 @@ dependencies = [
[[package]]
name = "wasm-wave"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3bf15c65cc690791565c9f983bad120330e37f55ce2473161f2c0aaa534c7da"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"indexmap 2.2.6",
"logos",
"thiserror",
- "wit-parser 0.221.2",
+ "wit-parser",
]
[[package]]
@@ -3912,24 +4037,10 @@ dependencies = [
"wasmi_core",
]
-[[package]]
-name = "wasmparser"
-version = "0.220.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b"
-dependencies = [
- "ahash",
- "bitflags 2.6.0",
- "hashbrown 0.14.3",
- "indexmap 2.2.6",
- "semver",
-]
-
[[package]]
name = "wasmparser"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9845c470a2e10b61dd42c385839cdd6496363ed63b5c9e420b5488b77bd22083"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"bitflags 2.6.0",
"hashbrown 0.15.2",
@@ -3950,12 +4061,11 @@ dependencies = [
[[package]]
name = "wasmprinter"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a80742ff1b9e6d8c231ac7c7247782c6fc5bce503af760bca071811e5fc9ee56"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"anyhow",
"termcolor",
- "wasmparser 0.221.2",
+ "wasmparser",
]
[[package]]
@@ -3971,6 +4081,7 @@ dependencies = [
"cfg-if",
"encoding_rs",
"env_logger 0.11.5",
+ "futures",
"fxprof-processed-profile",
"gimli",
"hashbrown 0.14.3",
@@ -4000,9 +4111,9 @@ dependencies = [
"tempfile",
"trait-variant",
"wasi-common",
- "wasm-encoder 0.221.2",
+ "wasm-encoder",
"wasm-wave",
- "wasmparser 0.221.2",
+ "wasmparser",
"wasmtime-asm-macros",
"wasmtime-cache",
"wasmtime-component-macro",
@@ -4145,8 +4256,8 @@ dependencies = [
"trait-variant",
"walkdir",
"wasi-common",
- "wasm-encoder 0.221.2",
- "wasmparser 0.221.2",
+ "wasm-encoder",
+ "wasmparser",
"wasmtime",
"wasmtime-cache",
"wasmtime-cli-flags",
@@ -4166,7 +4277,7 @@ dependencies = [
"wast 221.0.2",
"wat",
"windows-sys 0.59.0",
- "wit-component 0.221.2",
+ "wit-component",
]
[[package]]
@@ -4199,7 +4310,7 @@ dependencies = [
"wasmtime",
"wasmtime-component-util",
"wasmtime-wit-bindgen",
- "wit-parser 0.221.2",
+ "wit-parser",
]
[[package]]
@@ -4225,7 +4336,7 @@ dependencies = [
"smallvec",
"target-lexicon",
"thiserror",
- "wasmparser 0.221.2",
+ "wasmparser",
"wasmtime-environ",
"wasmtime-versioned-export-macros",
]
@@ -4251,8 +4362,8 @@ dependencies = [
"serde_derive",
"smallvec",
"target-lexicon",
- "wasm-encoder 0.221.2",
- "wasmparser 0.221.2",
+ "wasm-encoder",
+ "wasmparser",
"wasmprinter",
"wasmtime-component-util",
"wat",
@@ -4266,7 +4377,7 @@ dependencies = [
"component-fuzz-util",
"env_logger 0.11.5",
"libfuzzer-sys",
- "wasmparser 0.221.2",
+ "wasmparser",
"wasmprinter",
"wasmtime-environ",
"wat",
@@ -4325,7 +4436,7 @@ dependencies = [
"rand",
"smallvec",
"target-lexicon",
- "wasmparser 0.221.2",
+ "wasmparser",
"wasmtime",
"wasmtime-fuzzing",
]
@@ -4346,12 +4457,12 @@ dependencies = [
"target-lexicon",
"tempfile",
"v8",
- "wasm-encoder 0.221.2",
+ "wasm-encoder",
"wasm-mutate",
"wasm-smith",
"wasm-spec-interpreter",
"wasmi",
- "wasmparser 0.221.2",
+ "wasmparser",
"wasmprinter",
"wasmtime",
"wasmtime-wast",
@@ -4552,7 +4663,7 @@ dependencies = [
"gimli",
"object",
"target-lexicon",
- "wasmparser 0.221.2",
+ "wasmparser",
"wasmtime-cranelift",
"wasmtime-environ",
"winch-codegen",
@@ -4565,7 +4676,7 @@ dependencies = [
"anyhow",
"heck 0.5.0",
"indexmap 2.2.6",
- "wit-parser 0.221.2",
+ "wit-parser",
]
[[package]]
@@ -4584,21 +4695,19 @@ dependencies = [
[[package]]
name = "wast"
version = "221.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcc4470b9de917ba199157d1f0ae104f2ae362be728c43e68c571c7715bd629e"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"bumpalo",
"leb128",
"memchr",
"unicode-width 0.2.0",
- "wasm-encoder 0.221.2",
+ "wasm-encoder",
]
[[package]]
name = "wat"
version = "1.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b1f3c6d82af47286494c6caea1d332037f5cbeeac82bbf5ef59cb8c201c466e"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"wast 221.0.2",
]
@@ -4742,7 +4851,7 @@ dependencies = [
"smallvec",
"target-lexicon",
"thiserror",
- "wasmparser 0.221.2",
+ "wasmparser",
"wasmtime-cranelift",
"wasmtime-environ",
]
@@ -4965,9 +5074,8 @@ dependencies = [
[[package]]
name = "wit-bindgen"
-version = "0.35.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c966692b6d8c4bb3c1aee3313e0930f44457a5763cfffb666f814506124e4691"
+version = "0.36.0"
+source = "git+https://github.com/dicej/wit-bindgen?branch=async-v1.221.2#ea17e8e99ae247373f8de3e134d9d184dea8957d"
dependencies = [
"wit-bindgen-rt",
"wit-bindgen-rust-macro",
@@ -4975,45 +5083,43 @@ dependencies = [
[[package]]
name = "wit-bindgen-core"
-version = "0.35.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19857cff2a480fece56ea43f9199322ee5014688a3539ebf8d29ae62d75a3a1f"
+version = "0.36.0"
+source = "git+https://github.com/dicej/wit-bindgen?branch=async-v1.221.2#ea17e8e99ae247373f8de3e134d9d184dea8957d"
dependencies = [
"anyhow",
"heck 0.5.0",
- "wit-parser 0.220.0",
+ "wit-parser",
]
[[package]]
name = "wit-bindgen-rt"
-version = "0.35.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "605d5562e971a823cf5a550a9d69cb7144e9b4969a810043127175517a4e1865"
+version = "0.36.0"
+source = "git+https://github.com/dicej/wit-bindgen?branch=async-v1.221.2#ea17e8e99ae247373f8de3e134d9d184dea8957d"
dependencies = [
"bitflags 2.6.0",
+ "futures",
+ "once_cell",
]
[[package]]
name = "wit-bindgen-rust"
-version = "0.35.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d894e599c161d71acb6a78e8ec8a609a09c2bb227de50829f5afbd03b844a69"
+version = "0.36.0"
+source = "git+https://github.com/dicej/wit-bindgen?branch=async-v1.221.2#ea17e8e99ae247373f8de3e134d9d184dea8957d"
dependencies = [
"anyhow",
"heck 0.5.0",
"indexmap 2.2.6",
"prettyplease",
"syn 2.0.90",
- "wasm-metadata 0.220.0",
+ "wasm-metadata",
"wit-bindgen-core",
- "wit-component 0.220.0",
+ "wit-component",
]
[[package]]
name = "wit-bindgen-rust-macro"
-version = "0.35.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a723cf943bba3bf34f437eb101e5a78180971e25dfb0085d80dbe4e73afb2854"
+version = "0.36.0"
+source = "git+https://github.com/dicej/wit-bindgen?branch=async-v1.221.2#ea17e8e99ae247373f8de3e134d9d184dea8957d"
dependencies = [
"anyhow",
"prettyplease",
@@ -5024,30 +5130,10 @@ dependencies = [
"wit-bindgen-rust",
]
-[[package]]
-name = "wit-component"
-version = "0.220.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73ccedf54cc65f287da268d64d2bf4f7530d2cfb2296ffbe3ad5f65567e4cf53"
-dependencies = [
- "anyhow",
- "bitflags 2.6.0",
- "indexmap 2.2.6",
- "log",
- "serde",
- "serde_derive",
- "serde_json",
- "wasm-encoder 0.220.0",
- "wasm-metadata 0.220.0",
- "wasmparser 0.220.0",
- "wit-parser 0.220.0",
-]
-
[[package]]
name = "wit-component"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c6b907a1af1f2cf2160d7fe2ff5967cef120dc5c034d22593a1f24e40272cb2"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"anyhow",
"bitflags 2.6.0",
@@ -5056,35 +5142,16 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
- "wasm-encoder 0.221.2",
- "wasm-metadata 0.221.2",
- "wasmparser 0.221.2",
- "wit-parser 0.221.2",
-]
-
-[[package]]
-name = "wit-parser"
-version = "0.220.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b7117ce3adc0b4354b46dc1cf3190b00b333e65243d244c613ffcc58bdec84d"
-dependencies = [
- "anyhow",
- "id-arena",
- "indexmap 2.2.6",
- "log",
- "semver",
- "serde",
- "serde_derive",
- "serde_json",
- "unicode-xid",
- "wasmparser 0.220.0",
+ "wasm-encoder",
+ "wasm-metadata",
+ "wasmparser",
+ "wit-parser",
]
[[package]]
name = "wit-parser"
version = "0.221.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbe1538eea6ea5ddbe5defd0dc82539ad7ba751e1631e9185d24a931f0a5adc8"
+source = "git+https://github.com/dicej/wasm-tools?branch=async-v1.221.2#c019adc93d996839569169e7dfe53425b3629474"
dependencies = [
"anyhow",
"id-arena",
@@ -5095,7 +5162,7 @@ dependencies = [
"serde_derive",
"serde_json",
"unicode-xid",
- "wasmparser 0.221.2",
+ "wasmparser",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 588914a99b9d..ddb5e1554c4d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -86,7 +86,7 @@ rustix = { workspace = true, features = ["mm", "param", "process"] }
[dev-dependencies]
# depend again on wasmtime to activate its default features for tests
-wasmtime = { workspace = true, features = ['default', 'winch', 'pulley', 'all-arch', 'call-hook', 'memory-protection-keys', 'signals-based-traps'] }
+wasmtime = { workspace = true, features = ['default', 'winch', 'pulley', 'all-arch', 'call-hook', 'memory-protection-keys', 'signals-based-traps', 'component-model-async'] }
env_logger = { workspace = true }
log = { workspace = true }
filecheck = { workspace = true }
@@ -146,6 +146,7 @@ members = [
"crates/bench-api",
"crates/c-api/artifact",
"crates/environ/fuzz",
+ "crates/misc/component-async-tests",
"crates/test-programs",
"crates/wasi-preview1-component-adapter",
"crates/wasi-preview1-component-adapter/verify",
@@ -229,6 +230,7 @@ wasmtime-versioned-export-macros = { path = "crates/versioned-export-macros", ve
wasmtime-slab = { path = "crates/slab", version = "=29.0.0" }
component-test-util = { path = "crates/misc/component-test-util" }
component-fuzz-util = { path = "crates/misc/component-fuzz-util" }
+component-async-tests = { path = "crates/misc/component-async-tests" }
wiggle = { path = "crates/wiggle", version = "=29.0.0", default-features = false }
wiggle-macro = { path = "crates/wiggle/macro", version = "=29.0.0" }
wiggle-generate = { path = "crates/wiggle/generate", version = "=29.0.0" }
@@ -281,20 +283,22 @@ io-lifetimes = { version = "2.0.3", default-features = false }
io-extras = "0.18.1"
rustix = "0.38.31"
# wit-bindgen:
-wit-bindgen = { version = "0.35.0", default-features = false }
-wit-bindgen-rust-macro = { version = "0.35.0", default-features = false }
+wit-bindgen = { git = "https://github.com/dicej/wit-bindgen", branch = "async-v1.221.2", default-features = false }
+wit-bindgen-rt = { git = "https://github.com/dicej/wit-bindgen", branch = "async-v1.221.2", default-features = false }
+wit-bindgen-rust-macro = { git = "https://github.com/dicej/wit-bindgen", branch = "async-v1.221.2", default-features = false }
# wasm-tools family:
-wasmparser = { version = "0.221.2", default-features = false, features = ['simd'] }
-wat = "1.221.2"
-wast = "221.0.2"
-wasmprinter = "0.221.2"
-wasm-encoder = "0.221.2"
-wasm-smith = "0.221.2"
-wasm-mutate = "0.221.2"
-wit-parser = "0.221.2"
-wit-component = "0.221.2"
-wasm-wave = "0.221.2"
+wasmparser = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2", default-features = false, features = ['simd'] }
+wat = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wast = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wasmprinter = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wasm-encoder = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wasm-smith = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wasm-mutate = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wit-parser = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wit-component = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wasm-wave = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
+wasm-compose = { git = "https://github.com/dicej/wasm-tools", branch = "async-v1.221.2" }
# Non-Bytecode Alliance maintained dependencies:
# --------------------------
diff --git a/benches/call.rs b/benches/call.rs
index 8e7d95aa8ffb..610b57452430 100644
--- a/benches/call.rs
+++ b/benches/call.rs
@@ -135,7 +135,7 @@ fn bench_host_to_wasm(
typed_results: Results,
) where
Params: WasmParams + ToVals + Copy,
- Results: WasmResults + ToVals + Copy + PartialEq + Debug,
+ Results: WasmResults + ToVals + Copy + PartialEq + Debug + Sync + 'static,
{
// Benchmark the "typed" version, which should be faster than the versions
// below.
@@ -628,7 +628,8 @@ mod component {
+ PartialEq
+ Debug
+ Send
- + Sync,
+ + Sync
+ + 'static,
{
// Benchmark the "typed" version.
c.bench_function(&format!("component - host-to-wasm - typed - {name}"), |b| {
diff --git a/crates/component-macro/Cargo.toml b/crates/component-macro/Cargo.toml
index 79dbc6a27353..5e38dd2977ce 100644
--- a/crates/component-macro/Cargo.toml
+++ b/crates/component-macro/Cargo.toml
@@ -41,3 +41,4 @@ similar = { workspace = true }
[features]
async = []
std = ['wasmtime-wit-bindgen/std']
+component-model-async = ['std', 'async', 'wasmtime-wit-bindgen/component-model-async']
diff --git a/crates/component-macro/src/bindgen.rs b/crates/component-macro/src/bindgen.rs
index b33bbc5bcb7c..10b2c415bc15 100644
--- a/crates/component-macro/src/bindgen.rs
+++ b/crates/component-macro/src/bindgen.rs
@@ -1,14 +1,15 @@
use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
-use std::collections::HashMap;
-use std::collections::HashSet;
+use std::collections::{HashMap, HashSet};
use std::env;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
use syn::parse::{Error, Parse, ParseStream, Result};
use syn::punctuated::Punctuated;
use syn::{braced, token, Token};
-use wasmtime_wit_bindgen::{AsyncConfig, Opts, Ownership, TrappableError, TrappableImports};
+use wasmtime_wit_bindgen::{
+ AsyncConfig, CallStyle, Opts, Ownership, TrappableError, TrappableImports,
+};
use wit_parser::{PackageId, Resolve, UnresolvedPackageGroup, WorldId};
pub struct Config {
@@ -20,13 +21,22 @@ pub struct Config {
}
pub fn expand(input: &Config) -> Result {
- if !cfg!(feature = "async") && input.opts.async_.maybe_async() {
+ if let (CallStyle::Async | CallStyle::Concurrent, false) =
+ (input.opts.call_style(), cfg!(feature = "async"))
+ {
return Err(Error::new(
Span::call_site(),
"cannot enable async bindings unless `async` crate feature is active",
));
}
+ if input.opts.concurrent_imports && !cfg!(feature = "component-model-async") {
+ return Err(Error::new(
+ Span::call_site(),
+ "cannot enable `concurrent_imports` option unless `component-model-async` crate feature is active",
+ ));
+ }
+
let mut src = match input.opts.generate(&input.resolve, input.world) {
Ok(s) => s,
Err(e) => return Err(Error::new(Span::call_site(), e.to_string())),
@@ -40,7 +50,10 @@ pub fn expand(input: &Config) -> Result {
// place a formatted version of the expanded code into a file. This file
// will then show up in rustc error messages for any codegen issues and can
// be inspected manually.
- if input.include_generated_code_from_file || std::env::var("WASMTIME_DEBUG_BINDGEN").is_ok() {
+ if input.include_generated_code_from_file
+ || input.opts.debug
+ || std::env::var("WASMTIME_DEBUG_BINDGEN").is_ok()
+ {
static INVOCATION: AtomicUsize = AtomicUsize::new(0);
let root = Path::new(env!("DEBUG_OUTPUT_DIR"));
let world_name = &input.resolve.worlds[input.world].name;
@@ -107,6 +120,7 @@ impl Parse for Config {
}
Opt::Tracing(val) => opts.tracing = val,
Opt::VerboseTracing(val) => opts.verbose_tracing = val,
+ Opt::Debug(val) => opts.debug = val,
Opt::Async(val, span) => {
if async_configured {
return Err(Error::new(span, "cannot specify second async config"));
@@ -114,6 +128,8 @@ impl Parse for Config {
async_configured = true;
opts.async_ = val;
}
+ Opt::ConcurrentImports(val) => opts.concurrent_imports = val,
+ Opt::ConcurrentExports(val) => opts.concurrent_exports = val,
Opt::TrappableErrorType(val) => opts.trappable_error_type = val,
Opt::TrappableImports(val) => opts.trappable_imports = val,
Opt::Ownership(val) => opts.ownership = val,
@@ -138,7 +154,7 @@ impl Parse for Config {
"cannot specify a world with `interfaces`",
));
}
- world = Some("interfaces".to_string());
+ world = Some("wasmtime:component-macro-synthesized/interfaces".to_string());
opts.only_interfaces = true;
}
@@ -281,6 +297,9 @@ mod kw {
syn::custom_keyword!(require_store_data_send);
syn::custom_keyword!(wasmtime_crate);
syn::custom_keyword!(include_generated_code_from_file);
+ syn::custom_keyword!(concurrent_imports);
+ syn::custom_keyword!(concurrent_exports);
+ syn::custom_keyword!(debug);
}
enum Opt {
@@ -301,12 +320,19 @@ enum Opt {
RequireStoreDataSend(bool),
WasmtimeCrate(syn::Path),
IncludeGeneratedCodeFromFile(bool),
+ ConcurrentImports(bool),
+ ConcurrentExports(bool),
+ Debug(bool),
}
impl Parse for Opt {
fn parse(input: ParseStream<'_>) -> Result {
let l = input.lookahead1();
- if l.peek(kw::path) {
+ if l.peek(kw::debug) {
+ input.parse::()?;
+ input.parse::()?;
+ Ok(Opt::Debug(input.parse::()?.value))
+ } else if l.peek(kw::path) {
input.parse::()?;
input.parse::()?;
@@ -380,6 +406,14 @@ impl Parse for Opt {
span,
))
}
+ } else if l.peek(kw::concurrent_imports) {
+ input.parse::()?;
+ input.parse::()?;
+ Ok(Opt::ConcurrentImports(input.parse::()?.value))
+ } else if l.peek(kw::concurrent_exports) {
+ input.parse::()?;
+ input.parse::()?;
+ Ok(Opt::ConcurrentExports(input.parse::()?.value))
} else if l.peek(kw::ownership) {
input.parse::()?;
input.parse::()?;
diff --git a/crates/component-macro/tests/expanded/char.rs b/crates/component-macro/tests/expanded/char.rs
index 6ff749f08e7f..edbc44e5a635 100644
--- a/crates/component-macro/tests/expanded/char.rs
+++ b/crates/component-macro/tests/expanded/char.rs
@@ -18,7 +18,7 @@ impl Clone for TheWorldPre {
}
}
}
-impl<_T> TheWorldPre<_T> {
+impl<_T: 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -152,7 +152,10 @@ const _: () = {
mut store: impl wasmtime::AsContextMut,
component: &wasmtime::component::Component,
linker: &wasmtime::component::Linker<_T>,
- ) -> wasmtime::Result {
+ ) -> wasmtime::Result
+ where
+ _T: 'static,
+ {
let pre = linker.instantiate_pre(component)?;
TheWorldPre::new(pre)?.instantiate(store)
}
@@ -194,19 +197,23 @@ pub mod foo {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()> {
let mut inst = linker.instance("foo:foo/chars")?;
inst.func_wrap(
@@ -354,7 +361,10 @@ pub mod exports {
&self,
mut store: S,
arg0: char,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(char,),
@@ -369,7 +379,10 @@ pub mod exports {
pub fn call_return_char(
&self,
mut store: S,
- ) -> wasmtime::Result {
+ ) -> wasmtime::Result
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
diff --git a/crates/component-macro/tests/expanded/char_async.rs b/crates/component-macro/tests/expanded/char_async.rs
index 730c6acb3213..ba02d7aff7b7 100644
--- a/crates/component-macro/tests/expanded/char_async.rs
+++ b/crates/component-macro/tests/expanded/char_async.rs
@@ -18,7 +18,7 @@ impl Clone for TheWorldPre {
}
}
}
-impl<_T> TheWorldPre<_T> {
+impl<_T: Send + 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -46,10 +46,7 @@ impl<_T> TheWorldPre<_T> {
pub async fn instantiate_async(
&self,
mut store: impl wasmtime::AsContextMut,
- ) -> wasmtime::Result
- where
- _T: Send,
- {
+ ) -> wasmtime::Result {
let mut store = store.as_context_mut();
let instance = self.instance_pre.instantiate_async(&mut store).await?;
self.indices.load(&mut store, &instance)
@@ -157,7 +154,7 @@ const _: () = {
linker: &wasmtime::component::Linker<_T>,
) -> wasmtime::Result
where
- _T: Send,
+ _T: Send + 'static,
{
let pre = linker.instantiate_pre(component)?;
TheWorldPre::new(pre)?.instantiate_async(store).await
@@ -202,19 +199,23 @@ pub mod foo {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host + Send;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host + Send,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host + Send>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()>
where
T: Send,
@@ -372,7 +373,7 @@ pub mod exports {
arg0: char,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -392,7 +393,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
diff --git a/crates/component-macro/tests/expanded/char_tracing_async.rs b/crates/component-macro/tests/expanded/char_tracing_async.rs
index aa1f926ea35f..9e7babae3067 100644
--- a/crates/component-macro/tests/expanded/char_tracing_async.rs
+++ b/crates/component-macro/tests/expanded/char_tracing_async.rs
@@ -18,7 +18,7 @@ impl Clone for TheWorldPre {
}
}
}
-impl<_T> TheWorldPre<_T> {
+impl<_T: Send + 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -46,10 +46,7 @@ impl<_T> TheWorldPre<_T> {
pub async fn instantiate_async(
&self,
mut store: impl wasmtime::AsContextMut,
- ) -> wasmtime::Result
- where
- _T: Send,
- {
+ ) -> wasmtime::Result {
let mut store = store.as_context_mut();
let instance = self.instance_pre.instantiate_async(&mut store).await?;
self.indices.load(&mut store, &instance)
@@ -157,7 +154,7 @@ const _: () = {
linker: &wasmtime::component::Linker<_T>,
) -> wasmtime::Result
where
- _T: Send,
+ _T: Send + 'static,
{
let pre = linker.instantiate_pre(component)?;
TheWorldPre::new(pre)?.instantiate_async(store).await
@@ -202,19 +199,23 @@ pub mod foo {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host + Send;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host + Send,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host + Send>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()>
where
T: Send,
@@ -401,7 +402,7 @@ pub mod exports {
arg0: char,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -430,7 +431,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
diff --git a/crates/component-macro/tests/expanded/conventions.rs b/crates/component-macro/tests/expanded/conventions.rs
index eb341bb8b471..d7c8ba0601d9 100644
--- a/crates/component-macro/tests/expanded/conventions.rs
+++ b/crates/component-macro/tests/expanded/conventions.rs
@@ -18,7 +18,7 @@ impl Clone for TheWorldPre {
}
}
}
-impl<_T> TheWorldPre<_T> {
+impl<_T: 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -154,7 +154,10 @@ const _: () = {
mut store: impl wasmtime::AsContextMut,
component: &wasmtime::component::Component,
linker: &wasmtime::component::Linker<_T>,
- ) -> wasmtime::Result {
+ ) -> wasmtime::Result
+ where
+ _T: 'static,
+ {
let pre = linker.instantiate_pre(component)?;
TheWorldPre::new(pre)?.instantiate(store)
}
@@ -242,19 +245,23 @@ pub mod foo {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()> {
let mut inst = linker.instance("foo:foo/conventions")?;
inst.func_wrap(
@@ -646,7 +653,10 @@ pub mod exports {
pub fn call_kebab_case(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -661,7 +671,10 @@ pub mod exports {
&self,
mut store: S,
arg0: LudicrousSpeed,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(LudicrousSpeed,),
@@ -675,7 +688,10 @@ pub mod exports {
pub fn call_function_with_dashes(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -688,7 +704,10 @@ pub mod exports {
}
pub fn call_function_with_no_weird_characters<
S: wasmtime::AsContextMut,
- >(&self, mut store: S) -> wasmtime::Result<()> {
+ >(&self, mut store: S) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -702,7 +721,10 @@ pub mod exports {
pub fn call_apple(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -716,7 +738,10 @@ pub mod exports {
pub fn call_apple_pear(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -730,7 +755,10 @@ pub mod exports {
pub fn call_apple_pear_grape(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -744,7 +772,10 @@ pub mod exports {
pub fn call_a0(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -763,7 +794,10 @@ pub mod exports {
pub fn call_is_xml(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -777,7 +811,10 @@ pub mod exports {
pub fn call_explicit(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -791,7 +828,10 @@ pub mod exports {
pub fn call_explicit_kebab(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
@@ -806,7 +846,10 @@ pub mod exports {
pub fn call_bool(
&self,
mut store: S,
- ) -> wasmtime::Result<()> {
+ ) -> wasmtime::Result<()>
+ where
+ ::Data: Send + 'static,
+ {
let callee = unsafe {
wasmtime::component::TypedFunc::<
(),
diff --git a/crates/component-macro/tests/expanded/conventions_async.rs b/crates/component-macro/tests/expanded/conventions_async.rs
index dfda26d25938..dfa01df619d9 100644
--- a/crates/component-macro/tests/expanded/conventions_async.rs
+++ b/crates/component-macro/tests/expanded/conventions_async.rs
@@ -18,7 +18,7 @@ impl Clone for TheWorldPre {
}
}
}
-impl<_T> TheWorldPre<_T> {
+impl<_T: Send + 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -46,10 +46,7 @@ impl<_T> TheWorldPre<_T> {
pub async fn instantiate_async(
&self,
mut store: impl wasmtime::AsContextMut,
- ) -> wasmtime::Result
- where
- _T: Send,
- {
+ ) -> wasmtime::Result {
let mut store = store.as_context_mut();
let instance = self.instance_pre.instantiate_async(&mut store).await?;
self.indices.load(&mut store, &instance)
@@ -159,7 +156,7 @@ const _: () = {
linker: &wasmtime::component::Linker<_T>,
) -> wasmtime::Result
where
- _T: Send,
+ _T: Send + 'static,
{
let pre = linker.instantiate_pre(component)?;
TheWorldPre::new(pre)?.instantiate_async(store).await
@@ -250,19 +247,23 @@ pub mod foo {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host + Send;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host + Send,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host + Send>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()>
where
T: Send,
@@ -684,7 +685,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -702,7 +703,7 @@ pub mod exports {
arg0: LudicrousSpeed,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -721,7 +722,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -737,7 +738,7 @@ pub mod exports {
S: wasmtime::AsContextMut,
>(&self, mut store: S) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -754,7 +755,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -771,7 +772,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -788,7 +789,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -805,7 +806,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -827,7 +828,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -844,7 +845,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -861,7 +862,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
@@ -879,7 +880,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
let callee = unsafe {
wasmtime::component::TypedFunc::<
diff --git a/crates/component-macro/tests/expanded/conventions_tracing_async.rs b/crates/component-macro/tests/expanded/conventions_tracing_async.rs
index d949eaae9fa2..5b2c4d3126d6 100644
--- a/crates/component-macro/tests/expanded/conventions_tracing_async.rs
+++ b/crates/component-macro/tests/expanded/conventions_tracing_async.rs
@@ -18,7 +18,7 @@ impl Clone for TheWorldPre {
}
}
}
-impl<_T> TheWorldPre<_T> {
+impl<_T: Send + 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -46,10 +46,7 @@ impl<_T> TheWorldPre<_T> {
pub async fn instantiate_async(
&self,
mut store: impl wasmtime::AsContextMut,
- ) -> wasmtime::Result
- where
- _T: Send,
- {
+ ) -> wasmtime::Result {
let mut store = store.as_context_mut();
let instance = self.instance_pre.instantiate_async(&mut store).await?;
self.indices.load(&mut store, &instance)
@@ -159,7 +156,7 @@ const _: () = {
linker: &wasmtime::component::Linker<_T>,
) -> wasmtime::Result
where
- _T: Send,
+ _T: Send + 'static,
{
let pre = linker.instantiate_pre(component)?;
TheWorldPre::new(pre)?.instantiate_async(store).await
@@ -250,19 +247,23 @@ pub mod foo {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host + Send;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host + Send,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host + Send>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()>
where
T: Send,
@@ -844,7 +845,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -873,7 +874,7 @@ pub mod exports {
arg0: LudicrousSpeed,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -901,7 +902,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -928,7 +929,7 @@ pub mod exports {
S: wasmtime::AsContextMut,
>(&self, mut store: S) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -957,7 +958,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -985,7 +986,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -1013,7 +1014,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -1041,7 +1042,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -1074,7 +1075,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -1102,7 +1103,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -1130,7 +1131,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
@@ -1159,7 +1160,7 @@ pub mod exports {
mut store: S,
) -> wasmtime::Result<()>
where
- ::Data: Send,
+ ::Data: Send + 'static,
{
use tracing::Instrument;
let span = tracing::span!(
diff --git a/crates/component-macro/tests/expanded/dead-code.rs b/crates/component-macro/tests/expanded/dead-code.rs
index 23f775721411..67f3e2b405de 100644
--- a/crates/component-macro/tests/expanded/dead-code.rs
+++ b/crates/component-macro/tests/expanded/dead-code.rs
@@ -18,7 +18,7 @@ impl Clone for ImportsPre {
}
}
}
-impl<_T> ImportsPre<_T> {
+impl<_T: 'static> ImportsPre<_T> {
/// Creates a new copy of `ImportsPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -142,7 +142,10 @@ const _: () = {
mut store: impl wasmtime::AsContextMut,
component: &wasmtime::component::Component,
linker: &wasmtime::component::Linker<_T>,
- ) -> wasmtime::Result {
+ ) -> wasmtime::Result
+ where
+ _T: 'static,
+ {
let pre = linker.instantiate_pre(component)?;
ImportsPre::new(pre)?.instantiate(store)
}
@@ -200,19 +203,23 @@ pub mod a {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()> {
let mut inst = linker.instance("a:b/interface-with-live-type")?;
inst.func_wrap(
@@ -247,19 +254,23 @@ pub mod a {
pub trait Host {}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()> {
let mut inst = linker.instance("a:b/interface-with-dead-type")?;
Ok(())
diff --git a/crates/component-macro/tests/expanded/dead-code_async.rs b/crates/component-macro/tests/expanded/dead-code_async.rs
index 7ba8b30a3908..d8e0de52d786 100644
--- a/crates/component-macro/tests/expanded/dead-code_async.rs
+++ b/crates/component-macro/tests/expanded/dead-code_async.rs
@@ -18,7 +18,7 @@ impl Clone for ImportsPre {
}
}
}
-impl<_T> ImportsPre<_T> {
+impl<_T: Send + 'static> ImportsPre<_T> {
/// Creates a new copy of `ImportsPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -46,10 +46,7 @@ impl<_T> ImportsPre<_T> {
pub async fn instantiate_async(
&self,
mut store: impl wasmtime::AsContextMut,
- ) -> wasmtime::Result
- where
- _T: Send,
- {
+ ) -> wasmtime::Result {
let mut store = store.as_context_mut();
let instance = self.instance_pre.instantiate_async(&mut store).await?;
self.indices.load(&mut store, &instance)
@@ -147,7 +144,7 @@ const _: () = {
linker: &wasmtime::component::Linker<_T>,
) -> wasmtime::Result
where
- _T: Send,
+ _T: Send + 'static,
{
let pre = linker.instantiate_pre(component)?;
ImportsPre::new(pre)?.instantiate_async(store).await
@@ -208,19 +205,23 @@ pub mod a {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host + Send;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host + Send,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host + Send>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()>
where
T: Send,
@@ -262,19 +263,23 @@ pub mod a {
pub trait Host: Send {}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host + Send;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host + Send,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host + Send>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()>
where
T: Send,
diff --git a/crates/component-macro/tests/expanded/dead-code_tracing_async.rs b/crates/component-macro/tests/expanded/dead-code_tracing_async.rs
index b394499697c0..9c774ed63485 100644
--- a/crates/component-macro/tests/expanded/dead-code_tracing_async.rs
+++ b/crates/component-macro/tests/expanded/dead-code_tracing_async.rs
@@ -18,7 +18,7 @@ impl Clone for ImportsPre {
}
}
}
-impl<_T> ImportsPre<_T> {
+impl<_T: Send + 'static> ImportsPre<_T> {
/// Creates a new copy of `ImportsPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -46,10 +46,7 @@ impl<_T> ImportsPre<_T> {
pub async fn instantiate_async(
&self,
mut store: impl wasmtime::AsContextMut,
- ) -> wasmtime::Result
- where
- _T: Send,
- {
+ ) -> wasmtime::Result {
let mut store = store.as_context_mut();
let instance = self.instance_pre.instantiate_async(&mut store).await?;
self.indices.load(&mut store, &instance)
@@ -147,7 +144,7 @@ const _: () = {
linker: &wasmtime::component::Linker<_T>,
) -> wasmtime::Result
where
- _T: Send,
+ _T: Send + 'static,
{
let pre = linker.instantiate_pre(component)?;
ImportsPre::new(pre)?.instantiate_async(store).await
@@ -208,19 +205,23 @@ pub mod a {
}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host + Send;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host + Send,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host + Send>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()>
where
T: Send,
@@ -275,19 +276,23 @@ pub mod a {
pub trait Host: Send {}
pub trait GetHost<
T,
- >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
+ D,
+ >: Fn(T) -> >::Host + Send + Sync + Copy + 'static {
type Host: Host + Send;
}
- impl GetHost for F
+ impl GetHost for F
where
F: Fn(T) -> O + Send + Sync + Copy + 'static,
O: Host + Send,
{
type Host = O;
}
- pub fn add_to_linker_get_host(
+ pub fn add_to_linker_get_host<
+ T,
+ G: for<'a> GetHost<&'a mut T, T, Host: Host + Send>,
+ >(
linker: &mut wasmtime::component::Linker,
- host_getter: impl for<'a> GetHost<&'a mut T>,
+ host_getter: G,
) -> wasmtime::Result<()>
where
T: Send,
diff --git a/crates/component-macro/tests/expanded/direct-import.rs b/crates/component-macro/tests/expanded/direct-import.rs
index 225fe6c9009f..eb1249d8bffb 100644
--- a/crates/component-macro/tests/expanded/direct-import.rs
+++ b/crates/component-macro/tests/expanded/direct-import.rs
@@ -18,7 +18,7 @@ impl Clone for FooPre {
}
}
}
-impl<_T> FooPre<_T> {
+impl<_T: 'static> FooPre<_T> {
/// Creates a new copy of `FooPre` bindings which can then
/// be used to instantiate into a particular store.
///
@@ -162,7 +162,10 @@ const _: () = {
mut store: impl wasmtime::AsContextMut,
component: &wasmtime::component::Component,
linker: &wasmtime::component::Linker<_T>,
- ) -> wasmtime::Result {
+ ) -> wasmtime::Result
+ where
+ _T: 'static,
+ {
let pre = linker.instantiate_pre(component)?;
FooPre::new(pre)?.instantiate(store)
}
diff --git a/crates/component-macro/tests/expanded/direct-import_async.rs b/crates/component-macro/tests/expanded/direct-import_async.rs
index a0ab29ebc481..2558ecafb028 100644
--- a/crates/component-macro/tests/expanded/direct-import_async.rs
+++ b/crates/component-macro/tests/expanded/direct-import_async.rs
@@ -18,7 +18,7 @@ impl Clone for FooPre