diff --git a/Cargo.lock b/Cargo.lock index b8bb85701..67a7f9979 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,20 +4,20 @@ version = 3 [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ "gimli", ] [[package]] name = "ahash" -version = "0.7.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "getrandom", + "cfg-if", "once_cell", "version_check", ] @@ -37,12 +37,6 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - [[package]] name = "async-trait" version = "0.1.66" @@ -62,9 +56,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.13.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" [[package]] name = "bincode" @@ -193,20 +187,17 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7379abaacee0f14abf3204a7606118f0465785252169d186337bcb75030815a" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9489fa336927df749631f1008007ced2871068544f40a202ce6d93fbf2366a7b" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ - "arrayvec", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", @@ -214,7 +205,7 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli", - "hashbrown", + "hashbrown 0.13.2", "log", "regalloc2", "smallvec", @@ -223,33 +214,29 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bbb67da91ec721ed57cef2f7c5ef7728e1cd9bde9ffd3ef8601022e73e3239" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418ecb2f36032f6665dc1a5e2060a143dbab41d83b784882e97710e890a7a16d" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" [[package]] name = "cranelift-entity" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cf583f7b093f291005f9fb1323e2c37f6ee4c7909e39ce016b2e8360d461705" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b66bf9e916f57fbbd0f7703ec6286f4624866bf45000111627c70d272c8dda1" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cranelift-codegen", "log", @@ -259,15 +246,13 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649782a39ce99798dd6b4029e2bb318a2fbeaade1b4fa25330763c10c65bc358" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" [[package]] name = "cranelift-native" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937e021e089c51f9749d09e7ad1c4f255c2f8686cb8c3df63a34b3ec9921bc41" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cranelift-codegen", "libc", @@ -276,9 +261,8 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.93.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d850cf6775477747c9dfda9ae23355dd70512ffebc70cf82b85a5b111ae668b5" +version = "0.95.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -286,7 +270,7 @@ dependencies = [ "itertools", "log", "smallvec", - "wasmparser 0.100.0", + "wasmparser 0.102.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmtime-types", ] @@ -329,7 +313,7 @@ dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset", "scopeguard", ] @@ -495,9 +479,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.2" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" dependencies = [ "fallible-iterator", "indexmap", @@ -522,6 +506,12 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash", ] @@ -596,7 +586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "serde", ] @@ -607,7 +597,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" dependencies = [ "libc", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -619,7 +609,7 @@ dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -717,15 +707,6 @@ dependencies = [ "rustix", ] -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.8.0" @@ -747,12 +728,12 @@ dependencies = [ [[package]] name = "object" -version = "0.29.0" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "crc32fast", - "hashbrown", + "hashbrown 0.13.2", "indexmap", "memchr", ] @@ -929,9 +910,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" +checksum = "80535183cae11b149d618fbd3c37e38d7cda589d82d7769e196ca9a9042d7621" dependencies = [ "fxhash", "log", @@ -973,7 +954,7 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -1011,6 +992,15 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + [[package]] name = "sha2" version = "0.10.6" @@ -1081,8 +1071,8 @@ name = "test-helpers" version = "0.0.0" dependencies = [ "codegen-macro", - "wasm-encoder 0.25.0", - "wat", + "wasm-encoder 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wat 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "wit-bindgen-core", "wit-component", "wit-parser", @@ -1149,6 +1139,40 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc18466501acd8ac6a3f615dd29a3438f8ca6bb3b19537138b3106e575621274" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "typenum" version = "1.16.0" @@ -1247,9 +1271,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.23.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c3e4bc09095436c8e7584d86d33e6c3ee67045af8fb262cbb9cc321de553428" +checksum = "4eff853c4f09eec94d76af527eddad4e9de13b11d6286a1ef7134bc30135a2b7" dependencies = [ "leb128", ] @@ -1257,8 +1281,7 @@ dependencies = [ [[package]] name = "wasm-encoder" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eff853c4f09eec94d76af527eddad4e9de13b11d6286a1ef7134bc30135a2b7" +source = "git+https://github.com/dicej/wasm-tools?branch=wit-templates#7add1823536b45447795ef1939885611b36e7a26" dependencies = [ "leb128", ] @@ -1266,21 +1289,20 @@ dependencies = [ [[package]] name = "wasm-metadata" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6956efd8a1a2c48a707e9a1b2da729834a0f8e4c58117493b0d9d089cee468" +source = "git+https://github.com/dicej/wasm-tools?branch=wit-templates#7add1823536b45447795ef1939885611b36e7a26" dependencies = [ "anyhow", "indexmap", "serde", - "wasm-encoder 0.25.0", - "wasmparser 0.102.0", + "wasm-encoder 0.25.0 (git+https://github.com/dicej/wasm-tools?branch=wit-templates)", + "wasmparser 0.102.0 (git+https://github.com/dicej/wasm-tools?branch=wit-templates)", ] [[package]] name = "wasmparser" -version = "0.100.0" +version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" dependencies = [ "indexmap", "url", @@ -1289,8 +1311,7 @@ dependencies = [ [[package]] name = "wasmparser" version = "0.102.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" +source = "git+https://github.com/dicej/wasm-tools?branch=wit-templates#7add1823536b45447795ef1939885611b36e7a26" dependencies = [ "indexmap", "url", @@ -1303,14 +1324,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa44d546e4e4479f2e91035fa497c0a05cffbf22413ad05bf0b06a789b9118f" dependencies = [ "anyhow", - "wasmparser 0.102.0", + "wasmparser 0.102.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasmtime" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e89f9819523447330ffd70367ef4a18d8c832e24e8150fe054d1d912841632" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "anyhow", "async-trait", @@ -1327,7 +1347,7 @@ dependencies = [ "rayon", "serde", "target-lexicon", - "wasmparser 0.100.0", + "wasmparser 0.102.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmtime-cache", "wasmtime-component-macro", "wasmtime-component-util", @@ -1336,24 +1356,22 @@ dependencies = [ "wasmtime-fiber", "wasmtime-jit", "wasmtime-runtime", - "wat", - "windows-sys 0.42.0", + "wat 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "windows-sys", ] [[package]] name = "wasmtime-asm-macros" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd3a5e46c198032da934469f3a6e48649d1f9142438e4fd4617b68a35644b8a" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b389ae9b678b9c3851091a4804f4182d688d27aff7abc9aa37fa7be37d8ecffa" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "anyhow", "base64", @@ -1364,16 +1382,15 @@ dependencies = [ "rustix", "serde", "sha2", - "toml", - "windows-sys 0.42.0", + "toml 0.5.11", + "windows-sys", "zstd", ] [[package]] name = "wasmtime-component-macro" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "059ded8e36aa047039093fb3203e719864b219ba706ef83115897208c45c7227" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "anyhow", "proc-macro2", @@ -1386,15 +1403,13 @@ dependencies = [ [[package]] name = "wasmtime-component-util" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925da75e4b2ba3a45671238037f8b496418c092dff287503ca4375824a234024" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" [[package]] name = "wasmtime-cranelift" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b2c92a08c0db6efffd88fdc97d7aa9c7c63b03edb0971dbca745469f820e8c" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "anyhow", "cranelift-codegen", @@ -1407,15 +1422,14 @@ dependencies = [ "object", "target-lexicon", "thiserror", - "wasmparser 0.100.0", + "wasmparser 0.102.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmtime-environ", ] [[package]] name = "wasmtime-environ" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a6db9fc52985ba06ca601f2ff0ff1f526c5d724c7ac267b47326304b0c97883" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "anyhow", "cranelift-entity", @@ -1426,8 +1440,8 @@ dependencies = [ "serde", "target-lexicon", "thiserror", - "wasm-encoder 0.23.0", - "wasmparser 0.100.0", + "wasm-encoder 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.102.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -1435,22 +1449,20 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07739b74248aa609a51061956735e3e394cc9e0fe475e8f821bc837f12d5e547" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cc", "cfg-if", "rustix", "wasmtime-asm-macros", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] name = "wasmtime-jit" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b77e3a52cd84d0f7f18554afa8060cfe564ccac61e3b0802d3fd4084772fa5f6" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "addr2line", "anyhow", @@ -1468,14 +1480,13 @@ dependencies = [ "wasmtime-jit-debug", "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] name = "wasmtime-jit-debug" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0245e8a9347017c7185a72e215218a802ff561545c242953c11ba00fccc930f" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "object", "once_cell", @@ -1484,20 +1495,18 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67d412e9340ab1c83867051d8d1d7c90aa8c9afc91da086088068e2734e25064" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cfg-if", "libc", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] name = "wasmtime-runtime" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d594e791b5fdd4dbaf8cf7ae62f2e4ff85018ce90f483ca6f42947688e48827d" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "anyhow", "cc", @@ -1508,7 +1517,7 @@ dependencies = [ "log", "mach", "memfd", - "memoffset 0.6.5", + "memoffset", "paste", "rand", "rustix", @@ -1516,26 +1525,24 @@ dependencies = [ "wasmtime-environ", "wasmtime-fiber", "wasmtime-jit-debug", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] name = "wasmtime-types" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6688d6f96d4dbc1f89fab626c56c1778936d122b5f4ae7a57c2eb42b8d982e2" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "cranelift-entity", "serde", "thiserror", - "wasmparser 0.100.0", + "wasmparser 0.102.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasmtime-wit-bindgen" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85c2889e5b4fd2713f02238c7bce6bd4a7e901e1ef251f8b414d5d9449167ea" +version = "8.0.0" +source = "git+https://github.com/dicej/wasmtime?branch=wit-templates-minimal#8f9b37cfa4a45a4d03dd8724790b0bf0d857f712" dependencies = [ "anyhow", "heck", @@ -1551,7 +1558,18 @@ dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.25.0", + "wasm-encoder 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wast" +version = "55.0.0" +source = "git+https://github.com/dicej/wasm-tools?branch=wit-templates#7add1823536b45447795ef1939885611b36e7a26" +dependencies = [ + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.25.0 (git+https://github.com/dicej/wasm-tools?branch=wit-templates)", ] [[package]] @@ -1560,7 +1578,15 @@ version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af2b53f4da14db05d32e70e9c617abdf6620c575bd5dd972b7400037b4df2091" dependencies = [ - "wast", + "wast 55.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wat" +version = "1.0.61" +source = "git+https://github.com/dicej/wasm-tools?branch=wit-templates#7add1823536b45447795ef1939885611b36e7a26" +dependencies = [ + "wast 55.0.0 (git+https://github.com/dicej/wasm-tools?branch=wit-templates)", ] [[package]] @@ -1594,21 +1620,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -1675,6 +1686,15 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +[[package]] +name = "winnow" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" +dependencies = [ + "memchr", +] + [[package]] name = "wit-bindgen" version = "0.4.0" @@ -1691,7 +1711,7 @@ dependencies = [ "clap", "heck", "test-helpers", - "wasm-encoder 0.25.0", + "wasm-encoder 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -1705,9 +1725,10 @@ dependencies = [ "clap", "heck", "test-artifacts", - "wasm-encoder 0.25.0", + "toml 0.7.3", + "wasm-encoder 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmtime", - "wat", + "wat 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "wit-bindgen-c", "wit-bindgen-core", "wit-bindgen-go", @@ -1779,6 +1800,7 @@ dependencies = [ "anyhow", "proc-macro2", "syn", + "toml 0.7.3", "wit-bindgen-core", "wit-bindgen-rust", "wit-component", @@ -1798,27 +1820,25 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e93680c292afbad08ec462c901714ba53e5109076003e53a82e584f3aa319bc" +version = "0.7.4" +source = "git+https://github.com/dicej/wasm-tools?branch=wit-templates#7add1823536b45447795ef1939885611b36e7a26" dependencies = [ "anyhow", "bitflags", "indexmap", "log", "url", - "wasm-encoder 0.25.0", + "wasm-encoder 0.25.0 (git+https://github.com/dicej/wasm-tools?branch=wit-templates)", "wasm-metadata", - "wasmparser 0.102.0", - "wat", + "wasmparser 0.102.0 (git+https://github.com/dicej/wasm-tools?branch=wit-templates)", + "wat 1.0.61 (git+https://github.com/dicej/wasm-tools?branch=wit-templates)", "wit-parser", ] [[package]] name = "wit-parser" version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f887c3da527a51b321076ebe6a7513026a4757b6d4d144259946552d6fc728b3" +source = "git+https://github.com/dicej/wasm-tools?branch=wit-templates#7add1823536b45447795ef1939885611b36e7a26" dependencies = [ "anyhow", "id-arena", diff --git a/Cargo.toml b/Cargo.toml index d1d0a8888..283efcde7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,8 +32,8 @@ indexmap = "1.9.1" wasm-encoder = "0.25.0" wasm-metadata = "0.3.1" wat = "1.0.61" -wit-parser = "0.6.3" -wit-component = "0.7.2" +wit-parser = "0.6.4" +wit-component = "0.7.3" wit-bindgen-core = { path = 'crates/core', version = '0.4.0' } wit-bindgen-c = { path = 'crates/c', version = '0.4.0' } @@ -60,6 +60,7 @@ wit-bindgen-go = { workspace = true, features = ['clap'], optional = true } wat = { workspace = true } wit-component = { workspace = true } wasm-encoder = { workspace = true } +toml = "0.7.2" [features] default = ['c', 'rust', 'markdown', 'teavm-java', 'go'] @@ -71,6 +72,13 @@ go = ['dep:wit-bindgen-go'] [dev-dependencies] heck = { workspace = true } -wasmtime = { version = "6", features = ['component-model'] } +wasmtime = { version = "8", features = ['component-model'] } test-artifacts = { path = 'crates/test-rust-wasm/artifacts' } wit-parser = { workspace = true } + +[patch.crates-io] +wit-component = { git = "https://github.com/dicej/wasm-tools", branch = "wit-templates" } +wit-parser = { git = "https://github.com/dicej/wasm-tools", branch = "wit-templates" } +wasm-metadata = { git = "https://github.com/dicej/wasm-tools", branch = "wit-templates" } +wasmtime = { git = "https://github.com/dicej/wasmtime", branch = "wit-templates-minimal" } +wasmtime-wit-bindgen = { git = "https://github.com/dicej/wasmtime", branch = "wit-templates-minimal" } diff --git a/crates/rust-macro/Cargo.toml b/crates/rust-macro/Cargo.toml index 45c47406c..4e5ce17a1 100644 --- a/crates/rust-macro/Cargo.toml +++ b/crates/rust-macro/Cargo.toml @@ -22,3 +22,4 @@ wit-bindgen-core = { workspace = true } wit-bindgen-rust = { workspace = true } wit-component = { workspace = true } anyhow = { workspace = true } +toml = "0.7.2" diff --git a/crates/rust-macro/src/lib.rs b/crates/rust-macro/src/lib.rs index aec0f050c..f0cf10ac6 100644 --- a/crates/rust-macro/src/lib.rs +++ b/crates/rust-macro/src/lib.rs @@ -1,9 +1,10 @@ use proc_macro2::{Span, TokenStream}; +use std::fs; use std::path::{Path, PathBuf}; use syn::parse::{Error, Parse, ParseStream, Result}; use syn::punctuated::Punctuated; use syn::{token, Token}; -use wit_bindgen_core::wit_parser::{PackageId, Resolve, UnresolvedPackage, WorldId}; +use wit_bindgen_core::wit_parser::{self, PackageId, Resolve, UnresolvedPackage, WorldId}; use wit_bindgen_rust::Opts; #[proc_macro] @@ -32,6 +33,7 @@ impl Parse for Config { let mut opts = Opts::default(); let mut world = None; let mut source = None; + let mut substitutions = None; if input.peek(token::Brace) { let content; @@ -57,6 +59,24 @@ impl Parse for Config { } source = Some(Source::Inline(s.value())); } + Opt::SubstitutionsPath(s) => { + if substitutions.is_some() { + return Err(Error::new( + s.span(), + "cannot specify second substitutions", + )); + } + substitutions = Some(Source::Path(s.value())); + } + Opt::SubstitutionsInline(s) => { + if substitutions.is_some() { + return Err(Error::new( + s.span(), + "cannot specify second substitutions", + )); + } + substitutions = Some(Source::Inline(s.value())); + } Opt::UseStdFeature => opts.std_feature = true, Opt::RawStrings => opts.raw_strings = true, Opt::MacroExport => opts.macro_export = true, @@ -71,8 +91,8 @@ impl Parse for Config { source = Some(Source::Path(input.parse::()?.value())); } } - let (resolve, pkg, files) = - parse_source(&source).map_err(|err| Error::new(call_site, format!("{err:?}")))?; + let (resolve, pkg, files) = parse_source(&source, &substitutions) + .map_err(|err| Error::new(call_site, format!("{err:?}")))?; let world = resolve .select_world(pkg, world.as_deref()) .map_err(|e| Error::new(call_site, format!("{e:?}")))?; @@ -85,7 +105,10 @@ impl Parse for Config { } } -fn parse_source(source: &Option) -> anyhow::Result<(Resolve, PackageId, Vec)> { +fn parse_source( + source: &Option, + substitutions: &Option, +) -> anyhow::Result<(Resolve, PackageId, Vec)> { let mut resolve = Resolve::default(); let mut files = Vec::new(); let root = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()); @@ -108,7 +131,14 @@ fn parse_source(source: &Option) -> anyhow::Result<(Resolve, PackageId, Some(Source::Path(s)) => parse(&root.join(&s))?, None => parse(&root.join("wit"))?, }; - + match substitutions { + Some(Source::Inline(s)) => wit_parser::expand(&mut resolve, toml::from_str(s)?)?, + Some(Source::Path(s)) => wit_parser::expand( + &mut resolve, + toml::from_str(&fs::read_to_string(&root.join(&s))?)?, + )?, + None => (), + } Ok((resolve, pkg, files)) } @@ -146,12 +176,16 @@ mod kw { syn::custom_keyword!(world); syn::custom_keyword!(path); syn::custom_keyword!(inline); + syn::custom_keyword!(substitutions_path); + syn::custom_keyword!(substitutions_inline); } enum Opt { World(syn::LitStr), Path(syn::LitStr), Inline(syn::LitStr), + SubstitutionsPath(syn::LitStr), + SubstitutionsInline(syn::LitStr), UseStdFeature, RawStrings, MacroExport, @@ -171,6 +205,14 @@ impl Parse for Opt { input.parse::()?; input.parse::()?; Ok(Opt::Inline(input.parse()?)) + } else if l.peek(kw::substitutions_path) { + input.parse::()?; + input.parse::()?; + Ok(Opt::SubstitutionsPath(input.parse()?)) + } else if l.peek(kw::substitutions_inline) { + input.parse::()?; + input.parse::()?; + Ok(Opt::SubstitutionsInline(input.parse()?)) } else if l.peek(kw::world) { input.parse::()?; input.parse::()?; diff --git a/crates/test-rust-wasm/Cargo.toml b/crates/test-rust-wasm/Cargo.toml index c8e149160..e2d321ea8 100644 --- a/crates/test-rust-wasm/Cargo.toml +++ b/crates/test-rust-wasm/Cargo.toml @@ -47,3 +47,7 @@ test = false [[bin]] name = "results" test = false + +[[bin]] +name = "wildcards" +test = false diff --git a/crates/test-rust-wasm/src/bin/wildcards.rs b/crates/test-rust-wasm/src/bin/wildcards.rs new file mode 100644 index 000000000..9f0328961 --- /dev/null +++ b/crates/test-rust-wasm/src/bin/wildcards.rs @@ -0,0 +1,3 @@ +include!("../../../../tests/runtime/wildcards/wasm.rs"); + +fn main() {} diff --git a/src/bin/wit-bindgen.rs b/src/bin/wit-bindgen.rs index 3698721b5..ab1ee2f6e 100644 --- a/src/bin/wit-bindgen.rs +++ b/src/bin/wit-bindgen.rs @@ -1,7 +1,7 @@ use anyhow::{bail, Context, Result}; use clap::Parser; use std::path::PathBuf; -use std::str; +use std::{fs, str}; use wit_bindgen_core::{wit_parser, Files, WorldGenerator}; use wit_parser::{Resolve, UnresolvedPackage}; @@ -78,6 +78,10 @@ struct Common { /// they're up-to-date with the source files. #[clap(long)] check: bool, + + /// Path to template substitutions for expansion. + #[clap(long)] + expand: Option, } fn main() -> Result<()> { @@ -143,6 +147,15 @@ fn gen_world( opts: &Common, files: &mut Files, ) -> Result<()> { + let substitutions = match &opts.expand { + Some(path) => { + let input = + fs::read_to_string(path).context("failed to read substitutions from file")?; + toml::from_str(&input).context("failed to parse substitutions from TOML")? + } + None => Default::default(), + }; + let mut resolve = Resolve::default(); let pkg = if opts.wit.is_dir() { resolve.push_dir(&opts.wit)?.0 @@ -152,6 +165,8 @@ fn gen_world( &Default::default(), )? }; + + wit_parser::expand(&mut resolve, substitutions)?; let world = resolve.select_world(pkg, opts.world.as_deref())?; generator.generate(&resolve, world, files); Ok(()) diff --git a/tests/runtime/flavorful.rs b/tests/runtime/flavorful.rs index 34dd4490b..85e81a728 100644 --- a/tests/runtime/flavorful.rs +++ b/tests/runtime/flavorful.rs @@ -9,7 +9,7 @@ pub struct MyImports { errored: bool, } -impl imports::Imports for MyImports { +impl imports::Host for MyImports { fn f_list_in_record1(&mut self, ty: imports::ListInRecord1Result) -> Result<()> { assert_eq!(ty.a, "list_in_record1"); Ok(()) diff --git a/tests/runtime/lists.rs b/tests/runtime/lists.rs index 5bb52d9d0..ec735e26d 100644 --- a/tests/runtime/lists.rs +++ b/tests/runtime/lists.rs @@ -8,7 +8,7 @@ use imports::*; #[derive(Default)] pub struct MyImports; -impl Imports for MyImports { +impl Host for MyImports { fn empty_list_param(&mut self, a: Vec) -> Result<()> { assert_eq!(a, []); Ok(()) diff --git a/tests/runtime/main.rs b/tests/runtime/main.rs index 37c2e22a5..120867b19 100644 --- a/tests/runtime/main.rs +++ b/tests/runtime/main.rs @@ -18,13 +18,14 @@ mod smoke; mod strings; mod unions; mod variants; +mod wildcards; wasmtime::component::bindgen!("testwasi" in "crates/wasi_snapshot_preview1/wit"); #[derive(Default)] struct Wasi(T); -impl testwasi::Testwasi for Wasi { +impl testwasi::Host for Wasi { fn log(&mut self, bytes: Vec) -> Result<()> { std::io::stdout().write_all(&bytes)?; Ok(()) diff --git a/tests/runtime/many_arguments.rs b/tests/runtime/many_arguments.rs index 73bbdf44b..e00fc388d 100644 --- a/tests/runtime/many_arguments.rs +++ b/tests/runtime/many_arguments.rs @@ -6,7 +6,7 @@ wasmtime::component::bindgen!("world" in "tests/runtime/many_arguments"); #[derive(Default)] pub struct MyImports {} -impl imports::Imports for MyImports { +impl imports::Host for MyImports { fn many_arguments( &mut self, a1: u64, diff --git a/tests/runtime/numbers.rs b/tests/runtime/numbers.rs index e67831c14..269595291 100644 --- a/tests/runtime/numbers.rs +++ b/tests/runtime/numbers.rs @@ -8,7 +8,7 @@ pub struct MyImports { scalar: u32, } -impl imports::Imports for MyImports { +impl imports::Host for MyImports { fn roundtrip_u8(&mut self, val: u8) -> Result { Ok(val) } diff --git a/tests/runtime/records.rs b/tests/runtime/records.rs index c30e22eb4..14751e5da 100644 --- a/tests/runtime/records.rs +++ b/tests/runtime/records.rs @@ -6,7 +6,7 @@ wasmtime::component::bindgen!("world" in "tests/runtime/records"); #[derive(Default)] pub struct MyImports; -impl imports::Imports for MyImports { +impl imports::Host for MyImports { fn multiple_results(&mut self) -> Result<(u8, u16)> { Ok((4, 5)) } diff --git a/tests/runtime/smoke.rs b/tests/runtime/smoke.rs index 5b015a44c..850aecd93 100644 --- a/tests/runtime/smoke.rs +++ b/tests/runtime/smoke.rs @@ -8,7 +8,7 @@ pub struct MyImports { hit: bool, } -impl imports::Imports for MyImports { +impl imports::Host for MyImports { fn thunk(&mut self) -> Result<()> { self.hit = true; println!("in the host"); diff --git a/tests/runtime/strings.rs b/tests/runtime/strings.rs index a74448ba6..9c5389942 100644 --- a/tests/runtime/strings.rs +++ b/tests/runtime/strings.rs @@ -6,7 +6,7 @@ wasmtime::component::bindgen!("world" in "tests/runtime/strings"); #[derive(Default)] pub struct MyImports; -impl imports::Imports for MyImports { +impl imports::Host for MyImports { fn take_basic(&mut self, s: String) -> Result<()> { assert_eq!(s, "latin utf16"); Ok(()) diff --git a/tests/runtime/unions.rs b/tests/runtime/unions.rs index b1f9d5f59..8afb0805c 100644 --- a/tests/runtime/unions.rs +++ b/tests/runtime/unions.rs @@ -6,7 +6,7 @@ wasmtime::component::bindgen!("world" in "tests/runtime/unions"); #[derive(Default)] pub struct MyImports; -impl imports::Imports for MyImports { +impl imports::Host for MyImports { fn add_one_integer(&mut self, num: imports::AllIntegers) -> Result { use imports::AllIntegers; Ok(match num { diff --git a/tests/runtime/variants.rs b/tests/runtime/variants.rs index 99ddb9abc..dfd3293e7 100644 --- a/tests/runtime/variants.rs +++ b/tests/runtime/variants.rs @@ -6,7 +6,7 @@ wasmtime::component::bindgen!("world" in "tests/runtime/variants"); #[derive(Default)] pub struct MyImports; -impl imports::Imports for MyImports { +impl imports::Host for MyImports { fn roundtrip_option(&mut self, a: Option) -> anyhow::Result> { Ok(a.map(|x| x as u8)) } diff --git a/tests/runtime/wildcards.rs b/tests/runtime/wildcards.rs new file mode 100644 index 000000000..3fab4f281 --- /dev/null +++ b/tests/runtime/wildcards.rs @@ -0,0 +1,52 @@ +use anyhow::Result; +use wasmtime::Store; + +wasmtime::component::bindgen!(in "tests/runtime/wildcards"); + +#[derive(Default)] +struct Host; + +impl imports::Host for Host {} + +struct Match(u32); + +impl imports::WildcardMatch for Match { + fn call(&self, _host: &mut Host, _name: &str) -> Result { + Ok(self.0) + } +} + +#[test] +fn run() -> Result<()> { + eprintln!("yossa hello"); + crate::run_test( + "wildcards", + |linker| { + eprintln!("yossa add to linker"); + Wildcards::add_to_linker( + linker, + WildcardMatches { + imports: vec![("a", Match(42)), ("b", Match(43)), ("c", Match(44))], + }, + |x| &mut x.0, + ) + }, + |store, component, linker| Wildcards::instantiate(store, component, linker), + run_test, + ) +} + +fn run_test(wildcards: Wildcards, store: &mut Store>) -> Result<()> { + for (name, value) in [("x", 42), ("y", 43), ("z", 44)] { + assert_eq!( + value, + wildcards + .exports + .get_wildcard_match(name) + .unwrap() + .call(&mut *store)? + ); + } + + Ok(()) +} diff --git a/tests/runtime/wildcards/substitutions.toml b/tests/runtime/wildcards/substitutions.toml new file mode 100644 index 000000000..f37f539f4 --- /dev/null +++ b/tests/runtime/wildcards/substitutions.toml @@ -0,0 +1,3 @@ +[wildcards] +imports = ["a", "b", "c"] +exports = ["x", "y", "z"] diff --git a/tests/runtime/wildcards/wasm.rs b/tests/runtime/wildcards/wasm.rs new file mode 100644 index 000000000..5ceb381ed --- /dev/null +++ b/tests/runtime/wildcards/wasm.rs @@ -0,0 +1,21 @@ +wit_bindgen::generate!({ + world: "world", + path: "../../tests/runtime/wildcards", + substitutions_path: "../../tests/runtime/wildcards/substitutions.toml", +}); + +struct Exports; + +export_wildcards!(Exports); + +impl exports::Exports for Exports { + fn x() -> u32 { + imports::a() + } + fn y() -> u32 { + imports::b() + } + fn z() -> u32 { + imports::c() + } +} diff --git a/tests/runtime/wildcards/world.wit b/tests/runtime/wildcards/world.wit new file mode 100644 index 000000000..04d6529d4 --- /dev/null +++ b/tests/runtime/wildcards/world.wit @@ -0,0 +1,8 @@ +interface foo { + *: func() -> u32 +} + +default world wildcards { + import imports: self.foo + export exports: self.foo +}