diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ad6dc817..d84ceb0b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,7 +14,7 @@ on: env: go-modules: ./... ./cm/... - wasm-tools-version: "1.229.0" + wasm-tools-version: "1.230.0" wasmtime-version: "26.0.0" jobs: diff --git a/internal/wasmtools/Cargo.lock b/internal/wasmtools/Cargo.lock index fac49897..fd9a1bc6 100644 --- a/internal/wasmtools/Cargo.lock +++ b/internal/wasmtools/Cargo.lock @@ -47,36 +47,37 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.59.0", + "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", - "windows-sys 0.59.0", + "once_cell", + "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytesize" @@ -92,9 +93,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.21" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" dependencies = [ "clap_builder", "clap_derive", @@ -102,9 +103,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" dependencies = [ "anstream", "anstyle", @@ -115,9 +116,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" dependencies = [ "heck", "proc-macro2", @@ -127,9 +128,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" @@ -139,12 +140,11 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "comfy-table" -version = "7.1.3" +version = "7.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f165e7b643266ea80cb858aed492ad9280e3e05ce24d4a99d7d7b889b6a4d9" +checksum = "4a65ebfec4fb190b6f90e944a817d60499ee0744e582530e2c9900a22e591d9a" dependencies = [ - "strum", - "strum_macros", + "unicode-segmentation", "unicode-width", ] @@ -156,9 +156,9 @@ checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "env_filter" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ "log", "regex", @@ -166,31 +166,31 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" dependencies = [ "anstream", "anstyle", "env_filter", - "humantime", + "jiff", "log", ] [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -201,15 +201,27 @@ checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "foldhash" -version = "0.1.3" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "getrandom" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi", +] [[package]] name = "gimli" @@ -224,9 +236,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" dependencies = [ "foldhash", ] @@ -237,12 +249,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "id-arena" version = "2.2.1" @@ -251,9 +257,9 @@ checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" [[package]] name = "indexmap" -version = "2.7.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", "hashbrown", @@ -268,9 +274,33 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jiff" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f02000660d30638906021176af16b17498bd0d12813dbfe7b276d8bc7f3c0806" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "f3c30758ddd7188629c6713fc45d1188af4f44c90582311d0c8d8c9907f60c48" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "leb128fmt" @@ -280,21 +310,21 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.166" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "log" -version = "0.4.22" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "memchr" @@ -304,9 +334,24 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "portable-atomic" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] [[package]] name = "pretty_assertions" @@ -320,22 +365,28 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "regex" version = "1.11.1" @@ -367,52 +418,46 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustix" -version = "0.38.41" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys", ] -[[package]] -name = "rustversion" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" - [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "semver" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.215" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -421,9 +466,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -443,30 +488,11 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - [[package]] name = "syn" -version = "2.0.89" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -475,15 +501,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.14.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ - "cfg-if", "fastrand", + "getrandom", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -497,19 +523,25 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +checksum = "45c6481c4829e4cc63825e62c49186a34538b7b2750b73b266581ffb612fb5ed" dependencies = [ "rustix", - "windows-sys 0.59.0", + "windows-sys", ] [[package]] name = "unicode-ident" -version = "1.0.14" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" @@ -529,11 +561,20 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-encoder" -version = "0.229.0" +version = "0.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ba1d491ecacb085a2552025c10a675a6fddcbd03b1fc9b36c536010ce265d2" +checksum = "d4349d0943718e6e434b51b9639e876293093dca4b96384fb136ab5bd5ce6660" dependencies = [ "leb128fmt", "wasmparser", @@ -541,9 +582,9 @@ dependencies = [ [[package]] name = "wasm-metadata" -version = "0.229.0" +version = "0.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78fdb7d29a79191ab363dc90c1ddd3a1e880ffd5348d92d48482393a9e6c5f4d" +checksum = "1a52e010df5494f4289ccc68ce0c2a8c17555225a5e55cc41b98f5ea28d0844b" dependencies = [ "anyhow", "indexmap", @@ -553,9 +594,9 @@ dependencies = [ [[package]] name = "wasm-tools" -version = "1.229.0" +version = "1.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccddd7e27763b2079d2d49af44ba80f0a50505aa6ccd0126839e8137bc7eb941" +checksum = "79ecf18765c9d55a63cd4582156b067bc3bbde321ce2b06208f26b02101581d3" dependencies = [ "anyhow", "bytesize", @@ -585,9 +626,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.229.0" +version = "0.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc3b1f053f5d41aa55640a1fa9b6d1b8a9e4418d118ce308d20e24ff3575a8c" +checksum = "808198a69b5a0535583370a51d459baa14261dfab04800c4864ee9e1a14346ed" dependencies = [ "bitflags", "hashbrown", @@ -597,9 +638,9 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.229.0" +version = "0.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25dac01892684a99b8fbfaf670eb6b56edea8a096438c75392daeb83156ae2e" +checksum = "9dc8e9a1e48f4b2247b006b3a9b0a02ba62a2e52cfcfd4bc4c70785a6104fc32" dependencies = [ "anyhow", "termcolor", @@ -608,9 +649,9 @@ dependencies = [ [[package]] name = "wast" -version = "229.0.0" +version = "230.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63fcaff613c12225696bb163f79ca38ffb40e9300eff0ff4b8aa8b2f7eadf0d9" +checksum = "b8edac03c5fa691551531533928443faf3dc61a44f814a235c7ec5d17b7b34f1" dependencies = [ "bumpalo", "gimli", @@ -622,9 +663,9 @@ dependencies = [ [[package]] name = "wat" -version = "1.229.0" +version = "1.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4189bad08b70455a9e9e67dc126d2dcf91fac143a80f1046747a5dde6d4c33e0" +checksum = "0d77d62229e38db83eac32bacb5f61ebb952366ab0dae90cf2b3c07a65eea894" dependencies = [ "wast", ] @@ -635,16 +676,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", + "windows-sys", ] [[package]] @@ -720,11 +752,20 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + [[package]] name = "wit-component" -version = "0.229.0" +version = "0.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f550067740e223bfe6c4878998e81cdbe2529dd9a793dc49248dd6613394e8b" +checksum = "b607b15ead6d0e87f5d1613b4f18c04d4e80ceeada5ffa608d8360e6909881df" dependencies = [ "anyhow", "bitflags", @@ -743,9 +784,9 @@ dependencies = [ [[package]] name = "wit-encoder" -version = "0.229.0" +version = "0.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52b22120872fbeea51d41381dbd5c91395a9c8ceec77102d49a0bc6b503984ed" +checksum = "23f89e381f89c6046860c701dbd4f3f35d92510e56d9c69430c2c1f736247109" dependencies = [ "id-arena", "pretty_assertions", @@ -756,9 +797,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.229.0" +version = "0.230.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459c6ba62bf511d6b5f2a845a2a736822e38059c1cfa0b644b467bbbfae4efa6" +checksum = "679fde5556495f98079a8e6b9ef8c887f731addaffa3d48194075c1dd5cd611b" dependencies = [ "anyhow", "id-arena", diff --git a/internal/wasmtools/Cargo.toml b/internal/wasmtools/Cargo.toml index 1549160c..3517fcb8 100644 --- a/internal/wasmtools/Cargo.toml +++ b/internal/wasmtools/Cargo.toml @@ -3,7 +3,7 @@ name = 'wasm-tools-go' edition = '2021' [dependencies] -wasm-tools = { version = '1.229.0', default-features = false, features = [ +wasm-tools = { version = '1.230.0', default-features = false, features = [ 'component', ] } diff --git a/internal/wasmtools/wasm-tools.wasm.gz b/internal/wasmtools/wasm-tools.wasm.gz index 422ec92a..ad64e31c 100644 Binary files a/internal/wasmtools/wasm-tools.wasm.gz and b/internal/wasmtools/wasm-tools.wasm.gz differ diff --git a/testdata/codegen/issue573.wit.json b/testdata/codegen/issue573.wit.json index ffca5096..058be787 100644 --- a/testdata/codegen/issue573.wit.json +++ b/testdata/codegen/issue573.wit.json @@ -8,6 +8,16 @@ "id": 0 } }, + "interface-1": { + "interface": { + "id": 1 + } + }, + "inline": { + "interface": { + "id": 3 + } + }, "t2-renamed": { "type": 39 }, @@ -23,11 +33,6 @@ "empty": { "type": 43 }, - "interface-1": { - "interface": { - "id": 1 - } - }, "print": { "function": { "name": "print", @@ -43,11 +48,6 @@ } ] } - }, - "inline": { - "interface": { - "id": 3 - } } }, "exports": { diff --git a/testdata/codegen/issue573.wit.json.golden.wit b/testdata/codegen/issue573.wit.json.golden.wit index bbd416c7..ec20c657 100644 --- a/testdata/codegen/issue573.wit.json.golden.wit +++ b/testdata/codegen/issue573.wit.json.golden.wit @@ -85,6 +85,12 @@ interface api { world types-example { import types-interface; + import api-imports; + /// Comment for import inline + import inline: interface { + /// Comment for import inline function + inline-imp: func(args: list>) -> result<_, char>; + } use types-interface.{t2 as t2-renamed}; use types-interface.{t10}; use types-interface.{permissions}; @@ -98,13 +104,7 @@ world types-example { /// NB: this record used to be empty, but that's no longer valid, so now it's /// non-empty. Don't want to delete the whole test however. record empty { not-empty-anymore: bool } - import api-imports; import print: func(message: string, level: log-level); - /// Comment for import inline - import inline: interface { - /// Comment for import inline function - inline-imp: func(args: list>) -> result<_, char>; - } export f-f1: func(typedef: t10) -> t10; export f1: func(f: f32, f-list: list>) -> tuple; /// t2 has been renamed with `use self.types-interface.{t2 as t2-renamed}` diff --git a/testdata/codegen/lift-lower-foreign.wit.json b/testdata/codegen/lift-lower-foreign.wit.json index 37d30bba..3127748e 100644 --- a/testdata/codegen/lift-lower-foreign.wit.json +++ b/testdata/codegen/lift-lower-foreign.wit.json @@ -8,6 +8,11 @@ "id": 0 } }, + "interface-1": { + "interface": { + "id": 1 + } + }, "u1": { "type": 20 }, @@ -37,11 +42,6 @@ }, "u11": { "type": 29 - }, - "interface-1": { - "interface": { - "id": 1 - } } }, "exports": { diff --git a/testdata/codegen/lift-lower-foreign.wit.json.golden.wit b/testdata/codegen/lift-lower-foreign.wit.json.golden.wit index f7bcab1a..ded27a88 100644 --- a/testdata/codegen/lift-lower-foreign.wit.json.golden.wit +++ b/testdata/codegen/lift-lower-foreign.wit.json.golden.wit @@ -38,6 +38,7 @@ interface the-interface { world foo { import a; + import the-interface; use a.{t1 as u1}; use a.{t2 as u2}; use a.{t3 as u3}; @@ -48,7 +49,6 @@ world foo { use a.{t8 as %u8}; use a.{t10 as u10}; use a.{t11 as u11}; - import the-interface; export foo-f1: func(a: u1) -> u1; export foo-f2: func(a: u2) -> u2; export foo-f3: func(a: u3) -> u3; diff --git a/testdata/codegen/resources.wit.json b/testdata/codegen/resources.wit.json index da553db4..f4287002 100644 --- a/testdata/codegen/resources.wit.json +++ b/testdata/codegen/resources.wit.json @@ -3,6 +3,11 @@ { "name": "resources", "imports": { + "imports": { + "interface": { + "id": 2 + } + }, "interface-0": { "interface": { "id": 0 @@ -16,11 +21,6 @@ }, "big": { "type": 4 - }, - "imports": { - "interface": { - "id": 2 - } } }, "exports": { diff --git a/testdata/codegen/resources.wit.json.golden.wit b/testdata/codegen/resources.wit.json.golden.wit index 4e17543e..2e4101e6 100644 --- a/testdata/codegen/resources.wit.json.golden.wit +++ b/testdata/codegen/resources.wit.json.golden.wit @@ -7,6 +7,14 @@ interface types { } world resources { + import imports: interface { + resource y { + constructor(a: f64); + get-a: func() -> f64; + set-a: func(a: f64); + add: static func(y: y, a: f64) -> y; + } + } import types; use types.{z}; variant includes-borrow { a, b(borrow) } @@ -22,14 +30,6 @@ world resources { x9: borrow, x10: borrow, } - import imports: interface { - resource y { - constructor(a: f64); - get-a: func() -> f64; - set-a: func(a: f64); - add: static func(y: y, a: f64) -> y; - } - } export add: func(a: borrow, b: borrow) -> z; export maybe-with-z: func(a: option>); export variant-with-z: func(a: includes-borrow); diff --git a/testdata/issues/issue306.wit b/testdata/issues/issue306.wit index d52e2b80..6a0213fe 100644 --- a/testdata/issues/issue306.wit +++ b/testdata/issues/issue306.wit @@ -1,4 +1,3 @@ -// https://github.com/bytecodealliance/go-modules/issues/306 package issues:issue306@0.1.0; world w { diff --git a/testdata/issues/issue306.wit.json b/testdata/issues/issue306.wit.json index b0b42f62..dc4a120e 100644 --- a/testdata/issues/issue306.wit.json +++ b/testdata/issues/issue306.wit.json @@ -22,12 +22,7 @@ "imports": { "interface-0": { "interface": { - "id": 0, - "stability": { - "stable": { - "since": "0.2.0" - } - } + "id": 0 } } }, @@ -78,9 +73,6 @@ }, { "name": "issues:issue306@0.1.0", - "docs": { - "contents": "https://github.com/bytecodealliance/go-modules/issues/306" - }, "interfaces": {}, "worlds": { "w": 1 diff --git a/testdata/issues/issue306.wit.json.golden.wit b/testdata/issues/issue306.wit.json.golden.wit index cdef08fb..c5674bf9 100644 --- a/testdata/issues/issue306.wit.json.golden.wit +++ b/testdata/issues/issue306.wit.json.golden.wit @@ -1,11 +1,9 @@ package issues:dep1@0.2.1; world w { - @since(version = 0.2.0) import issues:dep2/gated-interface; } -/// https://github.com/bytecodealliance/go-modules/issues/306 package issues:issue306@0.1.0 { world w { import issues:dep2/gated-interface; diff --git a/testdata/issues/issue325-processed.wit b/testdata/issues/issue325-processed.wit new file mode 100644 index 00000000..b23a59f6 --- /dev/null +++ b/testdata/issues/issue325-processed.wit @@ -0,0 +1,34 @@ +package issues:issue325; + +world w { + @unstable(feature = active) + import issues:dep2/i@0.2.0; + @unstable(feature = active) + use issues:dep2/i@0.2.0.{r}; +} + +package issues:dep1@0.1.0 { + world w { + import issues:dep2/i@0.2.0; + } +} + +package issues:unstable@0.1.0 { + world w { + @unstable(feature = active) + import issues:dep2/i@0.2.0; + @unstable(feature = active) + use issues:dep2/i@0.2.0.{r}; + } +} + +package issues:dep2@0.2.0 { + interface i { + resource r; + } + + world w { + @since(version = 0.2.0) + import i; + } +} diff --git a/testdata/issues/issue325-processed.wit.json b/testdata/issues/issue325-processed.wit.json new file mode 100644 index 00000000..4a41e59b --- /dev/null +++ b/testdata/issues/issue325-processed.wit.json @@ -0,0 +1,152 @@ +{ + "worlds": [ + { + "name": "w", + "imports": { + "interface-0": { + "interface": { + "id": 0, + "stability": { + "stable": { + "since": "0.2.0" + } + } + } + } + }, + "exports": {}, + "package": 0 + }, + { + "name": "w", + "imports": { + "interface-0": { + "interface": { + "id": 0 + } + } + }, + "exports": {}, + "package": 1 + }, + { + "name": "w", + "imports": { + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "r": { + "type": 1 + } + }, + "exports": {}, + "package": 2 + }, + { + "name": "w", + "imports": { + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "r": { + "type": 2 + } + }, + "exports": {}, + "package": 3 + } + ], + "interfaces": [ + { + "name": "i", + "types": { + "r": 0 + }, + "functions": {}, + "package": 0 + } + ], + "types": [ + { + "name": "r", + "kind": "resource", + "owner": { + "interface": 0 + } + }, + { + "name": "r", + "kind": { + "type": 0 + }, + "owner": { + "world": 2 + }, + "stability": { + "unstable": { + "feature": "active" + } + } + }, + { + "name": "r", + "kind": { + "type": 0 + }, + "owner": { + "world": 3 + }, + "stability": { + "unstable": { + "feature": "active" + } + } + } + ], + "packages": [ + { + "name": "issues:dep2@0.2.0", + "interfaces": { + "i": 0 + }, + "worlds": { + "w": 0 + } + }, + { + "name": "issues:dep1@0.1.0", + "interfaces": {}, + "worlds": { + "w": 1 + } + }, + { + "name": "issues:issue325", + "interfaces": {}, + "worlds": { + "w": 2 + } + }, + { + "name": "issues:unstable@0.1.0", + "interfaces": {}, + "worlds": { + "w": 3 + } + } + ] +} \ No newline at end of file diff --git a/testdata/issues/issue325-processed.wit.json.golden.wit b/testdata/issues/issue325-processed.wit.json.golden.wit new file mode 100644 index 00000000..b23a59f6 --- /dev/null +++ b/testdata/issues/issue325-processed.wit.json.golden.wit @@ -0,0 +1,34 @@ +package issues:issue325; + +world w { + @unstable(feature = active) + import issues:dep2/i@0.2.0; + @unstable(feature = active) + use issues:dep2/i@0.2.0.{r}; +} + +package issues:dep1@0.1.0 { + world w { + import issues:dep2/i@0.2.0; + } +} + +package issues:unstable@0.1.0 { + world w { + @unstable(feature = active) + import issues:dep2/i@0.2.0; + @unstable(feature = active) + use issues:dep2/i@0.2.0.{r}; + } +} + +package issues:dep2@0.2.0 { + interface i { + resource r; + } + + world w { + @since(version = 0.2.0) + import i; + } +} diff --git a/testdata/issues/issue325.wit b/testdata/issues/issue325.wit new file mode 100644 index 00000000..e6d24673 --- /dev/null +++ b/testdata/issues/issue325.wit @@ -0,0 +1,31 @@ +package issues:issue325; + +world w { + @unstable(feature = active) + include issues:dep1/w@0.1.0; + include issues:unstable/w@0.1.0; +} + +package issues:unstable@0.1.0 { + world w { + @unstable(feature = active) + use issues:dep2/i@0.2.0.{r}; + } +} + +package issues:dep1@0.1.0 { + world w { + include issues:dep2/w@0.2.0; + } +} + +package issues:dep2@0.2.0 { + world w { + @since(version = 0.2.0) + import i; + } + + interface i { + resource r; + } +} diff --git a/testdata/issues/issue325.wit.json b/testdata/issues/issue325.wit.json new file mode 100644 index 00000000..20e47b59 --- /dev/null +++ b/testdata/issues/issue325.wit.json @@ -0,0 +1,138 @@ +{ + "worlds": [ + { + "name": "w", + "imports": { + "interface-0": { + "interface": { + "id": 0, + "stability": { + "stable": { + "since": "0.2.0" + } + } + } + } + }, + "exports": {}, + "package": 0 + }, + { + "name": "w", + "imports": { + "interface-0": { + "interface": { + "id": 0 + } + } + }, + "exports": {}, + "package": 1 + }, + { + "name": "w", + "imports": { + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "r": { + "type": 1 + } + }, + "exports": {}, + "package": 2 + }, + { + "name": "w", + "imports": { + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "r": { + "type": 1 + } + }, + "exports": {}, + "package": 3 + } + ], + "interfaces": [ + { + "name": "i", + "types": { + "r": 0 + }, + "functions": {}, + "package": 0 + } + ], + "types": [ + { + "name": "r", + "kind": "resource", + "owner": { + "interface": 0 + } + }, + { + "name": "r", + "kind": { + "type": 0 + }, + "owner": { + "world": 2 + }, + "stability": { + "unstable": { + "feature": "active" + } + } + } + ], + "packages": [ + { + "name": "issues:dep2@0.2.0", + "interfaces": { + "i": 0 + }, + "worlds": { + "w": 0 + } + }, + { + "name": "issues:dep1@0.1.0", + "interfaces": {}, + "worlds": { + "w": 1 + } + }, + { + "name": "issues:unstable@0.1.0", + "interfaces": {}, + "worlds": { + "w": 2 + } + }, + { + "name": "issues:issue325", + "interfaces": {}, + "worlds": { + "w": 3 + } + } + ] +} \ No newline at end of file diff --git a/testdata/issues/issue325.wit.json.golden.wit b/testdata/issues/issue325.wit.json.golden.wit new file mode 100644 index 00000000..b23a59f6 --- /dev/null +++ b/testdata/issues/issue325.wit.json.golden.wit @@ -0,0 +1,34 @@ +package issues:issue325; + +world w { + @unstable(feature = active) + import issues:dep2/i@0.2.0; + @unstable(feature = active) + use issues:dep2/i@0.2.0.{r}; +} + +package issues:dep1@0.1.0 { + world w { + import issues:dep2/i@0.2.0; + } +} + +package issues:unstable@0.1.0 { + world w { + @unstable(feature = active) + import issues:dep2/i@0.2.0; + @unstable(feature = active) + use issues:dep2/i@0.2.0.{r}; + } +} + +package issues:dep2@0.2.0 { + interface i { + resource r; + } + + world w { + @since(version = 0.2.0) + import i; + } +} diff --git a/testdata/wit-parser/error-context.wit.json b/testdata/wit-parser/error-context.wit.json index 555a2543..617e37d1 100644 --- a/testdata/wit-parser/error-context.wit.json +++ b/testdata/wit-parser/error-context.wit.json @@ -13,14 +13,14 @@ "params": [ { "name": "x", - "type": 1 + "type": "error-context" }, { "name": "y", "type": 0 } ], - "result": 2 + "result": 1 } }, "package": 0 @@ -29,22 +29,19 @@ "types": [ { "name": "t1", - "kind": "error-context", + "kind": { + "type": "error-context" + }, "owner": { "interface": 0 } }, - { - "name": null, - "kind": "error-context", - "owner": null - }, { "name": null, "kind": { "result": { "ok": null, - "err": 1 + "err": "error-context" } }, "owner": null diff --git a/testdata/wit-parser/gated-include-use-with-stable.wit b/testdata/wit-parser/gated-include-use-with-stable.wit new file mode 100644 index 00000000..159ffb39 --- /dev/null +++ b/testdata/wit-parser/gated-include-use-with-stable.wit @@ -0,0 +1,75 @@ +package wasmtime:test; + +world test{ + @unstable(feature = active) + include wasi:unstable/imports@0.2.3; + include wasi:foo/imports@0.2.3; +} + +world test-ordered{ + include wasi:foo/imports@0.2.3; + @unstable(feature = active) + include wasi:unstable/imports@0.2.3; +} + +package wasi:unstable@0.2.3 { + @unstable(feature = active) + world imports { + @unstable(feature = active) + use wasi:dep2/stable@0.2.3.{stable-resource}; + @unstable(feature = active) + use wasi:dep-unversioned/unversioned.{unversioned-resource}; + @unstable(feature = active) + use wasi:dep-unstable/unstable.{unstable-resource}; + } +} + +package wasi:foo@0.2.3 { + @since(version = 0.2.0) + world imports { + @since(version = 0.2.0) + include wasi:dep2/imports@0.2.3; + include wasi:dep-unversioned/imports; + include wasi:dep-unstable/imports; + } +} + +package wasi:dep2@0.2.3 { + @since(version = 0.2.0) + world imports { + @since(version = 0.2.0) + import stable; + } + @since(version = 0.2.1) + interface stable { + resource stable-resource { + } + } +} + +package wasi:dep-unversioned{ + world imports { + import unversioned; + } + interface unversioned { + resource unversioned-resource { + + } + } +} + +package wasi:dep-unstable{ + @unstable(feature = active) + world imports { + @unstable(feature = active) + import unstable; + } + @unstable(feature = active) + interface unstable { + @unstable(feature = active) + resource unstable-resource { + + } + } +} + diff --git a/testdata/wit-parser/gated-include-use-with-stable.wit.json b/testdata/wit-parser/gated-include-use-with-stable.wit.json new file mode 100644 index 00000000..9b10fd9b --- /dev/null +++ b/testdata/wit-parser/gated-include-use-with-stable.wit.json @@ -0,0 +1,392 @@ +{ + "worlds": [ + { + "name": "imports", + "imports": { + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + } + }, + "exports": {}, + "package": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + }, + { + "name": "imports", + "imports": { + "interface-1": { + "interface": { + "id": 1 + } + } + }, + "exports": {}, + "package": 1 + }, + { + "name": "imports", + "imports": { + "interface-2": { + "interface": { + "id": 2, + "stability": { + "stable": { + "since": "0.2.0" + } + } + } + } + }, + "exports": {}, + "package": 2, + "stability": { + "stable": { + "since": "0.2.0" + } + } + }, + { + "name": "imports", + "imports": { + "interface-2": { + "interface": { + "id": 2 + } + }, + "interface-1": { + "interface": { + "id": 1 + } + }, + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + } + }, + "exports": {}, + "package": 3, + "stability": { + "stable": { + "since": "0.2.0" + } + } + }, + { + "name": "imports", + "imports": { + "interface-2": { + "interface": { + "id": 2, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "interface-1": { + "interface": { + "id": 1, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "stable-resource": { + "type": 3 + }, + "unversioned-resource": { + "type": 4 + }, + "unstable-resource": { + "type": 5 + } + }, + "exports": {}, + "package": 4, + "stability": { + "unstable": { + "feature": "active" + } + } + }, + { + "name": "test", + "imports": { + "interface-2": { + "interface": { + "id": 2, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "interface-1": { + "interface": { + "id": 1, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "stable-resource": { + "type": 3 + }, + "unversioned-resource": { + "type": 4 + }, + "unstable-resource": { + "type": 5 + } + }, + "exports": {}, + "package": 5 + }, + { + "name": "test-ordered", + "imports": { + "interface-2": { + "interface": { + "id": 2, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "interface-1": { + "interface": { + "id": 1, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "interface-0": { + "interface": { + "id": 0, + "stability": { + "unstable": { + "feature": "active" + } + } + } + }, + "stable-resource": { + "type": 3 + }, + "unversioned-resource": { + "type": 4 + }, + "unstable-resource": { + "type": 5 + } + }, + "exports": {}, + "package": 5 + } + ], + "interfaces": [ + { + "name": "unstable", + "types": { + "unstable-resource": 0 + }, + "functions": {}, + "stability": { + "unstable": { + "feature": "active" + } + }, + "package": 0 + }, + { + "name": "unversioned", + "types": { + "unversioned-resource": 1 + }, + "functions": {}, + "package": 1 + }, + { + "name": "stable", + "types": { + "stable-resource": 2 + }, + "functions": {}, + "stability": { + "stable": { + "since": "0.2.1" + } + }, + "package": 2 + } + ], + "types": [ + { + "name": "unstable-resource", + "kind": "resource", + "owner": { + "interface": 0 + }, + "stability": { + "unstable": { + "feature": "active" + } + } + }, + { + "name": "unversioned-resource", + "kind": "resource", + "owner": { + "interface": 1 + } + }, + { + "name": "stable-resource", + "kind": "resource", + "owner": { + "interface": 2 + } + }, + { + "name": "stable-resource", + "kind": { + "type": 2 + }, + "owner": { + "world": 4 + }, + "stability": { + "unstable": { + "feature": "active" + } + } + }, + { + "name": "unversioned-resource", + "kind": { + "type": 1 + }, + "owner": { + "world": 4 + }, + "stability": { + "unstable": { + "feature": "active" + } + } + }, + { + "name": "unstable-resource", + "kind": { + "type": 0 + }, + "owner": { + "world": 4 + }, + "stability": { + "unstable": { + "feature": "active" + } + } + } + ], + "packages": [ + { + "name": "wasi:dep-unstable", + "interfaces": { + "unstable": 0 + }, + "worlds": { + "imports": 0 + } + }, + { + "name": "wasi:dep-unversioned", + "interfaces": { + "unversioned": 1 + }, + "worlds": { + "imports": 1 + } + }, + { + "name": "wasi:dep2@0.2.3", + "interfaces": { + "stable": 2 + }, + "worlds": { + "imports": 2 + } + }, + { + "name": "wasi:foo@0.2.3", + "interfaces": {}, + "worlds": { + "imports": 3 + } + }, + { + "name": "wasi:unstable@0.2.3", + "interfaces": {}, + "worlds": { + "imports": 4 + } + }, + { + "name": "wasmtime:test", + "interfaces": {}, + "worlds": { + "test": 5, + "test-ordered": 6 + } + } + ] +} \ No newline at end of file diff --git a/testdata/wit-parser/gated-include-use-with-stable.wit.json.golden.wit b/testdata/wit-parser/gated-include-use-with-stable.wit.json.golden.wit new file mode 100644 index 00000000..c6eb302c --- /dev/null +++ b/testdata/wit-parser/gated-include-use-with-stable.wit.json.golden.wit @@ -0,0 +1,96 @@ +package wasmtime:test; + +world test { + @unstable(feature = active) + import wasi:dep2/stable@0.2.3; + @unstable(feature = active) + import wasi:dep-unversioned/unversioned; + @unstable(feature = active) + import wasi:dep-unstable/unstable; + @unstable(feature = active) + use wasi:dep2/stable@0.2.3.{stable-resource}; + @unstable(feature = active) + use wasi:dep-unversioned/unversioned.{unversioned-resource}; + @unstable(feature = active) + use wasi:dep-unstable/unstable.{unstable-resource}; +} + +world test-ordered { + @unstable(feature = active) + import wasi:dep2/stable@0.2.3; + @unstable(feature = active) + import wasi:dep-unversioned/unversioned; + @unstable(feature = active) + import wasi:dep-unstable/unstable; + @unstable(feature = active) + use wasi:dep2/stable@0.2.3.{stable-resource}; + @unstable(feature = active) + use wasi:dep-unversioned/unversioned.{unversioned-resource}; + @unstable(feature = active) + use wasi:dep-unstable/unstable.{unstable-resource}; +} + +package wasi:foo@0.2.3 { + @since(version = 0.2.0) + world imports { + import wasi:dep2/stable@0.2.3; + import wasi:dep-unversioned/unversioned; + @unstable(feature = active) + import wasi:dep-unstable/unstable; + } +} + +package wasi:unstable@0.2.3 { + @unstable(feature = active) + world imports { + @unstable(feature = active) + import wasi:dep2/stable@0.2.3; + @unstable(feature = active) + import wasi:dep-unversioned/unversioned; + @unstable(feature = active) + import wasi:dep-unstable/unstable; + @unstable(feature = active) + use wasi:dep2/stable@0.2.3.{stable-resource}; + @unstable(feature = active) + use wasi:dep-unversioned/unversioned.{unversioned-resource}; + @unstable(feature = active) + use wasi:dep-unstable/unstable.{unstable-resource}; + } +} + +package wasi:dep-unstable { + @unstable(feature = active) + interface unstable { + @unstable(feature = active) + resource unstable-resource; + } + + @unstable(feature = active) + world imports { + @unstable(feature = active) + import unstable; + } +} + +package wasi:dep-unversioned { + interface unversioned { + resource unversioned-resource; + } + + world imports { + import unversioned; + } +} + +package wasi:dep2@0.2.3 { + @since(version = 0.2.1) + interface stable { + resource stable-resource; + } + + @since(version = 0.2.0) + world imports { + @since(version = 0.2.0) + import stable; + } +} diff --git a/testdata/wit-parser/gated-use.wit.json.golden.wit b/testdata/wit-parser/gated-use.wit.json.golden.wit index 49345d35..c7b0e91e 100644 --- a/testdata/wit-parser/gated-use.wit.json.golden.wit +++ b/testdata/wit-parser/gated-use.wit.json.golden.wit @@ -1,7 +1,7 @@ -package wasi:dep2@0.2.3; +package wasmtime:test; -interface stable {} +interface types {} -package wasmtime:test { - interface types {} +package wasi:dep2@0.2.3 { + interface stable {} } diff --git a/testdata/wit-parser/packages-nested-with-semver.wit.json.golden.wit b/testdata/wit-parser/packages-nested-with-semver.wit.json.golden.wit index 2f649238..491da28d 100644 --- a/testdata/wit-parser/packages-nested-with-semver.wit.json.golden.wit +++ b/testdata/wit-parser/packages-nested-with-semver.wit.json.golden.wit @@ -1,13 +1,15 @@ -package foo:name@1.0.0; +package foo:root; -interface i1 { - type a = u32; -} +package foo:name@1.0.0 { + interface i1 { + type a = u32; + } -world w1 { - import i1; - import imp1: interface { - use i1.{a}; + world w1 { + import i1; + import imp1: interface { + use i1.{a}; + } } } @@ -23,5 +25,3 @@ package foo:name@1.0.1 { } } } - -package foo:root {} diff --git a/testdata/wit-parser/since-and-unstable.wit.json b/testdata/wit-parser/since-and-unstable.wit.json index a9921b6f..04acc3fc 100644 --- a/testdata/wit-parser/since-and-unstable.wit.json +++ b/testdata/wit-parser/since-and-unstable.wit.json @@ -25,6 +25,26 @@ { "name": "in-a-world", "imports": { + "y": { + "interface": { + "id": 7, + "stability": { + "stable": { + "since": "1.0.0" + } + } + } + }, + "interface-5": { + "interface": { + "id": 5, + "stability": { + "stable": { + "since": "1.0.0" + } + } + } + }, "t1": { "type": 13 }, @@ -58,26 +78,6 @@ } } }, - "y": { - "interface": { - "id": 7, - "stability": { - "stable": { - "since": "1.0.0" - } - } - } - }, - "interface-5": { - "interface": { - "id": 5, - "stability": { - "stable": { - "since": "1.0.0" - } - } - } - }, "[constructor]t7": { "function": { "name": "[constructor]t7", diff --git a/testdata/wit-parser/since-and-unstable.wit.json.golden.wit b/testdata/wit-parser/since-and-unstable.wit.json.golden.wit index d87c7484..682b4c3a 100644 --- a/testdata/wit-parser/since-and-unstable.wit.json.golden.wit +++ b/testdata/wit-parser/since-and-unstable.wit.json.golden.wit @@ -64,6 +64,10 @@ world w1 {} world w2 {} world in-a-world { + @since(version = 1.0.0) + import y: interface {} + @since(version = 1.0.0) + import z; @since(version = 1.0.0) record t1 { x: u32 } @since(version = 1.0.0) @@ -84,10 +88,6 @@ world in-a-world { @since(version = 1.0.0) import x: func(); @since(version = 1.0.0) - import y: interface {} - @since(version = 1.0.0) - import z; - @since(version = 1.0.0) export x: func(); @since(version = 1.0.0) export y: interface {} diff --git a/testdata/wit-parser/version-syntax.wit.json.golden.wit b/testdata/wit-parser/version-syntax.wit.json.golden.wit index c6acac8c..13220696 100644 --- a/testdata/wit-parser/version-syntax.wit.json.golden.wit +++ b/testdata/wit-parser/version-syntax.wit.json.golden.wit @@ -1,4 +1,6 @@ -package a:b@1.0.0; +package foo:root; + +package a:b@1.0.0 {} package a:b@1.0.0-11-a {} @@ -15,5 +17,3 @@ package a:b@1.0.1-1+1 {} package a:b@1.0.1-1a+1a {} package a:b@1.0.1-a+a {} - -package foo:root {} diff --git a/wit/bindgen/generator.go b/wit/bindgen/generator.go index d9794922..20d3f997 100644 --- a/wit/bindgen/generator.go +++ b/wit/bindgen/generator.go @@ -176,16 +176,6 @@ func newGenerator(res *wit.Resolve, opts ...Option) (*generator, error) { return g, nil } -// TODO: factor this out -func findWorld(r *wit.Resolve, pattern string) *wit.World { - for _, w := range r.Worlds { - if w.Match(pattern) { - return w - } - } - return nil -} - func (g *generator) generate() ([]*gen.Package, error) { g.detectVersionedPackages() err := g.defineWorlds() @@ -237,6 +227,11 @@ func (g *generator) define(dir wit.Direction, v wit.Node) (defined bool) { func (g *generator) defineWorlds() error { g.opts.logger.Infof("Generating Go for %d world(s)\n", len(g.res.Worlds)) for _, w := range g.res.Worlds { + // Define a Go package for every world, regardless of use + _, err := g.newPackage(w, nil, "") + if err != nil { + return err + } if w == g.world || g.world == nil { err := g.defineWorld(w) if err != nil { @@ -2293,7 +2288,12 @@ func (g *generator) cgoFileFor(owner wit.TypeOwner) *gen.File { } func (g *generator) packageFor(owner wit.TypeOwner) *gen.Package { - return g.witPackages[owner] + pkg := g.witPackages[owner] + if pkg == nil { + panic(fmt.Sprintf("BUG: nil package for wit.TypeOwner %s (%T: %p)", + owner.WITPackage().Name.String(), owner, owner)) + } + return pkg } func (g *generator) newPackage(w *wit.World, i *wit.Interface, name string) (*gen.Package, error) { diff --git a/wit/package.go b/wit/package.go index 6c088182..2e39a02b 100644 --- a/wit/package.go +++ b/wit/package.go @@ -59,6 +59,10 @@ func comparePackages(a, b *Package) int { case DependsOn(b, a): // fmt.Fprintln(os.Stderr, b.Name.String()+" depends on "+a.Name.String()) return -1 + case a.Name.Version == nil && b.Name.Version != nil: + return 1 + case a.Name.Version != nil && a.Name.Version == nil: + return -1 } // fmt.Fprintln(os.Stderr, a.Name.String()+" does not depend on "+b.Name.String()) return -1 * strings.Compare(a.Name.String(), b.Name.String()) diff --git a/wit/stability.go b/wit/stability.go index 583282f0..1406d9eb 100644 --- a/wit/stability.go +++ b/wit/stability.go @@ -8,6 +8,7 @@ import ( type Stability interface { Node isStability() + Versioned() bool } // _stability is an embeddable type that conforms to the [Stability] interface. @@ -24,9 +25,19 @@ type Stable struct { Deprecated *semver.Version } +// Versioned always returns true for [Stable]. +func (*Stable) Versioned() bool { + return true +} + // Unstable represents an unstable WIT feature defined by name. type Unstable struct { _stability Feature string Deprecated *semver.Version } + +// Versioned returns whether [Unstable] is deprecated. +func (u *Unstable) Versioned() bool { + return u.Deprecated != nil +} diff --git a/wit/wit.go b/wit/wit.go index c0b49914..c1f8b70f 100644 --- a/wit/wit.go +++ b/wit/wit.go @@ -175,9 +175,9 @@ func (s *Stable) WIT(ctx Node, _ string) string { case *World: w = ctx } - if w != nil && w.Package.Name.Version != nil { + if w != nil { pv := w.Package.Name.Version - if pv.LessThan(s.Since) { + if pv == nil || pv.LessThan(s.Since) { return "" } } @@ -333,6 +333,18 @@ func (ref *InterfaceRef) WIT(ctx Node, name string) string { if ref.Stability == nil { return ref.Interface.WIT(ctx, name) } + var w *World + switch ctx := ctx.(type) { + case worldImport: + w = ctx.World + case worldExport: + w = ctx.World + case *World: + w = ctx + } + if ref.Stability.Versioned() && w != nil && w.Package != ref.Interface.Package { + return ref.Interface.WIT(ctx, name) + } return newline(ref.Stability.WIT(ctx, "")) + ref.Interface.WIT(ctx, name) }