html-to-markdown 2.24.4 → 2.24.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2165) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/README.md +1 -1
  4. data/ext/html-to-markdown-rb/native/Cargo.lock +254 -47
  5. data/ext/html-to-markdown-rb/native/Cargo.toml +1 -1
  6. data/lib/html_to_markdown/version.rb +1 -1
  7. data/rust-vendor/anyhow/.cargo-checksum.json +1 -0
  8. data/rust-vendor/anyhow/.cargo_vcs_info.json +6 -0
  9. data/rust-vendor/anyhow/.github/FUNDING.yml +1 -0
  10. data/rust-vendor/anyhow/.github/workflows/ci.yml +147 -0
  11. data/rust-vendor/anyhow/Cargo.lock +424 -0
  12. data/rust-vendor/anyhow/Cargo.toml +132 -0
  13. data/rust-vendor/anyhow/Cargo.toml.orig +40 -0
  14. data/rust-vendor/anyhow/LICENSE-APACHE +176 -0
  15. data/rust-vendor/anyhow/LICENSE-MIT +23 -0
  16. data/rust-vendor/anyhow/README.md +179 -0
  17. data/rust-vendor/anyhow/build.rs +207 -0
  18. data/rust-vendor/anyhow/rust-toolchain.toml +2 -0
  19. data/rust-vendor/anyhow/src/backtrace.rs +410 -0
  20. data/rust-vendor/anyhow/src/chain.rs +102 -0
  21. data/rust-vendor/anyhow/src/context.rs +193 -0
  22. data/rust-vendor/anyhow/src/ensure.rs +935 -0
  23. data/rust-vendor/anyhow/src/error.rs +1086 -0
  24. data/rust-vendor/anyhow/src/fmt.rs +158 -0
  25. data/rust-vendor/anyhow/src/kind.rs +121 -0
  26. data/rust-vendor/anyhow/src/lib.rs +728 -0
  27. data/rust-vendor/anyhow/src/macros.rs +245 -0
  28. data/rust-vendor/anyhow/src/nightly.rs +58 -0
  29. data/rust-vendor/anyhow/src/ptr.rs +187 -0
  30. data/rust-vendor/anyhow/src/wrapper.rs +84 -0
  31. data/rust-vendor/anyhow/tests/common/mod.rs +14 -0
  32. data/rust-vendor/anyhow/tests/compiletest.rs +7 -0
  33. data/rust-vendor/anyhow/tests/drop/mod.rs +53 -0
  34. data/rust-vendor/anyhow/tests/test_autotrait.rs +34 -0
  35. data/rust-vendor/anyhow/tests/test_backtrace.rs +15 -0
  36. data/rust-vendor/anyhow/tests/test_boxed.rs +45 -0
  37. data/rust-vendor/anyhow/tests/test_chain.rs +69 -0
  38. data/rust-vendor/anyhow/tests/test_context.rs +172 -0
  39. data/rust-vendor/anyhow/tests/test_convert.rs +46 -0
  40. data/rust-vendor/anyhow/tests/test_downcast.rs +123 -0
  41. data/rust-vendor/anyhow/tests/test_ensure.rs +756 -0
  42. data/rust-vendor/anyhow/tests/test_ffi.rs +19 -0
  43. data/rust-vendor/anyhow/tests/test_fmt.rs +93 -0
  44. data/rust-vendor/anyhow/tests/test_macros.rs +97 -0
  45. data/rust-vendor/anyhow/tests/test_repr.rs +30 -0
  46. data/rust-vendor/anyhow/tests/test_source.rs +62 -0
  47. data/rust-vendor/anyhow/tests/ui/chained-comparison.rs +8 -0
  48. data/rust-vendor/anyhow/tests/ui/chained-comparison.stderr +10 -0
  49. data/rust-vendor/anyhow/tests/ui/empty-ensure.rs +6 -0
  50. data/rust-vendor/anyhow/tests/ui/empty-ensure.stderr +12 -0
  51. data/rust-vendor/anyhow/tests/ui/ensure-nonbool.rs +40 -0
  52. data/rust-vendor/anyhow/tests/ui/ensure-nonbool.stderr +113 -0
  53. data/rust-vendor/anyhow/tests/ui/must-use.rs +11 -0
  54. data/rust-vendor/anyhow/tests/ui/must-use.stderr +15 -0
  55. data/rust-vendor/anyhow/tests/ui/no-impl.rs +8 -0
  56. data/rust-vendor/anyhow/tests/ui/no-impl.stderr +32 -0
  57. data/rust-vendor/anyhow/tests/ui/temporary-value.rs +5 -0
  58. data/rust-vendor/anyhow/tests/ui/temporary-value.stderr +15 -0
  59. data/rust-vendor/anyhow/tests/ui/wrong-interpolation.rs +5 -0
  60. data/rust-vendor/anyhow/tests/ui/wrong-interpolation.stderr +5 -0
  61. data/rust-vendor/bitflags/.cargo-checksum.json +1 -1
  62. data/rust-vendor/bitflags/.cargo_vcs_info.json +1 -1
  63. data/rust-vendor/bitflags/CHANGELOG.md +12 -0
  64. data/rust-vendor/bitflags/Cargo.lock +48 -48
  65. data/rust-vendor/bitflags/Cargo.toml +1 -1
  66. data/rust-vendor/bitflags/Cargo.toml.orig +1 -1
  67. data/rust-vendor/bitflags/README.md +1 -1
  68. data/rust-vendor/bitflags/src/external.rs +1 -1
  69. data/rust-vendor/bitflags/src/lib.rs +1 -1
  70. data/rust-vendor/bitflags/src/tests/known_bits.rs +47 -0
  71. data/rust-vendor/bitflags/src/tests/unknown_bits.rs +53 -0
  72. data/rust-vendor/bitflags/src/tests.rs +2 -0
  73. data/rust-vendor/bitflags/src/traits.rs +11 -1
  74. data/rust-vendor/cc/.cargo-checksum.json +1 -1
  75. data/rust-vendor/cc/.cargo_vcs_info.json +1 -1
  76. data/rust-vendor/cc/CHANGELOG.md +7 -0
  77. data/rust-vendor/cc/Cargo.lock +331 -7
  78. data/rust-vendor/cc/Cargo.toml +1 -1
  79. data/rust-vendor/cc/Cargo.toml.orig +1 -1
  80. data/rust-vendor/cc/src/lib.rs +10 -13
  81. data/rust-vendor/cc/src/target/generated.rs +1 -0
  82. data/rust-vendor/cpp_demangle/.cargo-checksum.json +1 -1
  83. data/rust-vendor/cpp_demangle/.cargo_vcs_info.json +1 -1
  84. data/rust-vendor/cpp_demangle/CHANGELOG.md +55 -0
  85. data/rust-vendor/cpp_demangle/Cargo.lock +5 -5
  86. data/rust-vendor/cpp_demangle/Cargo.toml +2 -2
  87. data/rust-vendor/cpp_demangle/Cargo.toml.orig +2 -2
  88. data/rust-vendor/cpp_demangle/README.md +9 -9
  89. data/rust-vendor/cpp_demangle/build.rs +10 -9
  90. data/rust-vendor/cpp_demangle/examples/cppfilt.rs +1 -1
  91. data/rust-vendor/cpp_demangle/examples/simple.rs +1 -1
  92. data/rust-vendor/cpp_demangle/src/ast.rs +238 -36
  93. data/rust-vendor/cpp_demangle/src/lib.rs +31 -46
  94. data/rust-vendor/cpp_demangle/src/subs.rs +1 -1
  95. data/rust-vendor/flate2/.cargo-checksum.json +1 -1
  96. data/rust-vendor/flate2/.cargo_vcs_info.json +1 -1
  97. data/rust-vendor/flate2/Cargo.lock +3 -3
  98. data/rust-vendor/flate2/Cargo.toml +13 -2
  99. data/rust-vendor/flate2/Cargo.toml.orig +16 -13
  100. data/rust-vendor/flate2/LICENSE-MIT +1 -1
  101. data/rust-vendor/flate2/src/crc.rs +177 -42
  102. data/rust-vendor/flate2/src/gz/mod.rs +159 -0
  103. data/rust-vendor/foldhash-0.1.5/.cargo-checksum.json +1 -0
  104. data/rust-vendor/foldhash-0.1.5/.cargo_vcs_info.json +6 -0
  105. data/rust-vendor/foldhash-0.1.5/Cargo.lock +852 -0
  106. data/rust-vendor/foldhash-0.1.5/Cargo.toml +76 -0
  107. data/rust-vendor/foldhash-0.1.5/Cargo.toml.orig +44 -0
  108. data/rust-vendor/foldhash-0.1.5/LICENSE +19 -0
  109. data/rust-vendor/foldhash-0.1.5/README.md +277 -0
  110. data/rust-vendor/foldhash-0.1.5/src/convenience.rs +73 -0
  111. data/rust-vendor/foldhash-0.1.5/src/fast.rs +270 -0
  112. data/rust-vendor/foldhash-0.1.5/src/lib.rs +284 -0
  113. data/rust-vendor/foldhash-0.1.5/src/quality.rs +174 -0
  114. data/rust-vendor/foldhash-0.1.5/src/seed.rs +267 -0
  115. data/rust-vendor/getrandom/.cargo-checksum.json +1 -1
  116. data/rust-vendor/getrandom/.cargo_vcs_info.json +1 -1
  117. data/rust-vendor/getrandom/CHANGELOG.md +39 -1
  118. data/rust-vendor/getrandom/Cargo.lock +451 -60
  119. data/rust-vendor/getrandom/Cargo.toml +44 -5
  120. data/rust-vendor/getrandom/Cargo.toml.orig +45 -10
  121. data/rust-vendor/getrandom/LICENSE-MIT +1 -1
  122. data/rust-vendor/getrandom/README.md +72 -40
  123. data/rust-vendor/getrandom/benches/buffer.rs +10 -8
  124. data/rust-vendor/getrandom/build.rs +1 -47
  125. data/rust-vendor/getrandom/src/backends/custom.rs +1 -1
  126. data/rust-vendor/getrandom/src/backends/efi_rng.rs +1 -1
  127. data/rust-vendor/getrandom/src/backends/esp_idf.rs +1 -1
  128. data/rust-vendor/getrandom/src/backends/extern_impl.rs +19 -0
  129. data/rust-vendor/getrandom/src/backends/fuchsia.rs +1 -1
  130. data/rust-vendor/getrandom/src/backends/getentropy.rs +4 -3
  131. data/rust-vendor/getrandom/src/backends/getrandom.rs +4 -12
  132. data/rust-vendor/getrandom/src/backends/hermit.rs +1 -1
  133. data/rust-vendor/getrandom/src/backends/linux_android_with_fallback.rs +8 -10
  134. data/rust-vendor/getrandom/src/backends/linux_raw.rs +101 -75
  135. data/rust-vendor/getrandom/src/backends/netbsd.rs +3 -3
  136. data/rust-vendor/getrandom/src/backends/rdrand.rs +26 -13
  137. data/rust-vendor/getrandom/src/backends/rndr.rs +13 -11
  138. data/rust-vendor/getrandom/src/backends/solaris.rs +5 -4
  139. data/rust-vendor/getrandom/src/backends/solid.rs +1 -1
  140. data/rust-vendor/getrandom/src/backends/use_file.rs +17 -28
  141. data/rust-vendor/getrandom/src/backends/vxworks.rs +2 -4
  142. data/rust-vendor/getrandom/src/backends/wasi_p1.rs +1 -1
  143. data/rust-vendor/getrandom/src/backends/wasi_p2_3.rs +61 -0
  144. data/rust-vendor/getrandom/src/backends/wasm_js.rs +1 -1
  145. data/rust-vendor/getrandom/src/backends/windows.rs +7 -11
  146. data/rust-vendor/getrandom/src/backends/windows_legacy.rs +1 -1
  147. data/rust-vendor/getrandom/src/backends.rs +9 -28
  148. data/rust-vendor/getrandom/src/error.rs +39 -6
  149. data/rust-vendor/getrandom/src/error_std_impls.rs +1 -3
  150. data/rust-vendor/getrandom/src/lib.rs +39 -18
  151. data/rust-vendor/getrandom/src/sys_rng.rs +55 -0
  152. data/rust-vendor/getrandom/src/util.rs +3 -15
  153. data/rust-vendor/getrandom/src/utils/get_errno.rs +29 -0
  154. data/rust-vendor/getrandom/src/utils/lazy.rs +64 -0
  155. data/rust-vendor/getrandom/src/utils/sanitizer.rs +28 -0
  156. data/rust-vendor/getrandom/src/utils/sys_fill_exact.rs +41 -0
  157. data/rust-vendor/getrandom/tests/mod.rs +6 -94
  158. data/rust-vendor/getrandom/tests/sys_rng.rs +18 -0
  159. data/rust-vendor/getrandom-0.3.4/.cargo-checksum.json +1 -0
  160. data/rust-vendor/getrandom-0.3.4/.cargo_vcs_info.json +6 -0
  161. data/rust-vendor/getrandom-0.3.4/CHANGELOG.md +673 -0
  162. data/rust-vendor/getrandom-0.3.4/Cargo.lock +292 -0
  163. data/rust-vendor/getrandom-0.3.4/Cargo.toml +133 -0
  164. data/rust-vendor/getrandom-0.3.4/Cargo.toml.orig +100 -0
  165. data/rust-vendor/getrandom-0.3.4/LICENSE-APACHE +201 -0
  166. data/rust-vendor/getrandom-0.3.4/LICENSE-MIT +26 -0
  167. data/rust-vendor/getrandom-0.3.4/README.md +386 -0
  168. data/rust-vendor/getrandom-0.3.4/SECURITY.md +13 -0
  169. data/rust-vendor/getrandom-0.3.4/benches/buffer.rs +121 -0
  170. data/rust-vendor/getrandom-0.3.4/build.rs +57 -0
  171. data/rust-vendor/getrandom-0.3.4/src/backends/apple_other.rs +21 -0
  172. data/rust-vendor/getrandom-0.3.4/src/backends/custom.rs +13 -0
  173. data/rust-vendor/getrandom-0.3.4/src/backends/efi_rng.rs +124 -0
  174. data/rust-vendor/getrandom-0.3.4/src/backends/esp_idf.rs +21 -0
  175. data/rust-vendor/getrandom-0.3.4/src/backends/fuchsia.rs +16 -0
  176. data/rust-vendor/getrandom-0.3.4/src/backends/getentropy.rs +27 -0
  177. data/rust-vendor/getrandom-0.3.4/src/backends/getrandom.rs +39 -0
  178. data/rust-vendor/getrandom-0.3.4/src/backends/hermit.rs +53 -0
  179. data/rust-vendor/getrandom-0.3.4/src/backends/linux_android_with_fallback.rs +103 -0
  180. data/rust-vendor/getrandom-0.3.4/src/backends/linux_raw.rs +143 -0
  181. data/rust-vendor/getrandom-0.3.4/src/backends/netbsd.rs +78 -0
  182. data/rust-vendor/getrandom-0.3.4/src/backends/rdrand.rs +182 -0
  183. data/rust-vendor/getrandom-0.3.4/src/backends/rndr.rs +145 -0
  184. data/rust-vendor/getrandom-0.3.4/src/backends/solaris.rs +42 -0
  185. data/rust-vendor/getrandom-0.3.4/src/backends/solid.rs +19 -0
  186. data/rust-vendor/getrandom-0.3.4/src/backends/unsupported.rs +9 -0
  187. data/rust-vendor/getrandom-0.3.4/src/backends/use_file.rs +234 -0
  188. data/rust-vendor/getrandom-0.3.4/src/backends/vxworks.rs +54 -0
  189. data/rust-vendor/getrandom-0.3.4/src/backends/wasi_p1.rs +32 -0
  190. data/rust-vendor/getrandom-0.3.4/src/backends/wasm_js.rs +72 -0
  191. data/rust-vendor/getrandom-0.3.4/src/backends/windows.rs +61 -0
  192. data/rust-vendor/getrandom-0.3.4/src/backends/windows_legacy.rs +48 -0
  193. data/rust-vendor/getrandom-0.3.4/src/backends.rs +209 -0
  194. data/rust-vendor/getrandom-0.3.4/src/error.rs +212 -0
  195. data/rust-vendor/getrandom-0.3.4/src/error_std_impls.rs +15 -0
  196. data/rust-vendor/getrandom-0.3.4/src/lib.rs +138 -0
  197. data/rust-vendor/getrandom-0.3.4/src/util.rs +84 -0
  198. data/rust-vendor/getrandom-0.3.4/tests/mod.rs +297 -0
  199. data/rust-vendor/hashbrown-0.15.5/.cargo-checksum.json +1 -0
  200. data/rust-vendor/hashbrown-0.15.5/.cargo_vcs_info.json +6 -0
  201. data/rust-vendor/hashbrown-0.15.5/CHANGELOG.md +619 -0
  202. data/rust-vendor/hashbrown-0.15.5/Cargo.lock +306 -0
  203. data/rust-vendor/hashbrown-0.15.5/Cargo.toml +164 -0
  204. data/rust-vendor/hashbrown-0.15.5/Cargo.toml.orig +77 -0
  205. data/rust-vendor/hashbrown-0.15.5/Cross.toml +3 -0
  206. data/rust-vendor/hashbrown-0.15.5/LICENSE-APACHE +201 -0
  207. data/rust-vendor/hashbrown-0.15.5/LICENSE-MIT +25 -0
  208. data/rust-vendor/hashbrown-0.15.5/README.md +80 -0
  209. data/rust-vendor/hashbrown-0.15.5/benches/bench.rs +329 -0
  210. data/rust-vendor/hashbrown-0.15.5/benches/insert_unique_unchecked.rs +34 -0
  211. data/rust-vendor/hashbrown-0.15.5/benches/set_ops.rs +148 -0
  212. data/rust-vendor/hashbrown-0.15.5/clippy.toml +1 -0
  213. data/rust-vendor/hashbrown-0.15.5/src/control/bitmask.rs +117 -0
  214. data/rust-vendor/hashbrown-0.15.5/src/control/group/generic.rs +154 -0
  215. data/rust-vendor/hashbrown-0.15.5/src/control/group/lsx.rs +137 -0
  216. data/rust-vendor/hashbrown-0.15.5/src/control/group/mod.rs +43 -0
  217. data/rust-vendor/hashbrown-0.15.5/src/control/group/neon.rs +121 -0
  218. data/rust-vendor/hashbrown-0.15.5/src/control/group/sse2.rs +146 -0
  219. data/rust-vendor/hashbrown-0.15.5/src/control/mod.rs +10 -0
  220. data/rust-vendor/hashbrown-0.15.5/src/control/tag.rs +83 -0
  221. data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/mod.rs +4 -0
  222. data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/helpers.rs +27 -0
  223. data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/map.rs +721 -0
  224. data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/mod.rs +5 -0
  225. data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/raw.rs +230 -0
  226. data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/set.rs +659 -0
  227. data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/table.rs +249 -0
  228. data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/serde.rs +220 -0
  229. data/rust-vendor/hashbrown-0.15.5/src/lib.rs +188 -0
  230. data/rust-vendor/hashbrown-0.15.5/src/macros.rs +70 -0
  231. data/rust-vendor/hashbrown-0.15.5/src/map.rs +6583 -0
  232. data/rust-vendor/hashbrown-0.15.5/src/raw/alloc.rs +92 -0
  233. data/rust-vendor/hashbrown-0.15.5/src/raw/mod.rs +4436 -0
  234. data/rust-vendor/hashbrown-0.15.5/src/raw_entry.rs +1740 -0
  235. data/rust-vendor/hashbrown-0.15.5/src/rustc_entry.rs +567 -0
  236. data/rust-vendor/hashbrown-0.15.5/src/scopeguard.rs +72 -0
  237. data/rust-vendor/hashbrown-0.15.5/src/set.rs +3121 -0
  238. data/rust-vendor/hashbrown-0.15.5/src/table.rs +2380 -0
  239. data/rust-vendor/hashbrown-0.15.5/src/util.rs +38 -0
  240. data/rust-vendor/hashbrown-0.15.5/tests/equivalent_trait.rs +53 -0
  241. data/rust-vendor/hashbrown-0.15.5/tests/hasher.rs +65 -0
  242. data/rust-vendor/hashbrown-0.15.5/tests/rayon.rs +535 -0
  243. data/rust-vendor/hashbrown-0.15.5/tests/serde.rs +65 -0
  244. data/rust-vendor/hashbrown-0.15.5/tests/set.rs +34 -0
  245. data/rust-vendor/heck/.cargo-checksum.json +1 -0
  246. data/rust-vendor/heck/.cargo_vcs_info.json +6 -0
  247. data/rust-vendor/heck/CHANGELOG.md +25 -0
  248. data/rust-vendor/heck/Cargo.toml +34 -0
  249. data/rust-vendor/heck/Cargo.toml.orig +11 -0
  250. data/rust-vendor/heck/LICENSE-APACHE +201 -0
  251. data/rust-vendor/heck/LICENSE-MIT +25 -0
  252. data/rust-vendor/heck/README.md +53 -0
  253. data/rust-vendor/heck/src/kebab.rs +75 -0
  254. data/rust-vendor/heck/src/lib.rs +192 -0
  255. data/rust-vendor/heck/src/lower_camel.rs +88 -0
  256. data/rust-vendor/heck/src/shouty_kebab.rs +73 -0
  257. data/rust-vendor/heck/src/shouty_snake.rs +86 -0
  258. data/rust-vendor/heck/src/snake.rs +100 -0
  259. data/rust-vendor/heck/src/title.rs +75 -0
  260. data/rust-vendor/heck/src/train.rs +87 -0
  261. data/rust-vendor/heck/src/upper_camel.rs +88 -0
  262. data/rust-vendor/html-to-markdown-rs/src/converter/inline/semantic/typography.rs +32 -22
  263. data/rust-vendor/html-to-markdown-rs/tests/integration_test.rs +44 -0
  264. data/rust-vendor/id-arena/.cargo-checksum.json +1 -0
  265. data/rust-vendor/id-arena/.cargo_vcs_info.json +6 -0
  266. data/rust-vendor/id-arena/.travis.yml +22 -0
  267. data/rust-vendor/id-arena/CHANGELOG.md +71 -0
  268. data/rust-vendor/id-arena/Cargo.lock +61 -0
  269. data/rust-vendor/id-arena/Cargo.toml +54 -0
  270. data/rust-vendor/id-arena/Cargo.toml.orig +21 -0
  271. data/rust-vendor/id-arena/LICENSE-APACHE +201 -0
  272. data/rust-vendor/id-arena/LICENSE-MIT +25 -0
  273. data/rust-vendor/id-arena/README.md +101 -0
  274. data/rust-vendor/id-arena/README.tpl +3 -0
  275. data/rust-vendor/id-arena/src/lib.rs +726 -0
  276. data/rust-vendor/id-arena/src/rayon.rs +282 -0
  277. data/rust-vendor/id-arena/tests/readme_up_to_date.rs +22 -0
  278. data/rust-vendor/leb128fmt/.cargo-checksum.json +1 -0
  279. data/rust-vendor/leb128fmt/.cargo_vcs_info.json +6 -0
  280. data/rust-vendor/leb128fmt/CHANGELOG.md +11 -0
  281. data/rust-vendor/leb128fmt/Cargo.toml +55 -0
  282. data/rust-vendor/leb128fmt/Cargo.toml.orig +32 -0
  283. data/rust-vendor/leb128fmt/LICENSE-APACHE +201 -0
  284. data/rust-vendor/leb128fmt/LICENSE-MIT +23 -0
  285. data/rust-vendor/leb128fmt/README.md +162 -0
  286. data/rust-vendor/leb128fmt/src/lib.rs +1650 -0
  287. data/rust-vendor/libc/.cargo-checksum.json +1 -1
  288. data/rust-vendor/libc/.cargo_vcs_info.json +1 -1
  289. data/rust-vendor/libc/CHANGELOG.md +42 -0
  290. data/rust-vendor/libc/Cargo.lock +1 -1
  291. data/rust-vendor/libc/Cargo.toml +75 -51
  292. data/rust-vendor/libc/Cargo.toml.orig +85 -53
  293. data/rust-vendor/libc/LICENSE-MIT +1 -1
  294. data/rust-vendor/libc/src/fuchsia/mod.rs +12 -10
  295. data/rust-vendor/libc/src/macros.rs +63 -71
  296. data/rust-vendor/libc/src/new/linux_uapi/linux/can/error.rs +73 -0
  297. data/rust-vendor/libc/src/new/linux_uapi/linux/can.rs +1 -0
  298. data/rust-vendor/libc/src/new/mod.rs +3 -2
  299. data/rust-vendor/libc/src/new/qurt/dlfcn.rs +26 -0
  300. data/rust-vendor/libc/src/new/qurt/fcntl.rs +4 -1
  301. data/rust-vendor/libc/src/new/qurt/mod.rs +224 -14
  302. data/rust-vendor/libc/src/new/qurt/pthread.rs +1 -22
  303. data/rust-vendor/libc/src/new/qurt/signal.rs +54 -4
  304. data/rust-vendor/libc/src/new/qurt/stdio.rs +0 -5
  305. data/rust-vendor/libc/src/new/qurt/sys/mman.rs +55 -0
  306. data/rust-vendor/libc/src/new/qurt/sys/mod.rs +2 -0
  307. data/rust-vendor/libc/src/new/qurt/sys/sched.rs +24 -0
  308. data/rust-vendor/libc/src/new/qurt/sys/stat.rs +0 -6
  309. data/rust-vendor/libc/src/new/qurt/time.rs +4 -22
  310. data/rust-vendor/libc/src/new/qurt/unistd.rs +210 -20
  311. data/rust-vendor/libc/src/qurt/mod.rs +9 -325
  312. data/rust-vendor/libc/src/types.rs +2 -2
  313. data/rust-vendor/libc/src/unix/aix/mod.rs +11 -20
  314. data/rust-vendor/libc/src/unix/aix/powerpc64.rs +6 -6
  315. data/rust-vendor/libc/src/unix/bsd/apple/mod.rs +15 -0
  316. data/rust-vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs +4 -4
  317. data/rust-vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +3 -3
  318. data/rust-vendor/libc/src/unix/bsd/freebsdlike/mod.rs +14 -0
  319. data/rust-vendor/libc/src/unix/bsd/mod.rs +0 -14
  320. data/rust-vendor/libc/src/unix/bsd/netbsdlike/mod.rs +6 -0
  321. data/rust-vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs +15 -7
  322. data/rust-vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs +41 -1
  323. data/rust-vendor/libc/src/unix/cygwin/mod.rs +2 -2
  324. data/rust-vendor/libc/src/unix/haiku/mod.rs +1 -1
  325. data/rust-vendor/libc/src/unix/haiku/x86_64.rs +2 -2
  326. data/rust-vendor/libc/src/unix/hurd/mod.rs +6 -6
  327. data/rust-vendor/libc/src/unix/linux_like/android/mod.rs +2 -0
  328. data/rust-vendor/libc/src/unix/linux_like/linux/gnu/mod.rs +3 -0
  329. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs +16 -13
  330. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs +12 -13
  331. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs +25 -16
  332. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs +16 -13
  333. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +12 -15
  334. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs +10 -13
  335. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +0 -15
  336. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs +0 -15
  337. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs +0 -15
  338. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs +0 -15
  339. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +0 -15
  340. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs +0 -15
  341. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs +0 -15
  342. data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +9 -15
  343. data/rust-vendor/libc/src/unix/mod.rs +87 -11
  344. data/rust-vendor/libc/src/unix/newlib/arm/mod.rs +1 -1
  345. data/rust-vendor/libc/src/unix/newlib/horizon/mod.rs +1 -1
  346. data/rust-vendor/libc/src/unix/newlib/vita/mod.rs +3 -3
  347. data/rust-vendor/libc/src/unix/nto/mod.rs +23 -6
  348. data/rust-vendor/libc/src/unix/redox/mod.rs +45 -3
  349. data/rust-vendor/libc/src/unix/solarish/illumos.rs +2 -0
  350. data/rust-vendor/libc/src/vxworks/mod.rs +7 -7
  351. data/rust-vendor/memchr/.cargo-checksum.json +1 -1
  352. data/rust-vendor/memchr/.cargo_vcs_info.json +1 -1
  353. data/rust-vendor/memchr/Cargo.lock +13 -13
  354. data/rust-vendor/memchr/Cargo.toml +1 -1
  355. data/rust-vendor/memchr/Cargo.toml.orig +1 -1
  356. data/rust-vendor/memchr/src/cow.rs +3 -1
  357. data/rust-vendor/memchr/src/memmem/mod.rs +42 -3
  358. data/rust-vendor/prettyplease/.cargo-checksum.json +1 -0
  359. data/rust-vendor/prettyplease/.cargo_vcs_info.json +6 -0
  360. data/rust-vendor/prettyplease/.github/FUNDING.yml +1 -0
  361. data/rust-vendor/prettyplease/.github/workflows/ci.yml +123 -0
  362. data/rust-vendor/prettyplease/Cargo.lock +54 -0
  363. data/rust-vendor/prettyplease/Cargo.toml +90 -0
  364. data/rust-vendor/prettyplease/Cargo.toml.orig +43 -0
  365. data/rust-vendor/prettyplease/LICENSE-APACHE +176 -0
  366. data/rust-vendor/prettyplease/LICENSE-MIT +23 -0
  367. data/rust-vendor/prettyplease/README.md +312 -0
  368. data/rust-vendor/prettyplease/build.rs +21 -0
  369. data/rust-vendor/prettyplease/examples/.tokeignore +1 -0
  370. data/rust-vendor/prettyplease/examples/input.rs +1 -0
  371. data/rust-vendor/prettyplease/examples/output.prettyplease.rs +593 -0
  372. data/rust-vendor/prettyplease/examples/output.rustc.rs +506 -0
  373. data/rust-vendor/prettyplease/examples/output.rustfmt.rs +552 -0
  374. data/rust-vendor/prettyplease/src/algorithm.rs +386 -0
  375. data/rust-vendor/prettyplease/src/attr.rs +288 -0
  376. data/rust-vendor/prettyplease/src/classify.rs +324 -0
  377. data/rust-vendor/prettyplease/src/convenience.rs +98 -0
  378. data/rust-vendor/prettyplease/src/data.rs +79 -0
  379. data/rust-vendor/prettyplease/src/expr.rs +1533 -0
  380. data/rust-vendor/prettyplease/src/file.rs +17 -0
  381. data/rust-vendor/prettyplease/src/fixup.rs +676 -0
  382. data/rust-vendor/prettyplease/src/generics.rs +426 -0
  383. data/rust-vendor/prettyplease/src/item.rs +1813 -0
  384. data/rust-vendor/prettyplease/src/iter.rs +46 -0
  385. data/rust-vendor/prettyplease/src/lib.rs +385 -0
  386. data/rust-vendor/prettyplease/src/lifetime.rs +9 -0
  387. data/rust-vendor/prettyplease/src/lit.rs +57 -0
  388. data/rust-vendor/prettyplease/src/mac.rs +706 -0
  389. data/rust-vendor/prettyplease/src/pat.rs +254 -0
  390. data/rust-vendor/prettyplease/src/path.rs +194 -0
  391. data/rust-vendor/prettyplease/src/precedence.rs +148 -0
  392. data/rust-vendor/prettyplease/src/ring.rs +81 -0
  393. data/rust-vendor/prettyplease/src/stmt.rs +221 -0
  394. data/rust-vendor/prettyplease/src/token.rs +80 -0
  395. data/rust-vendor/prettyplease/src/ty.rs +326 -0
  396. data/rust-vendor/prettyplease/tests/test.rs +51 -0
  397. data/rust-vendor/prettyplease/tests/test_precedence.rs +900 -0
  398. data/rust-vendor/regex/.cargo-checksum.json +1 -1
  399. data/rust-vendor/regex/.cargo_vcs_info.json +1 -1
  400. data/rust-vendor/regex/CHANGELOG.md +13 -0
  401. data/rust-vendor/regex/Cargo.lock +5 -5
  402. data/rust-vendor/regex/Cargo.toml +15 -7
  403. data/rust-vendor/regex/Cargo.toml.orig +19 -2
  404. data/rust-vendor/regex-automata/.cargo-checksum.json +1 -1
  405. data/rust-vendor/regex-automata/.cargo_vcs_info.json +1 -1
  406. data/rust-vendor/regex-automata/Cargo.lock +3 -3
  407. data/rust-vendor/regex-automata/Cargo.toml +16 -1
  408. data/rust-vendor/regex-automata/Cargo.toml.orig +2 -1
  409. data/rust-vendor/regex-automata/src/dfa/onepass.rs +21 -5
  410. data/rust-vendor/regex-automata/tests/dfa/onepass/mod.rs +1 -0
  411. data/rust-vendor/regex-automata/tests/dfa/onepass/regression.rs +61 -0
  412. data/rust-vendor/regex-automata/tests/nfa/thompson/backtrack/mod.rs +1 -0
  413. data/rust-vendor/regex-automata/tests/nfa/thompson/backtrack/regression.rs +20 -0
  414. data/rust-vendor/regex-automata/tests/nfa/thompson/pikevm/mod.rs +1 -0
  415. data/rust-vendor/regex-automata/tests/nfa/thompson/pikevm/regression.rs +20 -0
  416. data/rust-vendor/regex-syntax/.cargo-checksum.json +1 -1
  417. data/rust-vendor/regex-syntax/.cargo_vcs_info.json +1 -1
  418. data/rust-vendor/regex-syntax/Cargo.lock +1 -1
  419. data/rust-vendor/regex-syntax/Cargo.toml +16 -5
  420. data/rust-vendor/regex-syntax/Cargo.toml.orig +2 -1
  421. data/rust-vendor/semver/.cargo-checksum.json +1 -0
  422. data/rust-vendor/semver/.cargo_vcs_info.json +6 -0
  423. data/rust-vendor/semver/.github/FUNDING.yml +1 -0
  424. data/rust-vendor/semver/.github/workflows/ci.yml +140 -0
  425. data/rust-vendor/semver/Cargo.lock +75 -0
  426. data/rust-vendor/semver/Cargo.toml +86 -0
  427. data/rust-vendor/semver/Cargo.toml.orig +36 -0
  428. data/rust-vendor/semver/LICENSE-APACHE +176 -0
  429. data/rust-vendor/semver/LICENSE-MIT +23 -0
  430. data/rust-vendor/semver/README.md +84 -0
  431. data/rust-vendor/semver/benches/parse.rs +24 -0
  432. data/rust-vendor/semver/src/display.rs +163 -0
  433. data/rust-vendor/semver/src/error.rs +126 -0
  434. data/rust-vendor/semver/src/eval.rs +179 -0
  435. data/rust-vendor/semver/src/identifier.rs +412 -0
  436. data/rust-vendor/semver/src/impls.rs +163 -0
  437. data/rust-vendor/semver/src/lib.rs +570 -0
  438. data/rust-vendor/semver/src/parse.rs +404 -0
  439. data/rust-vendor/semver/src/serde.rs +109 -0
  440. data/rust-vendor/semver/tests/node/mod.rs +43 -0
  441. data/rust-vendor/semver/tests/test_autotrait.rs +14 -0
  442. data/rust-vendor/semver/tests/test_identifier.rs +51 -0
  443. data/rust-vendor/semver/tests/test_version.rs +251 -0
  444. data/rust-vendor/semver/tests/test_version_req.rs +480 -0
  445. data/rust-vendor/semver/tests/util/mod.rs +54 -0
  446. data/rust-vendor/symbolic-common/.cargo-checksum.json +1 -1
  447. data/rust-vendor/symbolic-common/Cargo.lock +74 -3
  448. data/rust-vendor/symbolic-common/Cargo.toml +2 -2
  449. data/rust-vendor/symbolic-common/Cargo.toml.orig +1 -1
  450. data/rust-vendor/symbolic-demangle/.cargo-checksum.json +1 -1
  451. data/rust-vendor/symbolic-demangle/Cargo.lock +87 -9
  452. data/rust-vendor/symbolic-demangle/Cargo.toml +5 -5
  453. data/rust-vendor/symbolic-demangle/Cargo.toml.orig +2 -2
  454. data/rust-vendor/syn/.cargo-checksum.json +1 -1
  455. data/rust-vendor/syn/.cargo_vcs_info.json +1 -1
  456. data/rust-vendor/syn/Cargo.lock +322 -109
  457. data/rust-vendor/syn/Cargo.toml +2 -2
  458. data/rust-vendor/syn/Cargo.toml.orig +2 -2
  459. data/rust-vendor/syn/benches/rust.rs +1 -2
  460. data/rust-vendor/syn/src/lib.rs +1 -1
  461. data/rust-vendor/syn/src/parse.rs +2 -2
  462. data/rust-vendor/syn/src/path.rs +1 -5
  463. data/rust-vendor/syn/tests/common/eq.rs +28 -17
  464. data/rust-vendor/syn/tests/common/parse.rs +1 -2
  465. data/rust-vendor/syn/tests/repo/progress.rs +1 -1
  466. data/rust-vendor/syn/tests/test_round_trip.rs +5 -36
  467. data/rust-vendor/tempfile/.cargo-checksum.json +1 -1
  468. data/rust-vendor/tempfile/.cargo_vcs_info.json +1 -1
  469. data/rust-vendor/tempfile/CHANGELOG.md +4 -0
  470. data/rust-vendor/tempfile/Cargo.lock +333 -21
  471. data/rust-vendor/tempfile/Cargo.toml +2 -2
  472. data/rust-vendor/tempfile/Cargo.toml.orig +2 -2
  473. data/rust-vendor/unicode-ident/.cargo-checksum.json +1 -1
  474. data/rust-vendor/unicode-ident/.cargo_vcs_info.json +1 -1
  475. data/rust-vendor/unicode-ident/.github/workflows/ci.yml +10 -10
  476. data/rust-vendor/unicode-ident/Cargo.lock +468 -186
  477. data/rust-vendor/unicode-ident/Cargo.toml +8 -8
  478. data/rust-vendor/unicode-ident/Cargo.toml.orig +7 -5
  479. data/rust-vendor/unicode-ident/src/lib.rs +1 -1
  480. data/rust-vendor/unicode-xid/.cargo-checksum.json +1 -0
  481. data/rust-vendor/unicode-xid/.cargo_vcs_info.json +6 -0
  482. data/rust-vendor/unicode-xid/COPYRIGHT +7 -0
  483. data/rust-vendor/unicode-xid/Cargo.toml +65 -0
  484. data/rust-vendor/unicode-xid/Cargo.toml.orig +34 -0
  485. data/rust-vendor/unicode-xid/LICENSE-APACHE +201 -0
  486. data/rust-vendor/unicode-xid/LICENSE-MIT +25 -0
  487. data/rust-vendor/unicode-xid/README.md +61 -0
  488. data/rust-vendor/unicode-xid/benches/xid.rs +60 -0
  489. data/rust-vendor/unicode-xid/src/lib.rs +90 -0
  490. data/rust-vendor/unicode-xid/src/tables.rs +1537 -0
  491. data/rust-vendor/unicode-xid/src/tests.rs +95 -0
  492. data/rust-vendor/unicode-xid/tests/exhaustive_tests.rs +25 -0
  493. data/rust-vendor/uuid/.cargo-checksum.json +1 -1
  494. data/rust-vendor/uuid/.cargo_vcs_info.json +1 -1
  495. data/rust-vendor/uuid/Cargo.lock +298 -44
  496. data/rust-vendor/uuid/Cargo.toml +5 -5
  497. data/rust-vendor/uuid/Cargo.toml.orig +5 -5
  498. data/rust-vendor/uuid/README.md +3 -3
  499. data/rust-vendor/uuid/src/error.rs +1 -7
  500. data/rust-vendor/uuid/src/lib.rs +4 -4
  501. data/rust-vendor/wasip3/.cargo-checksum.json +1 -0
  502. data/rust-vendor/wasip3/.cargo_vcs_info.json +6 -0
  503. data/rust-vendor/wasip3/Cargo.lock +483 -0
  504. data/rust-vendor/wasip3/Cargo.toml +96 -0
  505. data/rust-vendor/wasip3/Cargo.toml.orig +49 -0
  506. data/rust-vendor/wasip3/README.md +56 -0
  507. data/rust-vendor/wasip3/examples/cli-command.rs +19 -0
  508. data/rust-vendor/wasip3/examples/http-proxy-compat.rs +20 -0
  509. data/rust-vendor/wasip3/examples/http-proxy.rs +22 -0
  510. data/rust-vendor/wasip3/src/command.rs +513 -0
  511. data/rust-vendor/wasip3/src/http_compat/body_writer.rs +145 -0
  512. data/rust-vendor/wasip3/src/http_compat/conversions.rs +307 -0
  513. data/rust-vendor/wasip3/src/http_compat/mod.rs +314 -0
  514. data/rust-vendor/wasip3/src/imports.rs +10543 -0
  515. data/rust-vendor/wasip3/src/lib.rs +280 -0
  516. data/rust-vendor/wasip3/src/service.rs +7274 -0
  517. data/rust-vendor/wasip3/wit/deps/cli.wit +256 -0
  518. data/rust-vendor/wasip3/wit/deps/clocks.wit +161 -0
  519. data/rust-vendor/wasip3/wit/deps/filesystem.wit +553 -0
  520. data/rust-vendor/wasip3/wit/deps/http.wit +457 -0
  521. data/rust-vendor/wasip3/wit/deps/random.wit +92 -0
  522. data/rust-vendor/wasip3/wit/deps/sockets.wit +752 -0
  523. data/rust-vendor/wasip3/wit/wasi-crate.wit +1 -0
  524. data/rust-vendor/wasm-encoder/.cargo-checksum.json +1 -0
  525. data/rust-vendor/wasm-encoder/.cargo_vcs_info.json +6 -0
  526. data/rust-vendor/wasm-encoder/Cargo.lock +348 -0
  527. data/rust-vendor/wasm-encoder/Cargo.toml +104 -0
  528. data/rust-vendor/wasm-encoder/Cargo.toml.orig +43 -0
  529. data/rust-vendor/wasm-encoder/README.md +81 -0
  530. data/rust-vendor/wasm-encoder/src/component/aliases.rs +161 -0
  531. data/rust-vendor/wasm-encoder/src/component/builder.rs +826 -0
  532. data/rust-vendor/wasm-encoder/src/component/canonicals.rs +584 -0
  533. data/rust-vendor/wasm-encoder/src/component/components.rs +30 -0
  534. data/rust-vendor/wasm-encoder/src/component/exports.rs +130 -0
  535. data/rust-vendor/wasm-encoder/src/component/imports.rs +170 -0
  536. data/rust-vendor/wasm-encoder/src/component/instances.rs +200 -0
  537. data/rust-vendor/wasm-encoder/src/component/modules.rs +30 -0
  538. data/rust-vendor/wasm-encoder/src/component/names.rs +162 -0
  539. data/rust-vendor/wasm-encoder/src/component/start.rs +53 -0
  540. data/rust-vendor/wasm-encoder/src/component/types.rs +816 -0
  541. data/rust-vendor/wasm-encoder/src/component.rs +169 -0
  542. data/rust-vendor/wasm-encoder/src/core/branch_hints.rs +127 -0
  543. data/rust-vendor/wasm-encoder/src/core/code.rs +2464 -0
  544. data/rust-vendor/wasm-encoder/src/core/custom.rs +74 -0
  545. data/rust-vendor/wasm-encoder/src/core/data.rs +187 -0
  546. data/rust-vendor/wasm-encoder/src/core/dump.rs +629 -0
  547. data/rust-vendor/wasm-encoder/src/core/elements.rs +225 -0
  548. data/rust-vendor/wasm-encoder/src/core/exports.rs +86 -0
  549. data/rust-vendor/wasm-encoder/src/core/functions.rs +64 -0
  550. data/rust-vendor/wasm-encoder/src/core/globals.rs +101 -0
  551. data/rust-vendor/wasm-encoder/src/core/imports.rs +230 -0
  552. data/rust-vendor/wasm-encoder/src/core/instructions.rs +4686 -0
  553. data/rust-vendor/wasm-encoder/src/core/linking.rs +264 -0
  554. data/rust-vendor/wasm-encoder/src/core/memories.rs +116 -0
  555. data/rust-vendor/wasm-encoder/src/core/names.rs +305 -0
  556. data/rust-vendor/wasm-encoder/src/core/producers.rs +181 -0
  557. data/rust-vendor/wasm-encoder/src/core/start.rs +40 -0
  558. data/rust-vendor/wasm-encoder/src/core/tables.rs +130 -0
  559. data/rust-vendor/wasm-encoder/src/core/tags.rs +86 -0
  560. data/rust-vendor/wasm-encoder/src/core/types.rs +753 -0
  561. data/rust-vendor/wasm-encoder/src/core.rs +179 -0
  562. data/rust-vendor/wasm-encoder/src/lib.rs +224 -0
  563. data/rust-vendor/wasm-encoder/src/raw.rs +32 -0
  564. data/rust-vendor/wasm-encoder/src/reencode/component.rs +1548 -0
  565. data/rust-vendor/wasm-encoder/src/reencode.rs +2134 -0
  566. data/rust-vendor/wasm-metadata/.cargo-checksum.json +1 -0
  567. data/rust-vendor/wasm-metadata/.cargo_vcs_info.json +6 -0
  568. data/rust-vendor/wasm-metadata/Cargo.lock +769 -0
  569. data/rust-vendor/wasm-metadata/Cargo.toml +152 -0
  570. data/rust-vendor/wasm-metadata/Cargo.toml.orig +38 -0
  571. data/rust-vendor/wasm-metadata/README.md +27 -0
  572. data/rust-vendor/wasm-metadata/src/add_metadata.rs +91 -0
  573. data/rust-vendor/wasm-metadata/src/clap.rs +169 -0
  574. data/rust-vendor/wasm-metadata/src/dependencies.rs +142 -0
  575. data/rust-vendor/wasm-metadata/src/lib.rs +83 -0
  576. data/rust-vendor/wasm-metadata/src/metadata.rs +34 -0
  577. data/rust-vendor/wasm-metadata/src/names/component.rs +107 -0
  578. data/rust-vendor/wasm-metadata/src/names/mod.rs +5 -0
  579. data/rust-vendor/wasm-metadata/src/names/module.rs +101 -0
  580. data/rust-vendor/wasm-metadata/src/oci_annotations/authors.rs +111 -0
  581. data/rust-vendor/wasm-metadata/src/oci_annotations/description.rs +110 -0
  582. data/rust-vendor/wasm-metadata/src/oci_annotations/homepage.rs +118 -0
  583. data/rust-vendor/wasm-metadata/src/oci_annotations/licenses.rs +122 -0
  584. data/rust-vendor/wasm-metadata/src/oci_annotations/mod.rs +32 -0
  585. data/rust-vendor/wasm-metadata/src/oci_annotations/revision.rs +113 -0
  586. data/rust-vendor/wasm-metadata/src/oci_annotations/source.rs +117 -0
  587. data/rust-vendor/wasm-metadata/src/oci_annotations/version.rs +110 -0
  588. data/rust-vendor/wasm-metadata/src/payload.rs +215 -0
  589. data/rust-vendor/wasm-metadata/src/producers.rs +254 -0
  590. data/rust-vendor/wasm-metadata/src/rewrite.rs +224 -0
  591. data/rust-vendor/wasm-metadata/src/utils.rs +21 -0
  592. data/rust-vendor/wasm-metadata/tests/component.rs +310 -0
  593. data/rust-vendor/wasm-metadata/tests/module.rs +86 -0
  594. data/rust-vendor/wasmparser/.cargo-checksum.json +1 -0
  595. data/rust-vendor/wasmparser/.cargo_vcs_info.json +6 -0
  596. data/rust-vendor/wasmparser/Cargo.lock +687 -0
  597. data/rust-vendor/wasmparser/Cargo.toml +161 -0
  598. data/rust-vendor/wasmparser/Cargo.toml.orig +89 -0
  599. data/rust-vendor/wasmparser/README.md +28 -0
  600. data/rust-vendor/wasmparser/benches/.gitignore +1 -0
  601. data/rust-vendor/wasmparser/benches/benchmark.rs +395 -0
  602. data/rust-vendor/wasmparser/examples/simple.rs +37 -0
  603. data/rust-vendor/wasmparser/src/arity.rs +318 -0
  604. data/rust-vendor/wasmparser/src/binary_reader.rs +2109 -0
  605. data/rust-vendor/wasmparser/src/collections/hash.rs +120 -0
  606. data/rust-vendor/wasmparser/src/collections/index_map/detail.rs +1100 -0
  607. data/rust-vendor/wasmparser/src/collections/index_map/tests.rs +183 -0
  608. data/rust-vendor/wasmparser/src/collections/index_map.rs +653 -0
  609. data/rust-vendor/wasmparser/src/collections/index_set.rs +316 -0
  610. data/rust-vendor/wasmparser/src/collections/map.rs +852 -0
  611. data/rust-vendor/wasmparser/src/collections/mod.rs +34 -0
  612. data/rust-vendor/wasmparser/src/collections/set.rs +672 -0
  613. data/rust-vendor/wasmparser/src/features.rs +442 -0
  614. data/rust-vendor/wasmparser/src/lib.rs +1340 -0
  615. data/rust-vendor/wasmparser/src/limits.rs +90 -0
  616. data/rust-vendor/wasmparser/src/parser.rs +1925 -0
  617. data/rust-vendor/wasmparser/src/readers/component/aliases.rs +119 -0
  618. data/rust-vendor/wasmparser/src/readers/component/canonicals.rs +458 -0
  619. data/rust-vendor/wasmparser/src/readers/component/exports.rs +135 -0
  620. data/rust-vendor/wasmparser/src/readers/component/imports.rs +145 -0
  621. data/rust-vendor/wasmparser/src/readers/component/instances.rs +166 -0
  622. data/rust-vendor/wasmparser/src/readers/component/names.rs +101 -0
  623. data/rust-vendor/wasmparser/src/readers/component/start.rs +31 -0
  624. data/rust-vendor/wasmparser/src/readers/component/types.rs +537 -0
  625. data/rust-vendor/wasmparser/src/readers/component.rs +17 -0
  626. data/rust-vendor/wasmparser/src/readers/core/branch_hinting.rs +59 -0
  627. data/rust-vendor/wasmparser/src/readers/core/code.rs +177 -0
  628. data/rust-vendor/wasmparser/src/readers/core/coredumps.rs +274 -0
  629. data/rust-vendor/wasmparser/src/readers/core/custom.rs +134 -0
  630. data/rust-vendor/wasmparser/src/readers/core/data.rs +94 -0
  631. data/rust-vendor/wasmparser/src/readers/core/dylink0.rs +117 -0
  632. data/rust-vendor/wasmparser/src/readers/core/elements.rs +153 -0
  633. data/rust-vendor/wasmparser/src/readers/core/exports.rs +75 -0
  634. data/rust-vendor/wasmparser/src/readers/core/functions.rs +17 -0
  635. data/rust-vendor/wasmparser/src/readers/core/globals.rs +51 -0
  636. data/rust-vendor/wasmparser/src/readers/core/imports.rs +307 -0
  637. data/rust-vendor/wasmparser/src/readers/core/init.rs +70 -0
  638. data/rust-vendor/wasmparser/src/readers/core/linking.rs +457 -0
  639. data/rust-vendor/wasmparser/src/readers/core/memories.rs +61 -0
  640. data/rust-vendor/wasmparser/src/readers/core/names.rs +162 -0
  641. data/rust-vendor/wasmparser/src/readers/core/operators.rs +1105 -0
  642. data/rust-vendor/wasmparser/src/readers/core/producers.rs +84 -0
  643. data/rust-vendor/wasmparser/src/readers/core/reloc.rs +300 -0
  644. data/rust-vendor/wasmparser/src/readers/core/tables.rs +96 -0
  645. data/rust-vendor/wasmparser/src/readers/core/tags.rs +32 -0
  646. data/rust-vendor/wasmparser/src/readers/core/types/matches.rs +321 -0
  647. data/rust-vendor/wasmparser/src/readers/core/types.rs +2249 -0
  648. data/rust-vendor/wasmparser/src/readers/core.rs +43 -0
  649. data/rust-vendor/wasmparser/src/readers.rs +330 -0
  650. data/rust-vendor/wasmparser/src/resources.rs +265 -0
  651. data/rust-vendor/wasmparser/src/validator/component.rs +4765 -0
  652. data/rust-vendor/wasmparser/src/validator/component_types.rs +4036 -0
  653. data/rust-vendor/wasmparser/src/validator/core/canonical.rs +552 -0
  654. data/rust-vendor/wasmparser/src/validator/core.rs +1313 -0
  655. data/rust-vendor/wasmparser/src/validator/func.rs +613 -0
  656. data/rust-vendor/wasmparser/src/validator/names.rs +1017 -0
  657. data/rust-vendor/wasmparser/src/validator/operators/simd.rs +971 -0
  658. data/rust-vendor/wasmparser/src/validator/operators.rs +4696 -0
  659. data/rust-vendor/wasmparser/src/validator/types.rs +1327 -0
  660. data/rust-vendor/wasmparser/src/validator.rs +1645 -0
  661. data/rust-vendor/wasmparser/tests/big-module.rs +62 -0
  662. data/rust-vendor/wit-bindgen/.cargo-checksum.json +1 -1
  663. data/rust-vendor/wit-bindgen/.cargo_vcs_info.json +1 -1
  664. data/rust-vendor/wit-bindgen/Cargo.lock +76 -66
  665. data/rust-vendor/wit-bindgen/Cargo.toml +25 -11
  666. data/rust-vendor/wit-bindgen/Cargo.toml.orig +11 -3
  667. data/rust-vendor/wit-bindgen/src/lib.rs +21 -15
  668. data/rust-vendor/wit-bindgen/src/rt/async_support/abi_buffer.rs +35 -32
  669. data/rust-vendor/wit-bindgen/src/rt/async_support/cabi.rs +15 -20
  670. data/rust-vendor/wit-bindgen/src/rt/async_support/error_context.rs +11 -22
  671. data/rust-vendor/wit-bindgen/src/rt/async_support/future_support.rs +406 -146
  672. data/rust-vendor/wit-bindgen/src/rt/async_support/inter_task_wakeup.rs +98 -0
  673. data/rust-vendor/wit-bindgen/src/rt/async_support/inter_task_wakeup_disabled.rs +45 -0
  674. data/rust-vendor/wit-bindgen/src/rt/async_support/spawn.rs +82 -0
  675. data/rust-vendor/wit-bindgen/src/rt/async_support/spawn_disabled.rs +30 -0
  676. data/rust-vendor/wit-bindgen/src/rt/async_support/stream_support.rs +262 -122
  677. data/rust-vendor/wit-bindgen/src/rt/async_support/subtask.rs +49 -54
  678. data/rust-vendor/wit-bindgen/src/rt/async_support/unit_stream.rs +81 -0
  679. data/rust-vendor/wit-bindgen/src/rt/async_support/waitable.rs +47 -31
  680. data/rust-vendor/wit-bindgen/src/rt/async_support/waitable_set.rs +17 -35
  681. data/rust-vendor/wit-bindgen/src/rt/async_support.rs +262 -188
  682. data/rust-vendor/wit-bindgen/src/rt/mod.rs +14 -12
  683. data/rust-vendor/wit-bindgen/src/rt/wit_bindgen_cabi_realloc.c +2 -2
  684. data/rust-vendor/wit-bindgen/src/rt/wit_bindgen_cabi_realloc.o +0 -0
  685. data/rust-vendor/wit-bindgen/src/rt/wit_bindgen_cabi_realloc.rs +2 -2
  686. data/rust-vendor/wit-bindgen/src/rt/wit_bindgen_cabi_wasip3.o +0 -0
  687. data/rust-vendor/wit-bindgen-0.46.0/.cargo-checksum.json +1 -0
  688. data/rust-vendor/wit-bindgen-0.46.0/.cargo_vcs_info.json +6 -0
  689. data/rust-vendor/wit-bindgen-0.46.0/Cargo.lock +428 -0
  690. data/rust-vendor/wit-bindgen-0.46.0/Cargo.toml +88 -0
  691. data/rust-vendor/wit-bindgen-0.46.0/Cargo.toml.orig +37 -0
  692. data/rust-vendor/wit-bindgen-0.46.0/LICENSE-APACHE +201 -0
  693. data/rust-vendor/wit-bindgen-0.46.0/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  694. data/rust-vendor/wit-bindgen-0.46.0/LICENSE-MIT +23 -0
  695. data/rust-vendor/wit-bindgen-0.46.0/README.md +45 -0
  696. data/rust-vendor/wit-bindgen-0.46.0/build.rs +32 -0
  697. data/rust-vendor/wit-bindgen-0.46.0/src/examples/_0_world_imports.rs +17 -0
  698. data/rust-vendor/wit-bindgen-0.46.0/src/examples/_1_interface_imports.rs +32 -0
  699. data/rust-vendor/wit-bindgen-0.46.0/src/examples/_2_imported_resources.rs +22 -0
  700. data/rust-vendor/wit-bindgen-0.46.0/src/examples/_3_world_exports.rs +47 -0
  701. data/rust-vendor/wit-bindgen-0.46.0/src/examples/_4_exported_resources.rs +26 -0
  702. data/rust-vendor/wit-bindgen-0.46.0/src/examples.rs +55 -0
  703. data/rust-vendor/wit-bindgen-0.46.0/src/lib.rs +881 -0
  704. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/abi_buffer.rs +417 -0
  705. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/cabi.rs +112 -0
  706. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/error_context.rs +94 -0
  707. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/future_support.rs +734 -0
  708. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/stream_support.rs +604 -0
  709. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/subtask.rs +289 -0
  710. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/waitable.rs +466 -0
  711. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/waitable_set.rs +100 -0
  712. data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support.rs +634 -0
  713. data/rust-vendor/wit-bindgen-0.46.0/src/rt/mod.rs +230 -0
  714. data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_realloc.c +10 -0
  715. data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_realloc.o +0 -0
  716. data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_realloc.rs +11 -0
  717. data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_wasip3.c +12 -0
  718. data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_wasip3.o +0 -0
  719. data/rust-vendor/wit-bindgen-0.46.0/wasi-cli@0.2.0.wasm +0 -0
  720. data/rust-vendor/wit-bindgen-core/.cargo-checksum.json +1 -0
  721. data/rust-vendor/wit-bindgen-core/.cargo_vcs_info.json +6 -0
  722. data/rust-vendor/wit-bindgen-core/Cargo.lock +340 -0
  723. data/rust-vendor/wit-bindgen-core/Cargo.toml +75 -0
  724. data/rust-vendor/wit-bindgen-core/Cargo.toml.orig +30 -0
  725. data/rust-vendor/wit-bindgen-core/LICENSE-APACHE +201 -0
  726. data/rust-vendor/wit-bindgen-core/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  727. data/rust-vendor/wit-bindgen-core/LICENSE-MIT +23 -0
  728. data/rust-vendor/wit-bindgen-core/src/abi.rs +2526 -0
  729. data/rust-vendor/wit-bindgen-core/src/async_.rs +200 -0
  730. data/rust-vendor/wit-bindgen-core/src/lib.rs +239 -0
  731. data/rust-vendor/wit-bindgen-core/src/ns.rs +27 -0
  732. data/rust-vendor/wit-bindgen-core/src/path.rs +47 -0
  733. data/rust-vendor/wit-bindgen-core/src/source.rs +222 -0
  734. data/rust-vendor/wit-bindgen-core/src/types.rs +232 -0
  735. data/rust-vendor/wit-bindgen-rust/.cargo-checksum.json +1 -0
  736. data/rust-vendor/wit-bindgen-rust/.cargo_vcs_info.json +6 -0
  737. data/rust-vendor/wit-bindgen-rust/Cargo.lock +547 -0
  738. data/rust-vendor/wit-bindgen-rust/Cargo.toml +112 -0
  739. data/rust-vendor/wit-bindgen-rust/Cargo.toml.orig +44 -0
  740. data/rust-vendor/wit-bindgen-rust/LICENSE-APACHE +201 -0
  741. data/rust-vendor/wit-bindgen-rust/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  742. data/rust-vendor/wit-bindgen-rust/LICENSE-MIT +23 -0
  743. data/rust-vendor/wit-bindgen-rust/build.rs +4 -0
  744. data/rust-vendor/wit-bindgen-rust/src/bindgen.rs +1215 -0
  745. data/rust-vendor/wit-bindgen-rust/src/interface.rs +3020 -0
  746. data/rust-vendor/wit-bindgen-rust/src/lib.rs +1880 -0
  747. data/rust-vendor/wit-bindgen-rust/tests/codegen.rs +174 -0
  748. data/rust-vendor/wit-bindgen-rust/tests/wit/path1/world.wit +3 -0
  749. data/rust-vendor/wit-bindgen-rust/tests/wit/path2/world.wit +3 -0
  750. data/rust-vendor/wit-bindgen-rust/tests/wit/path3/package.wit +3 -0
  751. data/rust-vendor/wit-bindgen-rust-macro/.cargo-checksum.json +1 -0
  752. data/rust-vendor/wit-bindgen-rust-macro/.cargo_vcs_info.json +6 -0
  753. data/rust-vendor/wit-bindgen-rust-macro/Cargo.lock +306 -0
  754. data/rust-vendor/wit-bindgen-rust-macro/Cargo.toml +62 -0
  755. data/rust-vendor/wit-bindgen-rust-macro/Cargo.toml.orig +28 -0
  756. data/rust-vendor/wit-bindgen-rust-macro/LICENSE-APACHE +201 -0
  757. data/rust-vendor/wit-bindgen-rust-macro/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  758. data/rust-vendor/wit-bindgen-rust-macro/LICENSE-MIT +23 -0
  759. data/rust-vendor/wit-bindgen-rust-macro/build.rs +5 -0
  760. data/rust-vendor/wit-bindgen-rust-macro/src/lib.rs +606 -0
  761. data/rust-vendor/wit-component/.cargo-checksum.json +1 -0
  762. data/rust-vendor/wit-component/.cargo_vcs_info.json +6 -0
  763. data/rust-vendor/wit-component/Cargo.lock +1823 -0
  764. data/rust-vendor/wit-component/Cargo.toml +217 -0
  765. data/rust-vendor/wit-component/Cargo.toml.orig +61 -0
  766. data/rust-vendor/wit-component/README.md +251 -0
  767. data/rust-vendor/wit-component/src/dummy.rs +395 -0
  768. data/rust-vendor/wit-component/src/encoding/dedupe.rs +164 -0
  769. data/rust-vendor/wit-component/src/encoding/types.rs +510 -0
  770. data/rust-vendor/wit-component/src/encoding/wit.rs +393 -0
  771. data/rust-vendor/wit-component/src/encoding/world.rs +525 -0
  772. data/rust-vendor/wit-component/src/encoding.rs +3231 -0
  773. data/rust-vendor/wit-component/src/gc.rs +1134 -0
  774. data/rust-vendor/wit-component/src/lib.rs +178 -0
  775. data/rust-vendor/wit-component/src/linking/metadata.rs +515 -0
  776. data/rust-vendor/wit-component/src/linking.rs +1727 -0
  777. data/rust-vendor/wit-component/src/metadata.rs +447 -0
  778. data/rust-vendor/wit-component/src/printing.rs +1485 -0
  779. data/rust-vendor/wit-component/src/semver_check.rs +113 -0
  780. data/rust-vendor/wit-component/src/targets.rs +44 -0
  781. data/rust-vendor/wit-component/src/validation.rs +2679 -0
  782. data/rust-vendor/wit-component/tests/.gitignore +2 -0
  783. data/rust-vendor/wit-component/tests/components/adapt-empty-interface/adapt-old.wat +3 -0
  784. data/rust-vendor/wit-component/tests/components/adapt-empty-interface/adapt-old.wit +5 -0
  785. data/rust-vendor/wit-component/tests/components/adapt-empty-interface/component.wat +60 -0
  786. data/rust-vendor/wit-component/tests/components/adapt-empty-interface/component.wit.print +4 -0
  787. data/rust-vendor/wit-component/tests/components/adapt-empty-interface/module.wat +3 -0
  788. data/rust-vendor/wit-component/tests/components/adapt-empty-interface/module.wit +2 -0
  789. data/rust-vendor/wit-component/tests/components/adapt-export-default/adapt-old.wat +4 -0
  790. data/rust-vendor/wit-component/tests/components/adapt-export-default/adapt-old.wit +3 -0
  791. data/rust-vendor/wit-component/tests/components/adapt-export-default/component.wat +32 -0
  792. data/rust-vendor/wit-component/tests/components/adapt-export-default/component.wit.print +5 -0
  793. data/rust-vendor/wit-component/tests/components/adapt-export-default/module.wat +3 -0
  794. data/rust-vendor/wit-component/tests/components/adapt-export-default/module.wit +2 -0
  795. data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/adapt-old.wat +4 -0
  796. data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/adapt-old.wit +7 -0
  797. data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/component.wat +42 -0
  798. data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/component.wit.print +5 -0
  799. data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/module.wat +3 -0
  800. data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/module.wit +3 -0
  801. data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/adapt-old.wat +47 -0
  802. data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/adapt-old.wit +6 -0
  803. data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/component.wat +131 -0
  804. data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/component.wit.print +9 -0
  805. data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/module.wat +8 -0
  806. data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/module.wit +3 -0
  807. data/rust-vendor/wit-component/tests/components/adapt-export-save-args/adapt-old.wat +13 -0
  808. data/rust-vendor/wit-component/tests/components/adapt-export-save-args/adapt-old.wit +3 -0
  809. data/rust-vendor/wit-component/tests/components/adapt-export-save-args/component.wat +86 -0
  810. data/rust-vendor/wit-component/tests/components/adapt-export-save-args/component.wit.print +5 -0
  811. data/rust-vendor/wit-component/tests/components/adapt-export-save-args/module.wat +4 -0
  812. data/rust-vendor/wit-component/tests/components/adapt-export-save-args/module.wit +2 -0
  813. data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/adapt-old.wat +33 -0
  814. data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/adapt-old.wit +7 -0
  815. data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/component.wat +101 -0
  816. data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/component.wit.print +5 -0
  817. data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/module.wat +9 -0
  818. data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/module.wit +3 -0
  819. data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/adapt-unused.wat +7 -0
  820. data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/adapt-unused.wit +9 -0
  821. data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/component.wat +115 -0
  822. data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/component.wit.print +9 -0
  823. data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/module.wat +5 -0
  824. data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/module.wit +6 -0
  825. data/rust-vendor/wit-component/tests/components/adapt-inject-stack/adapt-old.wat +54 -0
  826. data/rust-vendor/wit-component/tests/components/adapt-inject-stack/adapt-old.wit +5 -0
  827. data/rust-vendor/wit-component/tests/components/adapt-inject-stack/component.wat +163 -0
  828. data/rust-vendor/wit-component/tests/components/adapt-inject-stack/component.wit.print +7 -0
  829. data/rust-vendor/wit-component/tests/components/adapt-inject-stack/module.wat +4 -0
  830. data/rust-vendor/wit-component/tests/components/adapt-inject-stack/module.wit +2 -0
  831. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/adapt-old.wat +76 -0
  832. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/adapt-old.wit +5 -0
  833. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/component.wat +174 -0
  834. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/component.wit.print +7 -0
  835. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/module.wat +12 -0
  836. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/module.wit +2 -0
  837. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/adapt-old.wat +76 -0
  838. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/adapt-old.wit +5 -0
  839. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/component.wat +199 -0
  840. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/component.wit.print +7 -0
  841. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/module.wat +38 -0
  842. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/module.wit +3 -0
  843. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/adapt-old.wat +68 -0
  844. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/adapt-old.wit +5 -0
  845. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/component.wat +216 -0
  846. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/component.wit.print +7 -0
  847. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/module.wat +38 -0
  848. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/module.wit +3 -0
  849. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/adapt-old.wat +62 -0
  850. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/adapt-old.wit +5 -0
  851. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/component.wat +187 -0
  852. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/component.wit.print +7 -0
  853. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/module.wat +38 -0
  854. data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/module.wit +2 -0
  855. data/rust-vendor/wit-component/tests/components/adapt-list-return/adapt-old.wat +14 -0
  856. data/rust-vendor/wit-component/tests/components/adapt-list-return/adapt-old.wit +5 -0
  857. data/rust-vendor/wit-component/tests/components/adapt-list-return/component.wat +104 -0
  858. data/rust-vendor/wit-component/tests/components/adapt-list-return/component.wit.print +7 -0
  859. data/rust-vendor/wit-component/tests/components/adapt-list-return/module.wat +4 -0
  860. data/rust-vendor/wit-component/tests/components/adapt-list-return/module.wit +3 -0
  861. data/rust-vendor/wit-component/tests/components/adapt-memory-simple/adapt-old.wat +4 -0
  862. data/rust-vendor/wit-component/tests/components/adapt-memory-simple/adapt-old.wit +5 -0
  863. data/rust-vendor/wit-component/tests/components/adapt-memory-simple/component.wat +92 -0
  864. data/rust-vendor/wit-component/tests/components/adapt-memory-simple/component.wit.print +7 -0
  865. data/rust-vendor/wit-component/tests/components/adapt-memory-simple/module.wat +4 -0
  866. data/rust-vendor/wit-component/tests/components/adapt-memory-simple/module.wit +2 -0
  867. data/rust-vendor/wit-component/tests/components/adapt-multiple/adapt-foo.wat +10 -0
  868. data/rust-vendor/wit-component/tests/components/adapt-multiple/adapt-foo.wit +8 -0
  869. data/rust-vendor/wit-component/tests/components/adapt-multiple/component.wat +107 -0
  870. data/rust-vendor/wit-component/tests/components/adapt-multiple/component.wit.print +10 -0
  871. data/rust-vendor/wit-component/tests/components/adapt-multiple/module.wat +4 -0
  872. data/rust-vendor/wit-component/tests/components/adapt-multiple/module.wit +2 -0
  873. data/rust-vendor/wit-component/tests/components/adapt-preview1/adapt-wasi-snapshot-preview1.wat +13 -0
  874. data/rust-vendor/wit-component/tests/components/adapt-preview1/adapt-wasi-snapshot-preview1.wit +12 -0
  875. data/rust-vendor/wit-component/tests/components/adapt-preview1/component.wat +119 -0
  876. data/rust-vendor/wit-component/tests/components/adapt-preview1/component.wit.print +8 -0
  877. data/rust-vendor/wit-component/tests/components/adapt-preview1/module.wat +11 -0
  878. data/rust-vendor/wit-component/tests/components/adapt-preview1/module.wit +7 -0
  879. data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/adapt-wasip2.wat +8 -0
  880. data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/adapt-wasip2.wit +1 -0
  881. data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/component.wat +74 -0
  882. data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/component.wit.print +4 -0
  883. data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/deps/cli/environment.wit +5 -0
  884. data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/module.wat +11 -0
  885. data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/module.wit +5 -0
  886. data/rust-vendor/wit-component/tests/components/adapt-unused/adapt-old.wat +4 -0
  887. data/rust-vendor/wit-component/tests/components/adapt-unused/adapt-old.wit +5 -0
  888. data/rust-vendor/wit-component/tests/components/adapt-unused/component.wat +12 -0
  889. data/rust-vendor/wit-component/tests/components/adapt-unused/component.wit.print +4 -0
  890. data/rust-vendor/wit-component/tests/components/adapt-unused/module.wat +1 -0
  891. data/rust-vendor/wit-component/tests/components/adapt-unused/module.wit +2 -0
  892. data/rust-vendor/wit-component/tests/components/async-builtins/component.wat +259 -0
  893. data/rust-vendor/wit-component/tests/components/async-builtins/component.wit.print +6 -0
  894. data/rust-vendor/wit-component/tests/components/async-builtins/module.wat +28 -0
  895. data/rust-vendor/wit-component/tests/components/async-builtins/module.wit +10 -0
  896. data/rust-vendor/wit-component/tests/components/async-export/component.wat +91 -0
  897. data/rust-vendor/wit-component/tests/components/async-export/component.wit.print +6 -0
  898. data/rust-vendor/wit-component/tests/components/async-export/module.wat +8 -0
  899. data/rust-vendor/wit-component/tests/components/async-export/module.wit +30 -0
  900. data/rust-vendor/wit-component/tests/components/async-export-with-callback/component.wat +59 -0
  901. data/rust-vendor/wit-component/tests/components/async-export-with-callback/component.wit.print +6 -0
  902. data/rust-vendor/wit-component/tests/components/async-export-with-callback/module.wat +8 -0
  903. data/rust-vendor/wit-component/tests/components/async-export-with-callback/module.wit +10 -0
  904. data/rust-vendor/wit-component/tests/components/async-import/component.wat +125 -0
  905. data/rust-vendor/wit-component/tests/components/async-import/component.wit.print +6 -0
  906. data/rust-vendor/wit-component/tests/components/async-import/module.wat +8 -0
  907. data/rust-vendor/wit-component/tests/components/async-import/module.wit +10 -0
  908. data/rust-vendor/wit-component/tests/components/async-import-only-intrinsic/component.wat +34 -0
  909. data/rust-vendor/wit-component/tests/components/async-import-only-intrinsic/component.wit.print +5 -0
  910. data/rust-vendor/wit-component/tests/components/async-import-only-intrinsic/module.wat +4 -0
  911. data/rust-vendor/wit-component/tests/components/async-import-only-intrinsic/module.wit +17 -0
  912. data/rust-vendor/wit-component/tests/components/async-import-tricky/component.wat +39 -0
  913. data/rust-vendor/wit-component/tests/components/async-import-tricky/component.wit.print +5 -0
  914. data/rust-vendor/wit-component/tests/components/async-import-tricky/module.wat +6 -0
  915. data/rust-vendor/wit-component/tests/components/async-import-tricky/module.wit +17 -0
  916. data/rust-vendor/wit-component/tests/components/async-streams-and-futures/component.wat +649 -0
  917. data/rust-vendor/wit-component/tests/components/async-streams-and-futures/component.wit.print +9 -0
  918. data/rust-vendor/wit-component/tests/components/async-streams-and-futures/module.wat +92 -0
  919. data/rust-vendor/wit-component/tests/components/async-streams-and-futures/module.wit +12 -0
  920. data/rust-vendor/wit-component/tests/components/async-unit-builtins/component.wat +138 -0
  921. data/rust-vendor/wit-component/tests/components/async-unit-builtins/component.wit.print +4 -0
  922. data/rust-vendor/wit-component/tests/components/async-unit-builtins/module.wat +18 -0
  923. data/rust-vendor/wit-component/tests/components/async-unit-builtins/module.wit +4 -0
  924. data/rust-vendor/wit-component/tests/components/bare-funcs/component.wat +93 -0
  925. data/rust-vendor/wit-component/tests/components/bare-funcs/component.wit.print +9 -0
  926. data/rust-vendor/wit-component/tests/components/bare-funcs/module.wat +13 -0
  927. data/rust-vendor/wit-component/tests/components/bare-funcs/module.wit +7 -0
  928. data/rust-vendor/wit-component/tests/components/cm32-names/component.wat +366 -0
  929. data/rust-vendor/wit-component/tests/components/cm32-names/component.wit.print +25 -0
  930. data/rust-vendor/wit-component/tests/components/cm32-names/module.wat +32 -0
  931. data/rust-vendor/wit-component/tests/components/cm32-names/module.wit +30 -0
  932. data/rust-vendor/wit-component/tests/components/custom-page-sizes/component.wat +23 -0
  933. data/rust-vendor/wit-component/tests/components/custom-page-sizes/component.wit.print +4 -0
  934. data/rust-vendor/wit-component/tests/components/custom-page-sizes/module.wat +12 -0
  935. data/rust-vendor/wit-component/tests/components/custom-page-sizes/module.wit +3 -0
  936. data/rust-vendor/wit-component/tests/components/deduplicate-imports/adapt-wasi-snapshot-preview1.wat +10 -0
  937. data/rust-vendor/wit-component/tests/components/deduplicate-imports/adapt-wasi-snapshot-preview1.wit +10 -0
  938. data/rust-vendor/wit-component/tests/components/deduplicate-imports/component.wat +132 -0
  939. data/rust-vendor/wit-component/tests/components/deduplicate-imports/component.wit.print +9 -0
  940. data/rust-vendor/wit-component/tests/components/deduplicate-imports/module.wat +40 -0
  941. data/rust-vendor/wit-component/tests/components/deduplicate-imports/module.wit +9 -0
  942. data/rust-vendor/wit-component/tests/components/empty/component.wat +12 -0
  943. data/rust-vendor/wit-component/tests/components/empty/component.wit.print +4 -0
  944. data/rust-vendor/wit-component/tests/components/empty/module.wat +1 -0
  945. data/rust-vendor/wit-component/tests/components/empty/module.wit +2 -0
  946. data/rust-vendor/wit-component/tests/components/ensure-default-type-exports/component.wat +50 -0
  947. data/rust-vendor/wit-component/tests/components/ensure-default-type-exports/component.wit.print +7 -0
  948. data/rust-vendor/wit-component/tests/components/ensure-default-type-exports/module.wat +6 -0
  949. data/rust-vendor/wit-component/tests/components/ensure-default-type-exports/module.wit +17 -0
  950. data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/adapt-old.wat +4 -0
  951. data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/adapt-old.wit +5 -0
  952. data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/error.txt +1 -0
  953. data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/module.wat +3 -0
  954. data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/module.wit +2 -0
  955. data/rust-vendor/wit-component/tests/components/error-async-export-missing-callback/error.txt +1 -0
  956. data/rust-vendor/wit-component/tests/components/error-async-export-missing-callback/module.wat +6 -0
  957. data/rust-vendor/wit-component/tests/components/error-async-export-missing-callback/module.wit +10 -0
  958. data/rust-vendor/wit-component/tests/components/error-default-export-sig-mismatch/error.txt +1 -0
  959. data/rust-vendor/wit-component/tests/components/error-default-export-sig-mismatch/module.wat +3 -0
  960. data/rust-vendor/wit-component/tests/components/error-default-export-sig-mismatch/module.wit +5 -0
  961. data/rust-vendor/wit-component/tests/components/error-empty-module-import/error.txt +1 -0
  962. data/rust-vendor/wit-component/tests/components/error-empty-module-import/module.wat +3 -0
  963. data/rust-vendor/wit-component/tests/components/error-empty-module-import/module.wit +2 -0
  964. data/rust-vendor/wit-component/tests/components/error-export-sig-mismatch/error.txt +1 -0
  965. data/rust-vendor/wit-component/tests/components/error-export-sig-mismatch/module.wat +3 -0
  966. data/rust-vendor/wit-component/tests/components/error-export-sig-mismatch/module.wit +7 -0
  967. data/rust-vendor/wit-component/tests/components/error-import-resource-rep/error.txt +1 -0
  968. data/rust-vendor/wit-component/tests/components/error-import-resource-rep/module.wat +3 -0
  969. data/rust-vendor/wit-component/tests/components/error-import-resource-rep/module.wit +5 -0
  970. data/rust-vendor/wit-component/tests/components/error-import-resource-wrong-signature/error.txt +1 -0
  971. data/rust-vendor/wit-component/tests/components/error-import-resource-wrong-signature/module.wat +3 -0
  972. data/rust-vendor/wit-component/tests/components/error-import-resource-wrong-signature/module.wit +5 -0
  973. data/rust-vendor/wit-component/tests/components/error-import-sig-mismatch/error.txt +1 -0
  974. data/rust-vendor/wit-component/tests/components/error-import-sig-mismatch/module.wat +3 -0
  975. data/rust-vendor/wit-component/tests/components/error-import-sig-mismatch/module.wit +7 -0
  976. data/rust-vendor/wit-component/tests/components/error-invalid-module-import/error.txt +1 -0
  977. data/rust-vendor/wit-component/tests/components/error-invalid-module-import/module.wat +3 -0
  978. data/rust-vendor/wit-component/tests/components/error-invalid-module-import/module.wit +2 -0
  979. data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/error.txt +1 -0
  980. data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/lib-bar.wat +12 -0
  981. data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/lib-bar.wit +3 -0
  982. data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/lib-foo.wat +21 -0
  983. data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/lib-foo.wit +10 -0
  984. data/rust-vendor/wit-component/tests/components/error-link-missing-needed/error.txt +2 -0
  985. data/rust-vendor/wit-component/tests/components/error-link-missing-needed/lib-foo.wat +15 -0
  986. data/rust-vendor/wit-component/tests/components/error-link-missing-needed/lib-foo.wit +10 -0
  987. data/rust-vendor/wit-component/tests/components/error-link-missing-symbols/error.txt +3 -0
  988. data/rust-vendor/wit-component/tests/components/error-link-missing-symbols/lib-foo.wat +13 -0
  989. data/rust-vendor/wit-component/tests/components/error-link-missing-symbols/lib-foo.wit +10 -0
  990. data/rust-vendor/wit-component/tests/components/error-missing-default-export/error.txt +1 -0
  991. data/rust-vendor/wit-component/tests/components/error-missing-default-export/module.wat +1 -0
  992. data/rust-vendor/wit-component/tests/components/error-missing-default-export/module.wit +4 -0
  993. data/rust-vendor/wit-component/tests/components/error-missing-export/error.txt +1 -0
  994. data/rust-vendor/wit-component/tests/components/error-missing-export/module.wat +1 -0
  995. data/rust-vendor/wit-component/tests/components/error-missing-export/module.wit +7 -0
  996. data/rust-vendor/wit-component/tests/components/error-missing-import/error.txt +1 -0
  997. data/rust-vendor/wit-component/tests/components/error-missing-import/module.wat +3 -0
  998. data/rust-vendor/wit-component/tests/components/error-missing-import/module.wit +2 -0
  999. data/rust-vendor/wit-component/tests/components/error-missing-import-func/error.txt +1 -0
  1000. data/rust-vendor/wit-component/tests/components/error-missing-import-func/module.wat +3 -0
  1001. data/rust-vendor/wit-component/tests/components/error-missing-import-func/module.wit +9 -0
  1002. data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/adapt-old.wat +4 -0
  1003. data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/adapt-old.wit +5 -0
  1004. data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/error.txt +1 -0
  1005. data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/module.wat +4 -0
  1006. data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/module.wit +4 -0
  1007. data/rust-vendor/wit-component/tests/components/export-interface-using-import/component.wat +37 -0
  1008. data/rust-vendor/wit-component/tests/components/export-interface-using-import/component.wit.print +9 -0
  1009. data/rust-vendor/wit-component/tests/components/export-interface-using-import/module.wat +1 -0
  1010. data/rust-vendor/wit-component/tests/components/export-interface-using-import/module.wit +17 -0
  1011. data/rust-vendor/wit-component/tests/components/export-name-shuffling/component.wat +43 -0
  1012. data/rust-vendor/wit-component/tests/components/export-name-shuffling/component.wit.print +10 -0
  1013. data/rust-vendor/wit-component/tests/components/export-name-shuffling/module.wat +3 -0
  1014. data/rust-vendor/wit-component/tests/components/export-name-shuffling/module.wit +17 -0
  1015. data/rust-vendor/wit-component/tests/components/export-resource/component.wat +102 -0
  1016. data/rust-vendor/wit-component/tests/components/export-resource/component.wit.print +10 -0
  1017. data/rust-vendor/wit-component/tests/components/export-resource/module.wat +15 -0
  1018. data/rust-vendor/wit-component/tests/components/export-resource/module.wit +11 -0
  1019. data/rust-vendor/wit-component/tests/components/export-type-name-conflict/component.wat +46 -0
  1020. data/rust-vendor/wit-component/tests/components/export-type-name-conflict/component.wit.print +11 -0
  1021. data/rust-vendor/wit-component/tests/components/export-type-name-conflict/module.wat +5 -0
  1022. data/rust-vendor/wit-component/tests/components/export-type-name-conflict/module.wit +15 -0
  1023. data/rust-vendor/wit-component/tests/components/export-with-type-alias/component.wat +40 -0
  1024. data/rust-vendor/wit-component/tests/components/export-with-type-alias/component.wit.print +5 -0
  1025. data/rust-vendor/wit-component/tests/components/export-with-type-alias/module.wat +3 -0
  1026. data/rust-vendor/wit-component/tests/components/export-with-type-alias/module.wit +11 -0
  1027. data/rust-vendor/wit-component/tests/components/exports/component.wat +139 -0
  1028. data/rust-vendor/wit-component/tests/components/exports/component.wit.print +29 -0
  1029. data/rust-vendor/wit-component/tests/components/exports/module.wat +14 -0
  1030. data/rust-vendor/wit-component/tests/components/exports/module.wit +29 -0
  1031. data/rust-vendor/wit-component/tests/components/fallible-constructor/component.wat +73 -0
  1032. data/rust-vendor/wit-component/tests/components/fallible-constructor/component.wit.print +9 -0
  1033. data/rust-vendor/wit-component/tests/components/fallible-constructor/module.wat +5 -0
  1034. data/rust-vendor/wit-component/tests/components/fallible-constructor/module.wit +9 -0
  1035. data/rust-vendor/wit-component/tests/components/import-and-export-resource/component.wat +53 -0
  1036. data/rust-vendor/wit-component/tests/components/import-and-export-resource/component.wit.print +8 -0
  1037. data/rust-vendor/wit-component/tests/components/import-and-export-resource/module.wat +6 -0
  1038. data/rust-vendor/wit-component/tests/components/import-and-export-resource/module.wit +12 -0
  1039. data/rust-vendor/wit-component/tests/components/import-conflict/component.wat +118 -0
  1040. data/rust-vendor/wit-component/tests/components/import-conflict/component.wit.print +7 -0
  1041. data/rust-vendor/wit-component/tests/components/import-conflict/module.wat +7 -0
  1042. data/rust-vendor/wit-component/tests/components/import-conflict/module.wit +19 -0
  1043. data/rust-vendor/wit-component/tests/components/import-empty-interface/component.wat +12 -0
  1044. data/rust-vendor/wit-component/tests/components/import-empty-interface/component.wit.print +4 -0
  1045. data/rust-vendor/wit-component/tests/components/import-empty-interface/module.wat +1 -0
  1046. data/rust-vendor/wit-component/tests/components/import-empty-interface/module.wit +5 -0
  1047. data/rust-vendor/wit-component/tests/components/import-export/component.wat +124 -0
  1048. data/rust-vendor/wit-component/tests/components/import-export/component.wit.print +14 -0
  1049. data/rust-vendor/wit-component/tests/components/import-export/module.wat +10 -0
  1050. data/rust-vendor/wit-component/tests/components/import-export/module.wit +14 -0
  1051. data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/component.wat +59 -0
  1052. data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/component.wit.print +8 -0
  1053. data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/deps/dep/foo.wit +5 -0
  1054. data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/module.wat +5 -0
  1055. data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/module.wit +11 -0
  1056. data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/adapt-old.wat +23 -0
  1057. data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/adapt-old.wit +9 -0
  1058. data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/component.wat +220 -0
  1059. data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/component.wit.print +16 -0
  1060. data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/deps/shared-dependency/doc.wit +13 -0
  1061. data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/deps/shared-dependency/types.wit +3 -0
  1062. data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/module.wat +15 -0
  1063. data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/module.wit +11 -0
  1064. data/rust-vendor/wit-component/tests/components/import-only-resource-static-function/component.wat +30 -0
  1065. data/rust-vendor/wit-component/tests/components/import-only-resource-static-function/component.wit.print +5 -0
  1066. data/rust-vendor/wit-component/tests/components/import-only-resource-static-function/module.wat +3 -0
  1067. data/rust-vendor/wit-component/tests/components/import-only-resource-static-function/module.wit +11 -0
  1068. data/rust-vendor/wit-component/tests/components/import-partial-export-full/component.wat +34 -0
  1069. data/rust-vendor/wit-component/tests/components/import-partial-export-full/component.wit.print +8 -0
  1070. data/rust-vendor/wit-component/tests/components/import-partial-export-full/module.wat +1 -0
  1071. data/rust-vendor/wit-component/tests/components/import-partial-export-full/module.wit +19 -0
  1072. data/rust-vendor/wit-component/tests/components/import-resource-in-interface/component.wat +41 -0
  1073. data/rust-vendor/wit-component/tests/components/import-resource-in-interface/component.wit.print +10 -0
  1074. data/rust-vendor/wit-component/tests/components/import-resource-in-interface/module.wat +5 -0
  1075. data/rust-vendor/wit-component/tests/components/import-resource-in-interface/module.wit +11 -0
  1076. data/rust-vendor/wit-component/tests/components/import-resource-simple/component.wat +33 -0
  1077. data/rust-vendor/wit-component/tests/components/import-resource-simple/component.wit.print +8 -0
  1078. data/rust-vendor/wit-component/tests/components/import-resource-simple/module.wat +5 -0
  1079. data/rust-vendor/wit-component/tests/components/import-resource-simple/module.wit +9 -0
  1080. data/rust-vendor/wit-component/tests/components/imports/component.wat +149 -0
  1081. data/rust-vendor/wit-component/tests/components/imports/component.wit.print +29 -0
  1082. data/rust-vendor/wit-component/tests/components/imports/module.wat +12 -0
  1083. data/rust-vendor/wit-component/tests/components/imports/module.wit +33 -0
  1084. data/rust-vendor/wit-component/tests/components/initialize/component.wat +38 -0
  1085. data/rust-vendor/wit-component/tests/components/initialize/component.wit.print +5 -0
  1086. data/rust-vendor/wit-component/tests/components/initialize/module.wat +6 -0
  1087. data/rust-vendor/wit-component/tests/components/initialize/module.wit +5 -0
  1088. data/rust-vendor/wit-component/tests/components/lift-options/component.wat +286 -0
  1089. data/rust-vendor/wit-component/tests/components/lift-options/component.wit.print +5 -0
  1090. data/rust-vendor/wit-component/tests/components/lift-options/module.wat +24 -0
  1091. data/rust-vendor/wit-component/tests/components/lift-options/module.wit +40 -0
  1092. data/rust-vendor/wit-component/tests/components/link/component.wat +271 -0
  1093. data/rust-vendor/wit-component/tests/components/link/component.wit.print +7 -0
  1094. data/rust-vendor/wit-component/tests/components/link/lib-bar.wat +29 -0
  1095. data/rust-vendor/wit-component/tests/components/link/lib-bar.wit +10 -0
  1096. data/rust-vendor/wit-component/tests/components/link/lib-c.wat +27 -0
  1097. data/rust-vendor/wit-component/tests/components/link/lib-c.wit +3 -0
  1098. data/rust-vendor/wit-component/tests/components/link/lib-foo.wat +55 -0
  1099. data/rust-vendor/wit-component/tests/components/link/lib-foo.wit +3 -0
  1100. data/rust-vendor/wit-component/tests/components/link/lib-unused.wat +55 -0
  1101. data/rust-vendor/wit-component/tests/components/link/lib-unused.wit +3 -0
  1102. data/rust-vendor/wit-component/tests/components/link-asyncify/component.wat +267 -0
  1103. data/rust-vendor/wit-component/tests/components/link-asyncify/component.wit.print +5 -0
  1104. data/rust-vendor/wit-component/tests/components/link-asyncify/lib-bar.wat +81 -0
  1105. data/rust-vendor/wit-component/tests/components/link-asyncify/lib-bar.wit +9 -0
  1106. data/rust-vendor/wit-component/tests/components/link-asyncify/lib-foo.wat +78 -0
  1107. data/rust-vendor/wit-component/tests/components/link-asyncify/lib-foo.wit +3 -0
  1108. data/rust-vendor/wit-component/tests/components/link-bare-funcs/component.wat +212 -0
  1109. data/rust-vendor/wit-component/tests/components/link-bare-funcs/component.wit.print +9 -0
  1110. data/rust-vendor/wit-component/tests/components/link-bare-funcs/lib-c.wat +27 -0
  1111. data/rust-vendor/wit-component/tests/components/link-bare-funcs/lib-c.wit +3 -0
  1112. data/rust-vendor/wit-component/tests/components/link-bare-funcs/lib-foo.wat +18 -0
  1113. data/rust-vendor/wit-component/tests/components/link-bare-funcs/lib-foo.wit +7 -0
  1114. data/rust-vendor/wit-component/tests/components/link-circular/component.wat +133 -0
  1115. data/rust-vendor/wit-component/tests/components/link-circular/component.wit.print +7 -0
  1116. data/rust-vendor/wit-component/tests/components/link-circular/lib-bar.wat +12 -0
  1117. data/rust-vendor/wit-component/tests/components/link-circular/lib-bar.wit +3 -0
  1118. data/rust-vendor/wit-component/tests/components/link-circular/lib-foo.wat +15 -0
  1119. data/rust-vendor/wit-component/tests/components/link-circular/lib-foo.wit +10 -0
  1120. data/rust-vendor/wit-component/tests/components/link-dl-openable/component.wat +108 -0
  1121. data/rust-vendor/wit-component/tests/components/link-dl-openable/component.wit.print +7 -0
  1122. data/rust-vendor/wit-component/tests/components/link-dl-openable/dlopen-lib-foo.wat +15 -0
  1123. data/rust-vendor/wit-component/tests/components/link-dl-openable/dlopen-lib-foo.wit +10 -0
  1124. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/component.wat +657 -0
  1125. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/component.wit.print +7 -0
  1126. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/dlopen-lib-foo.wat +17 -0
  1127. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/dlopen-lib-foo.wit +10 -0
  1128. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/lib-c.wat +30 -0
  1129. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/lib-c.wit +3 -0
  1130. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/stub-missing-functions +0 -0
  1131. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/use-built-in-libdl +0 -0
  1132. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/component.wat +654 -0
  1133. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/component.wit.print +7 -0
  1134. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/dlopen-lib-foo.wat +19 -0
  1135. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/dlopen-lib-foo.wit +10 -0
  1136. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/lib-c.wat +39 -0
  1137. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/lib-c.wit +3 -0
  1138. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/lib-unused.wat +55 -0
  1139. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/lib-unused.wit +3 -0
  1140. data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/use-built-in-libdl +0 -0
  1141. data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/component.wat +135 -0
  1142. data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/component.wit.print +7 -0
  1143. data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/lib-bar.wat +13 -0
  1144. data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/lib-bar.wit +3 -0
  1145. data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/lib-foo.wat +15 -0
  1146. data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/lib-foo.wit +10 -0
  1147. data/rust-vendor/wit-component/tests/components/link-got-func/component.wat +125 -0
  1148. data/rust-vendor/wit-component/tests/components/link-got-func/component.wit.print +7 -0
  1149. data/rust-vendor/wit-component/tests/components/link-got-func/lib-bar.wat +10 -0
  1150. data/rust-vendor/wit-component/tests/components/link-got-func/lib-bar.wit +3 -0
  1151. data/rust-vendor/wit-component/tests/components/link-got-func/lib-foo.wat +10 -0
  1152. data/rust-vendor/wit-component/tests/components/link-got-func/lib-foo.wit +10 -0
  1153. data/rust-vendor/wit-component/tests/components/link-initialize/component.wat +271 -0
  1154. data/rust-vendor/wit-component/tests/components/link-initialize/component.wit.print +7 -0
  1155. data/rust-vendor/wit-component/tests/components/link-initialize/lib-bar.wat +29 -0
  1156. data/rust-vendor/wit-component/tests/components/link-initialize/lib-bar.wit +10 -0
  1157. data/rust-vendor/wit-component/tests/components/link-initialize/lib-c.wat +27 -0
  1158. data/rust-vendor/wit-component/tests/components/link-initialize/lib-c.wit +3 -0
  1159. data/rust-vendor/wit-component/tests/components/link-initialize/lib-foo.wat +55 -0
  1160. data/rust-vendor/wit-component/tests/components/link-initialize/lib-foo.wit +3 -0
  1161. data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/component.wat +148 -0
  1162. data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/component.wit.print +19 -0
  1163. data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/lib-c.wat +4 -0
  1164. data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/lib-c.wit +3 -0
  1165. data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/lib-foo.wat +12 -0
  1166. data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/lib-foo.wit +16 -0
  1167. data/rust-vendor/wit-component/tests/components/link-resources/component.wat +150 -0
  1168. data/rust-vendor/wit-component/tests/components/link-resources/component.wit.print +6 -0
  1169. data/rust-vendor/wit-component/tests/components/link-resources/lib-bar.wat +15 -0
  1170. data/rust-vendor/wit-component/tests/components/link-resources/lib-bar.wit +13 -0
  1171. data/rust-vendor/wit-component/tests/components/link-resources/lib-foo.wat +17 -0
  1172. data/rust-vendor/wit-component/tests/components/link-resources/lib-foo.wit +13 -0
  1173. data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/component.wat +146 -0
  1174. data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/component.wit.print +5 -0
  1175. data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/lib-bar.wat +19 -0
  1176. data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/lib-bar.wit +9 -0
  1177. data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/lib-foo.wat +17 -0
  1178. data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/lib-foo.wit +3 -0
  1179. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/adapt-wasip2.wat +8 -0
  1180. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/adapt-wasip2.wit +1 -0
  1181. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/component.wat +330 -0
  1182. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/component.wit.print +7 -0
  1183. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/deps/cli/environment.wit +5 -0
  1184. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-bar.wat +29 -0
  1185. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-bar.wit +10 -0
  1186. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-c.wat +29 -0
  1187. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-c.wit +5 -0
  1188. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-foo.wat +55 -0
  1189. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-foo.wit +3 -0
  1190. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-unused.wat +55 -0
  1191. data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-unused.wit +3 -0
  1192. data/rust-vendor/wit-component/tests/components/link-stubs/component.wat +118 -0
  1193. data/rust-vendor/wit-component/tests/components/link-stubs/component.wit.print +7 -0
  1194. data/rust-vendor/wit-component/tests/components/link-stubs/lib-foo.wat +13 -0
  1195. data/rust-vendor/wit-component/tests/components/link-stubs/lib-foo.wit +10 -0
  1196. data/rust-vendor/wit-component/tests/components/link-stubs/stub-missing-functions +0 -0
  1197. data/rust-vendor/wit-component/tests/components/link-tag/component.wat +123 -0
  1198. data/rust-vendor/wit-component/tests/components/link-tag/component.wit.print +5 -0
  1199. data/rust-vendor/wit-component/tests/components/link-tag/lib-bar.wat +6 -0
  1200. data/rust-vendor/wit-component/tests/components/link-tag/lib-bar.wit +3 -0
  1201. data/rust-vendor/wit-component/tests/components/link-tag/lib-foo.wat +7 -0
  1202. data/rust-vendor/wit-component/tests/components/link-tag/lib-foo.wit +5 -0
  1203. data/rust-vendor/wit-component/tests/components/link-weak-cabi-realloc/component.wat +99 -0
  1204. data/rust-vendor/wit-component/tests/components/link-weak-cabi-realloc/component.wit.print +5 -0
  1205. data/rust-vendor/wit-component/tests/components/link-weak-cabi-realloc/lib-foo.wat +14 -0
  1206. data/rust-vendor/wit-component/tests/components/link-weak-cabi-realloc/lib-foo.wit +9 -0
  1207. data/rust-vendor/wit-component/tests/components/link-weak-import/component.wat +120 -0
  1208. data/rust-vendor/wit-component/tests/components/link-weak-import/component.wit.print +7 -0
  1209. data/rust-vendor/wit-component/tests/components/link-weak-import/lib-foo.wat +15 -0
  1210. data/rust-vendor/wit-component/tests/components/link-weak-import/lib-foo.wit +10 -0
  1211. data/rust-vendor/wit-component/tests/components/live-exports-dead-imports/component.wat +38 -0
  1212. data/rust-vendor/wit-component/tests/components/live-exports-dead-imports/component.wit.print +5 -0
  1213. data/rust-vendor/wit-component/tests/components/live-exports-dead-imports/module.wat +4 -0
  1214. data/rust-vendor/wit-component/tests/components/live-exports-dead-imports/module.wit +12 -0
  1215. data/rust-vendor/wit-component/tests/components/lower-options/component.wat +281 -0
  1216. data/rust-vendor/wit-component/tests/components/lower-options/component.wit.print +5 -0
  1217. data/rust-vendor/wit-component/tests/components/lower-options/module.wat +20 -0
  1218. data/rust-vendor/wit-component/tests/components/lower-options/module.wit +40 -0
  1219. data/rust-vendor/wit-component/tests/components/many-same-names/component.wat +48 -0
  1220. data/rust-vendor/wit-component/tests/components/many-same-names/component.wit.print +10 -0
  1221. data/rust-vendor/wit-component/tests/components/many-same-names/module.wat +3 -0
  1222. data/rust-vendor/wit-component/tests/components/many-same-names/module.wit +21 -0
  1223. data/rust-vendor/wit-component/tests/components/merge-import-versions/component.wat +125 -0
  1224. data/rust-vendor/wit-component/tests/components/merge-import-versions/component.wit.print +5 -0
  1225. data/rust-vendor/wit-component/tests/components/merge-import-versions/module.wat +15 -0
  1226. data/rust-vendor/wit-component/tests/components/merge-import-versions/module.wit +30 -0
  1227. data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/adapt-old.wat +10 -0
  1228. data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/adapt-old.wit +19 -0
  1229. data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/component.wat +104 -0
  1230. data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/component.wit.print +5 -0
  1231. data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/module.wat +9 -0
  1232. data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/module.wit +14 -0
  1233. data/rust-vendor/wit-component/tests/components/multi-package/baz/qux/component.wat +90 -0
  1234. data/rust-vendor/wit-component/tests/components/multi-package/baz/qux/component.wit.print +13 -0
  1235. data/rust-vendor/wit-component/tests/components/multi-package/baz/qux/module.wat +7 -0
  1236. data/rust-vendor/wit-component/tests/components/multi-package/component.wat +44 -0
  1237. data/rust-vendor/wit-component/tests/components/multi-package/component.wit.print +4 -0
  1238. data/rust-vendor/wit-component/tests/components/multi-package/foo/bar/component.wat +82 -0
  1239. data/rust-vendor/wit-component/tests/components/multi-package/foo/bar/component.wit.print +13 -0
  1240. data/rust-vendor/wit-component/tests/components/multi-package/foo/bar/module.wat +6 -0
  1241. data/rust-vendor/wit-component/tests/components/multi-package/module.wit +25 -0
  1242. data/rust-vendor/wit-component/tests/components/no-realloc-required/component.wat +67 -0
  1243. data/rust-vendor/wit-component/tests/components/no-realloc-required/component.wit.print +7 -0
  1244. data/rust-vendor/wit-component/tests/components/no-realloc-required/module.wat +4 -0
  1245. data/rust-vendor/wit-component/tests/components/no-realloc-required/module.wit +7 -0
  1246. data/rust-vendor/wit-component/tests/components/post-return/component.wat +36 -0
  1247. data/rust-vendor/wit-component/tests/components/post-return/component.wit.print +5 -0
  1248. data/rust-vendor/wit-component/tests/components/post-return/module.wat +6 -0
  1249. data/rust-vendor/wit-component/tests/components/post-return/module.wit +5 -0
  1250. data/rust-vendor/wit-component/tests/components/rename-import-interface/component.wat +29 -0
  1251. data/rust-vendor/wit-component/tests/components/rename-import-interface/component.wit.print +5 -0
  1252. data/rust-vendor/wit-component/tests/components/rename-import-interface/module.wat +3 -0
  1253. data/rust-vendor/wit-component/tests/components/rename-import-interface/module.wit +9 -0
  1254. data/rust-vendor/wit-component/tests/components/rename-interface/component.wat +39 -0
  1255. data/rust-vendor/wit-component/tests/components/rename-interface/component.wit.print +10 -0
  1256. data/rust-vendor/wit-component/tests/components/rename-interface/module.wat +3 -0
  1257. data/rust-vendor/wit-component/tests/components/rename-interface/module.wit +18 -0
  1258. data/rust-vendor/wit-component/tests/components/resource-intrinsics-with-just-import/component.wat +28 -0
  1259. data/rust-vendor/wit-component/tests/components/resource-intrinsics-with-just-import/component.wit.print +7 -0
  1260. data/rust-vendor/wit-component/tests/components/resource-intrinsics-with-just-import/module.wat +3 -0
  1261. data/rust-vendor/wit-component/tests/components/resource-intrinsics-with-just-import/module.wit +7 -0
  1262. data/rust-vendor/wit-component/tests/components/resource-used-through-import/component.wat +57 -0
  1263. data/rust-vendor/wit-component/tests/components/resource-used-through-import/component.wit.print +11 -0
  1264. data/rust-vendor/wit-component/tests/components/resource-used-through-import/module.wat +6 -0
  1265. data/rust-vendor/wit-component/tests/components/resource-used-through-import/module.wit +13 -0
  1266. data/rust-vendor/wit-component/tests/components/resource-using-export/component.wat +64 -0
  1267. data/rust-vendor/wit-component/tests/components/resource-using-export/component.wit.print +10 -0
  1268. data/rust-vendor/wit-component/tests/components/resource-using-export/module.wat +6 -0
  1269. data/rust-vendor/wit-component/tests/components/resource-using-export/module.wit +16 -0
  1270. data/rust-vendor/wit-component/tests/components/simple/component.wat +64 -0
  1271. data/rust-vendor/wit-component/tests/components/simple/component.wit.print +7 -0
  1272. data/rust-vendor/wit-component/tests/components/simple/module.wat +10 -0
  1273. data/rust-vendor/wit-component/tests/components/simple/module.wit +7 -0
  1274. data/rust-vendor/wit-component/tests/components/threading/component.wat +163 -0
  1275. data/rust-vendor/wit-component/tests/components/threading/component.wit.print +6 -0
  1276. data/rust-vendor/wit-component/tests/components/threading/module.wat +22 -0
  1277. data/rust-vendor/wit-component/tests/components/threading/module.wit +10 -0
  1278. data/rust-vendor/wit-component/tests/components/tricky-order/component.wat +44 -0
  1279. data/rust-vendor/wit-component/tests/components/tricky-order/component.wit.print +11 -0
  1280. data/rust-vendor/wit-component/tests/components/tricky-order/module.wat +1 -0
  1281. data/rust-vendor/wit-component/tests/components/tricky-order/module.wit +20 -0
  1282. data/rust-vendor/wit-component/tests/components/tricky-resources/component.wat +75 -0
  1283. data/rust-vendor/wit-component/tests/components/tricky-resources/component.wit.print +11 -0
  1284. data/rust-vendor/wit-component/tests/components/tricky-resources/module.wat +7 -0
  1285. data/rust-vendor/wit-component/tests/components/tricky-resources/module.wit +19 -0
  1286. data/rust-vendor/wit-component/tests/components/tricky-resources2/component.wat +50 -0
  1287. data/rust-vendor/wit-component/tests/components/tricky-resources2/component.wit.print +10 -0
  1288. data/rust-vendor/wit-component/tests/components/tricky-resources2/module.wat +4 -0
  1289. data/rust-vendor/wit-component/tests/components/tricky-resources2/module.wit +14 -0
  1290. data/rust-vendor/wit-component/tests/components/tricky-resources3/component.wat +44 -0
  1291. data/rust-vendor/wit-component/tests/components/tricky-resources3/component.wit.print +9 -0
  1292. data/rust-vendor/wit-component/tests/components/tricky-resources3/module.wat +1 -0
  1293. data/rust-vendor/wit-component/tests/components/tricky-resources3/module.wit +17 -0
  1294. data/rust-vendor/wit-component/tests/components/tricky-resources4/component.wat +64 -0
  1295. data/rust-vendor/wit-component/tests/components/tricky-resources4/component.wit.print +8 -0
  1296. data/rust-vendor/wit-component/tests/components/tricky-resources4/module.wat +6 -0
  1297. data/rust-vendor/wit-component/tests/components/tricky-resources4/module.wit +16 -0
  1298. data/rust-vendor/wit-component/tests/components/unused-import/component.wat +29 -0
  1299. data/rust-vendor/wit-component/tests/components/unused-import/component.wit.print +5 -0
  1300. data/rust-vendor/wit-component/tests/components/unused-import/module.wat +3 -0
  1301. data/rust-vendor/wit-component/tests/components/unused-import/module.wit +12 -0
  1302. data/rust-vendor/wit-component/tests/components/worlds-with-type-renamings/component.wat +67 -0
  1303. data/rust-vendor/wit-component/tests/components/worlds-with-type-renamings/component.wit.print +8 -0
  1304. data/rust-vendor/wit-component/tests/components/worlds-with-type-renamings/module.wat +12 -0
  1305. data/rust-vendor/wit-component/tests/components/worlds-with-type-renamings/module.wit +17 -0
  1306. data/rust-vendor/wit-component/tests/components/worlds-with-types/component.wat +25 -0
  1307. data/rust-vendor/wit-component/tests/components/worlds-with-types/component.wit.print +11 -0
  1308. data/rust-vendor/wit-component/tests/components/worlds-with-types/module.wat +3 -0
  1309. data/rust-vendor/wit-component/tests/components/worlds-with-types/module.wit +10 -0
  1310. data/rust-vendor/wit-component/tests/components.rs +291 -0
  1311. data/rust-vendor/wit-component/tests/interfaces/console.wat +18 -0
  1312. data/rust-vendor/wit-component/tests/interfaces/console.wit +5 -0
  1313. data/rust-vendor/wit-component/tests/interfaces/console.wit.print +6 -0
  1314. data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate/foo.wit.print +20 -0
  1315. data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate/join.wit +10 -0
  1316. data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate/shared1.wit +3 -0
  1317. data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate/shared2.wit +3 -0
  1318. data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate.wat +70 -0
  1319. data/rust-vendor/wit-component/tests/interfaces/diamond.wat +107 -0
  1320. data/rust-vendor/wit-component/tests/interfaces/diamond.wit +31 -0
  1321. data/rust-vendor/wit-component/tests/interfaces/diamond.wit.print +34 -0
  1322. data/rust-vendor/wit-component/tests/interfaces/doc-comments/foo.wit +79 -0
  1323. data/rust-vendor/wit-component/tests/interfaces/doc-comments/foo.wit.print +78 -0
  1324. data/rust-vendor/wit-component/tests/interfaces/doc-comments.wat +73 -0
  1325. data/rust-vendor/wit-component/tests/interfaces/empty.wat +50 -0
  1326. data/rust-vendor/wit-component/tests/interfaces/empty.wit +12 -0
  1327. data/rust-vendor/wit-component/tests/interfaces/empty.wit.print +16 -0
  1328. data/rust-vendor/wit-component/tests/interfaces/export-other-packages-interface/deps/the-dep/the-doc.wit +9 -0
  1329. data/rust-vendor/wit-component/tests/interfaces/export-other-packages-interface/foo.wit +5 -0
  1330. data/rust-vendor/wit-component/tests/interfaces/export-other-packages-interface/foo.wit.print +5 -0
  1331. data/rust-vendor/wit-component/tests/interfaces/export-other-packages-interface.wat +23 -0
  1332. data/rust-vendor/wit-component/tests/interfaces/exports.wat +39 -0
  1333. data/rust-vendor/wit-component/tests/interfaces/exports.wit +13 -0
  1334. data/rust-vendor/wit-component/tests/interfaces/exports.wit.print +13 -0
  1335. data/rust-vendor/wit-component/tests/interfaces/flags.wat +79 -0
  1336. data/rust-vendor/wit-component/tests/interfaces/flags.wit +100 -0
  1337. data/rust-vendor/wit-component/tests/interfaces/flags.wit.print +100 -0
  1338. data/rust-vendor/wit-component/tests/interfaces/floats.wat +47 -0
  1339. data/rust-vendor/wit-component/tests/interfaces/floats.wit +12 -0
  1340. data/rust-vendor/wit-component/tests/interfaces/floats.wit.print +15 -0
  1341. data/rust-vendor/wit-component/tests/interfaces/foreign-use-chain/deps/bar/bar.wit +9 -0
  1342. data/rust-vendor/wit-component/tests/interfaces/foreign-use-chain/foo.wit +5 -0
  1343. data/rust-vendor/wit-component/tests/interfaces/foreign-use-chain/foo.wit.print +6 -0
  1344. data/rust-vendor/wit-component/tests/interfaces/foreign-use-chain.wat +31 -0
  1345. data/rust-vendor/wit-component/tests/interfaces/import-and-export.wat +54 -0
  1346. data/rust-vendor/wit-component/tests/interfaces/import-and-export.wit +14 -0
  1347. data/rust-vendor/wit-component/tests/interfaces/import-and-export.wit.print +15 -0
  1348. data/rust-vendor/wit-component/tests/interfaces/integers.wat +107 -0
  1349. data/rust-vendor/wit-component/tests/interfaces/integers.wit +27 -0
  1350. data/rust-vendor/wit-component/tests/interfaces/integers.wit.print +45 -0
  1351. data/rust-vendor/wit-component/tests/interfaces/lists.wat +211 -0
  1352. data/rust-vendor/wit-component/tests/interfaces/lists.wit +96 -0
  1353. data/rust-vendor/wit-component/tests/interfaces/lists.wit.print +96 -0
  1354. data/rust-vendor/wit-component/tests/interfaces/maps.wat +186 -0
  1355. data/rust-vendor/wit-component/tests/interfaces/maps.wit +38 -0
  1356. data/rust-vendor/wit-component/tests/interfaces/maps.wit.print +57 -0
  1357. data/rust-vendor/wit-component/tests/interfaces/multi-doc/a.wit +9 -0
  1358. data/rust-vendor/wit-component/tests/interfaces/multi-doc/b.wit +9 -0
  1359. data/rust-vendor/wit-component/tests/interfaces/multi-doc/foo.wit.print +20 -0
  1360. data/rust-vendor/wit-component/tests/interfaces/multi-doc.wat +78 -0
  1361. data/rust-vendor/wit-component/tests/interfaces/multiple-use.wat +67 -0
  1362. data/rust-vendor/wit-component/tests/interfaces/multiple-use.wit +16 -0
  1363. data/rust-vendor/wit-component/tests/interfaces/multiple-use.wit.print +18 -0
  1364. data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain/chain.wit.print +18 -0
  1365. data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain/def.wit +13 -0
  1366. data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain/the-use.wit +5 -0
  1367. data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain.wat +70 -0
  1368. data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain2/bar.wit +13 -0
  1369. data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain2/foo.wit +5 -0
  1370. data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain2/foo.wit.print +20 -0
  1371. data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain2.wat +70 -0
  1372. data/rust-vendor/wit-component/tests/interfaces/preserve-dep-type-order/deps/dep/foo.wit +11 -0
  1373. data/rust-vendor/wit-component/tests/interfaces/preserve-dep-type-order/foo.wit +9 -0
  1374. data/rust-vendor/wit-component/tests/interfaces/preserve-dep-type-order/foo.wit.print +9 -0
  1375. data/rust-vendor/wit-component/tests/interfaces/preserve-dep-type-order.wat +47 -0
  1376. data/rust-vendor/wit-component/tests/interfaces/preserve-foreign-reexport/deps/my-dep/my-doc.wit +8 -0
  1377. data/rust-vendor/wit-component/tests/interfaces/preserve-foreign-reexport/foo.wit +5 -0
  1378. data/rust-vendor/wit-component/tests/interfaces/preserve-foreign-reexport/foo.wit.print +5 -0
  1379. data/rust-vendor/wit-component/tests/interfaces/preserve-foreign-reexport.wat +24 -0
  1380. data/rust-vendor/wit-component/tests/interfaces/print-keyword.wat +21 -0
  1381. data/rust-vendor/wit-component/tests/interfaces/print-keyword.wit +10 -0
  1382. data/rust-vendor/wit-component/tests/interfaces/print-keyword.wit.print +12 -0
  1383. data/rust-vendor/wit-component/tests/interfaces/records.wat +141 -0
  1384. data/rust-vendor/wit-component/tests/interfaces/records.wit +63 -0
  1385. data/rust-vendor/wit-component/tests/interfaces/records.wit.print +64 -0
  1386. data/rust-vendor/wit-component/tests/interfaces/reference-out-of-order.wat +63 -0
  1387. data/rust-vendor/wit-component/tests/interfaces/reference-out-of-order.wit +28 -0
  1388. data/rust-vendor/wit-component/tests/interfaces/reference-out-of-order.wit.print +31 -0
  1389. data/rust-vendor/wit-component/tests/interfaces/resources.wat +192 -0
  1390. data/rust-vendor/wit-component/tests/interfaces/resources.wit +80 -0
  1391. data/rust-vendor/wit-component/tests/interfaces/resources.wit.print +81 -0
  1392. data/rust-vendor/wit-component/tests/interfaces/simple-deps/deps/some-dep/types.wit +5 -0
  1393. data/rust-vendor/wit-component/tests/interfaces/simple-deps/foo.wit +4 -0
  1394. data/rust-vendor/wit-component/tests/interfaces/simple-deps/foo.wit.print +6 -0
  1395. data/rust-vendor/wit-component/tests/interfaces/simple-deps.wat +26 -0
  1396. data/rust-vendor/wit-component/tests/interfaces/simple-multi/bar.wit +1 -0
  1397. data/rust-vendor/wit-component/tests/interfaces/simple-multi/foo.wit +3 -0
  1398. data/rust-vendor/wit-component/tests/interfaces/simple-multi/foo.wit.print +8 -0
  1399. data/rust-vendor/wit-component/tests/interfaces/simple-multi.wat +24 -0
  1400. data/rust-vendor/wit-component/tests/interfaces/simple-use.wat +40 -0
  1401. data/rust-vendor/wit-component/tests/interfaces/simple-use.wit +13 -0
  1402. data/rust-vendor/wit-component/tests/interfaces/simple-use.wit.print +15 -0
  1403. data/rust-vendor/wit-component/tests/interfaces/simple-world.wat +35 -0
  1404. data/rust-vendor/wit-component/tests/interfaces/simple-world.wit +9 -0
  1405. data/rust-vendor/wit-component/tests/interfaces/simple-world.wit.print +9 -0
  1406. data/rust-vendor/wit-component/tests/interfaces/single-named-result.wat +18 -0
  1407. data/rust-vendor/wit-component/tests/interfaces/type-alias.wat +51 -0
  1408. data/rust-vendor/wit-component/tests/interfaces/type-alias.wit +13 -0
  1409. data/rust-vendor/wit-component/tests/interfaces/type-alias.wit.print +15 -0
  1410. data/rust-vendor/wit-component/tests/interfaces/type-alias2.wat +41 -0
  1411. data/rust-vendor/wit-component/tests/interfaces/type-alias2.wit +15 -0
  1412. data/rust-vendor/wit-component/tests/interfaces/type-alias2.wit.print +15 -0
  1413. data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name/deps/a/the-name.wit +4 -0
  1414. data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name/deps/b/the-name.wit +4 -0
  1415. data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name/foo.wit +6 -0
  1416. data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name/foo.wit.print +7 -0
  1417. data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name.wat +36 -0
  1418. data/rust-vendor/wit-component/tests/interfaces/use-chain.wat +72 -0
  1419. data/rust-vendor/wit-component/tests/interfaces/use-chain.wit +15 -0
  1420. data/rust-vendor/wit-component/tests/interfaces/use-chain.wit.print +18 -0
  1421. data/rust-vendor/wit-component/tests/interfaces/use-for-type.wat +49 -0
  1422. data/rust-vendor/wit-component/tests/interfaces/use-for-type.wit +16 -0
  1423. data/rust-vendor/wit-component/tests/interfaces/use-for-type.wit.print +17 -0
  1424. data/rust-vendor/wit-component/tests/interfaces/variants.wat +197 -0
  1425. data/rust-vendor/wit-component/tests/interfaces/variants.wit +78 -0
  1426. data/rust-vendor/wit-component/tests/interfaces/variants.wit.print +95 -0
  1427. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/command.wit +7 -0
  1428. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/environment.wit +18 -0
  1429. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/exit.wit +4 -0
  1430. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/imports.wit +20 -0
  1431. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/run.wit +4 -0
  1432. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/stdio.wit +17 -0
  1433. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/terminal.wit +47 -0
  1434. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/clocks/monotonic-clock.wit +45 -0
  1435. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/clocks/wall-clock.wit +42 -0
  1436. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/clocks/world.wit +6 -0
  1437. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/filesystem/preopens.wit +8 -0
  1438. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/filesystem/types.wit +634 -0
  1439. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/filesystem/world.wit +6 -0
  1440. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/io/error.wit +34 -0
  1441. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/io/poll.wit +41 -0
  1442. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/io/streams.wit +251 -0
  1443. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/io/world.wit +6 -0
  1444. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/random/insecure-seed.wit +25 -0
  1445. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/random/insecure.wit +22 -0
  1446. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/random/random.wit +26 -0
  1447. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/random/world.wit +7 -0
  1448. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/instance-network.wit +9 -0
  1449. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/ip-name-lookup.wit +51 -0
  1450. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/network.wit +147 -0
  1451. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/tcp-create-socket.wit +26 -0
  1452. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/tcp.wit +321 -0
  1453. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/udp-create-socket.wit +26 -0
  1454. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/udp.wit +277 -0
  1455. data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/world.wit +11 -0
  1456. data/rust-vendor/wit-component/tests/interfaces/wasi-http/handler.wit +43 -0
  1457. data/rust-vendor/wit-component/tests/interfaces/wasi-http/http.wit.print +571 -0
  1458. data/rust-vendor/wit-component/tests/interfaces/wasi-http/proxy.wit +32 -0
  1459. data/rust-vendor/wit-component/tests/interfaces/wasi-http/types.wit +570 -0
  1460. data/rust-vendor/wit-component/tests/interfaces/wasi-http.wat +881 -0
  1461. data/rust-vendor/wit-component/tests/interfaces/world-inline-interface.wat +24 -0
  1462. data/rust-vendor/wit-component/tests/interfaces/world-inline-interface.wit +6 -0
  1463. data/rust-vendor/wit-component/tests/interfaces/world-inline-interface.wit.print +9 -0
  1464. data/rust-vendor/wit-component/tests/interfaces/world-pkg-conflict/bar.wit +3 -0
  1465. data/rust-vendor/wit-component/tests/interfaces/world-pkg-conflict/foo.wit +9 -0
  1466. data/rust-vendor/wit-component/tests/interfaces/world-pkg-conflict/foo.wit.print +12 -0
  1467. data/rust-vendor/wit-component/tests/interfaces/world-pkg-conflict.wat +47 -0
  1468. data/rust-vendor/wit-component/tests/interfaces/world-top-level.wat +55 -0
  1469. data/rust-vendor/wit-component/tests/interfaces/world-top-level.wit +20 -0
  1470. data/rust-vendor/wit-component/tests/interfaces/world-top-level.wit.print +19 -0
  1471. data/rust-vendor/wit-component/tests/interfaces/worlds-with-types.wat +56 -0
  1472. data/rust-vendor/wit-component/tests/interfaces/worlds-with-types.wit +23 -0
  1473. data/rust-vendor/wit-component/tests/interfaces/worlds-with-types.wit.print +23 -0
  1474. data/rust-vendor/wit-component/tests/interfaces.rs +123 -0
  1475. data/rust-vendor/wit-component/tests/linking.rs +299 -0
  1476. data/rust-vendor/wit-component/tests/merge/bad-interface1/error.txt +1 -0
  1477. data/rust-vendor/wit-component/tests/merge/bad-interface1/from/a.wit +5 -0
  1478. data/rust-vendor/wit-component/tests/merge/bad-interface1/from/deps/foo/a.wit +5 -0
  1479. data/rust-vendor/wit-component/tests/merge/bad-interface1/into/a.wit +5 -0
  1480. data/rust-vendor/wit-component/tests/merge/bad-interface1/into/deps/foo/a.wit +5 -0
  1481. data/rust-vendor/wit-component/tests/merge/bad-interface2/error.txt +1 -0
  1482. data/rust-vendor/wit-component/tests/merge/bad-interface2/from/a.wit +5 -0
  1483. data/rust-vendor/wit-component/tests/merge/bad-interface2/from/deps/foo/a.wit +7 -0
  1484. data/rust-vendor/wit-component/tests/merge/bad-interface2/into/a.wit +5 -0
  1485. data/rust-vendor/wit-component/tests/merge/bad-interface2/into/deps/foo/a.wit +7 -0
  1486. data/rust-vendor/wit-component/tests/merge/bad-world1/error.txt +1 -0
  1487. data/rust-vendor/wit-component/tests/merge/bad-world1/from/a.wit +4 -0
  1488. data/rust-vendor/wit-component/tests/merge/bad-world1/from/deps/foo/a.wit +11 -0
  1489. data/rust-vendor/wit-component/tests/merge/bad-world1/into/a.wit +4 -0
  1490. data/rust-vendor/wit-component/tests/merge/bad-world1/into/deps/foo/a.wit +9 -0
  1491. data/rust-vendor/wit-component/tests/merge/bad-world2/error.txt +1 -0
  1492. data/rust-vendor/wit-component/tests/merge/bad-world2/from/a.wit +5 -0
  1493. data/rust-vendor/wit-component/tests/merge/bad-world2/from/deps/foo/a.wit +8 -0
  1494. data/rust-vendor/wit-component/tests/merge/bad-world2/into/a.wit +5 -0
  1495. data/rust-vendor/wit-component/tests/merge/bad-world2/into/deps/foo/a.wit +9 -0
  1496. data/rust-vendor/wit-component/tests/merge/bad-world3/error.txt +1 -0
  1497. data/rust-vendor/wit-component/tests/merge/bad-world3/from/a.wit +5 -0
  1498. data/rust-vendor/wit-component/tests/merge/bad-world3/from/deps/foo/a.wit +8 -0
  1499. data/rust-vendor/wit-component/tests/merge/bad-world3/into/a.wit +5 -0
  1500. data/rust-vendor/wit-component/tests/merge/bad-world3/into/deps/foo/a.wit +9 -0
  1501. data/rust-vendor/wit-component/tests/merge/bad-world4/error.txt +1 -0
  1502. data/rust-vendor/wit-component/tests/merge/bad-world4/from/a.wit +5 -0
  1503. data/rust-vendor/wit-component/tests/merge/bad-world4/from/deps/foo/a.wit +11 -0
  1504. data/rust-vendor/wit-component/tests/merge/bad-world4/into/a.wit +5 -0
  1505. data/rust-vendor/wit-component/tests/merge/bad-world4/into/deps/foo/a.wit +9 -0
  1506. data/rust-vendor/wit-component/tests/merge/bad-world5/error.txt +1 -0
  1507. data/rust-vendor/wit-component/tests/merge/bad-world5/from/a.wit +5 -0
  1508. data/rust-vendor/wit-component/tests/merge/bad-world5/from/deps/foo/a.wit +11 -0
  1509. data/rust-vendor/wit-component/tests/merge/bad-world5/into/a.wit +5 -0
  1510. data/rust-vendor/wit-component/tests/merge/bad-world5/into/deps/foo/a.wit +9 -0
  1511. data/rust-vendor/wit-component/tests/merge/success/from/a.wit +7 -0
  1512. data/rust-vendor/wit-component/tests/merge/success/from/deps/foo/only-from.wit +5 -0
  1513. data/rust-vendor/wit-component/tests/merge/success/from/deps/foo/shared.wit +46 -0
  1514. data/rust-vendor/wit-component/tests/merge/success/from/deps/only-from-dep/a.wit +5 -0
  1515. data/rust-vendor/wit-component/tests/merge/success/into/b.wit +7 -0
  1516. data/rust-vendor/wit-component/tests/merge/success/into/deps/foo/only-into.wit +5 -0
  1517. data/rust-vendor/wit-component/tests/merge/success/into/deps/foo/shared.wit +44 -0
  1518. data/rust-vendor/wit-component/tests/merge/success/merge/foo.wit +77 -0
  1519. data/rust-vendor/wit-component/tests/merge/success/merge/from.wit +8 -0
  1520. data/rust-vendor/wit-component/tests/merge/success/merge/into.wit +8 -0
  1521. data/rust-vendor/wit-component/tests/merge/success/merge/only-from-dep.wit +6 -0
  1522. data/rust-vendor/wit-component/tests/merge.rs +80 -0
  1523. data/rust-vendor/wit-component/tests/targets/error-missing-export/error.txt +2 -0
  1524. data/rust-vendor/wit-component/tests/targets/error-missing-export/test.wat +39 -0
  1525. data/rust-vendor/wit-component/tests/targets/error-missing-export/test.wit +18 -0
  1526. data/rust-vendor/wit-component/tests/targets/error-missing-import/error.txt +2 -0
  1527. data/rust-vendor/wit-component/tests/targets/error-missing-import/test.wat +37 -0
  1528. data/rust-vendor/wit-component/tests/targets/error-missing-import/test.wit +13 -0
  1529. data/rust-vendor/wit-component/tests/targets/success/test.wat +56 -0
  1530. data/rust-vendor/wit-component/tests/targets/success/test.wit +14 -0
  1531. data/rust-vendor/wit-component/tests/targets/success-empty/test.wat +1 -0
  1532. data/rust-vendor/wit-component/tests/targets/success-empty/test.wit +9 -0
  1533. data/rust-vendor/wit-component/tests/targets.rs +89 -0
  1534. data/rust-vendor/wit-component/tests/wit/parse-dir/wit/deps/bar/bar.wit +9 -0
  1535. data/rust-vendor/wit-component/tests/wit/parse-dir/wit/world.wit +5 -0
  1536. data/rust-vendor/wit-component/tests/wit.rs +49 -0
  1537. data/rust-vendor/wit-parser/.cargo-checksum.json +1 -0
  1538. data/rust-vendor/wit-parser/.cargo_vcs_info.json +6 -0
  1539. data/rust-vendor/wit-parser/Cargo.lock +576 -0
  1540. data/rust-vendor/wit-parser/Cargo.toml +157 -0
  1541. data/rust-vendor/wit-parser/Cargo.toml.orig +56 -0
  1542. data/rust-vendor/wit-parser/README.md +13 -0
  1543. data/rust-vendor/wit-parser/src/abi.rs +410 -0
  1544. data/rust-vendor/wit-parser/src/ast/lex.rs +751 -0
  1545. data/rust-vendor/wit-parser/src/ast/resolve.rs +1813 -0
  1546. data/rust-vendor/wit-parser/src/ast/toposort.rs +249 -0
  1547. data/rust-vendor/wit-parser/src/ast.rs +1958 -0
  1548. data/rust-vendor/wit-parser/src/decoding.rs +1864 -0
  1549. data/rust-vendor/wit-parser/src/lib.rs +1413 -0
  1550. data/rust-vendor/wit-parser/src/live.rs +264 -0
  1551. data/rust-vendor/wit-parser/src/metadata.rs +772 -0
  1552. data/rust-vendor/wit-parser/src/resolve/clone.rs +227 -0
  1553. data/rust-vendor/wit-parser/src/resolve.rs +4636 -0
  1554. data/rust-vendor/wit-parser/src/serde_.rs +140 -0
  1555. data/rust-vendor/wit-parser/src/sizealign.rs +626 -0
  1556. data/rust-vendor/wit-parser/tests/.gitignore +2 -0
  1557. data/rust-vendor/wit-parser/tests/all.rs +153 -0
  1558. data/rust-vendor/wit-parser/tests/ui/async.wit +24 -0
  1559. data/rust-vendor/wit-parser/tests/ui/async.wit.json +151 -0
  1560. data/rust-vendor/wit-parser/tests/ui/comments.wit +25 -0
  1561. data/rust-vendor/wit-parser/tests/ui/comments.wit.json +46 -0
  1562. data/rust-vendor/wit-parser/tests/ui/complex-include/deps/bar/root.wit +9 -0
  1563. data/rust-vendor/wit-parser/tests/ui/complex-include/deps/baz/root.wit +9 -0
  1564. data/rust-vendor/wit-parser/tests/ui/complex-include/root.wit +26 -0
  1565. data/rust-vendor/wit-parser/tests/ui/complex-include.wit.json +200 -0
  1566. data/rust-vendor/wit-parser/tests/ui/cross-package-resource/deps/foo/foo.wit +5 -0
  1567. data/rust-vendor/wit-parser/tests/ui/cross-package-resource/foo.wit +7 -0
  1568. data/rust-vendor/wit-parser/tests/ui/cross-package-resource.wit.json +67 -0
  1569. data/rust-vendor/wit-parser/tests/ui/diamond1/deps/dep1/types.wit +2 -0
  1570. data/rust-vendor/wit-parser/tests/ui/diamond1/deps/dep2/types.wit +2 -0
  1571. data/rust-vendor/wit-parser/tests/ui/diamond1/join.wit +6 -0
  1572. data/rust-vendor/wit-parser/tests/ui/diamond1.wit.json +59 -0
  1573. data/rust-vendor/wit-parser/tests/ui/disambiguate-diamond/shared1.wit +3 -0
  1574. data/rust-vendor/wit-parser/tests/ui/disambiguate-diamond/shared2.wit +3 -0
  1575. data/rust-vendor/wit-parser/tests/ui/disambiguate-diamond/world.wit +13 -0
  1576. data/rust-vendor/wit-parser/tests/ui/disambiguate-diamond.wit.json +115 -0
  1577. data/rust-vendor/wit-parser/tests/ui/empty.wit +1 -0
  1578. data/rust-vendor/wit-parser/tests/ui/empty.wit.json +12 -0
  1579. data/rust-vendor/wit-parser/tests/ui/error-context.wit +7 -0
  1580. data/rust-vendor/wit-parser/tests/ui/error-context.wit.json +59 -0
  1581. data/rust-vendor/wit-parser/tests/ui/feature-gates.wit +118 -0
  1582. data/rust-vendor/wit-parser/tests/ui/feature-gates.wit.json +301 -0
  1583. data/rust-vendor/wit-parser/tests/ui/feature-types.wit +13 -0
  1584. data/rust-vendor/wit-parser/tests/ui/feature-types.wit.json +66 -0
  1585. data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/another-pkg/other-doc.wit +3 -0
  1586. data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/corp/saas.wit +4 -0
  1587. data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/different-pkg/the-doc.wit +2 -0
  1588. data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/foreign-pkg/the-doc.wit +5 -0
  1589. data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/some-pkg/some-doc.wit +13 -0
  1590. data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/wasi/clocks.wit +5 -0
  1591. data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/wasi/filesystem.wit +7 -0
  1592. data/rust-vendor/wit-parser/tests/ui/foreign-deps/root.wit +44 -0
  1593. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/another-pkg/other-doc.wit +3 -0
  1594. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/corp/saas.wit +4 -0
  1595. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/different-pkg/the-doc.wit +2 -0
  1596. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/foreign-pkg/the-doc.wit +5 -0
  1597. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/some-pkg/some-doc.wit +13 -0
  1598. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/wasi/clocks.wit +5 -0
  1599. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/wasi/filesystem.wit +7 -0
  1600. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/wasi/wasi.wit +6 -0
  1601. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/root.wit +50 -0
  1602. data/rust-vendor/wit-parser/tests/ui/foreign-deps-union.wit.json +410 -0
  1603. data/rust-vendor/wit-parser/tests/ui/foreign-deps.wit.json +362 -0
  1604. data/rust-vendor/wit-parser/tests/ui/foreign-interface-dep-gated.wit +17 -0
  1605. data/rust-vendor/wit-parser/tests/ui/foreign-interface-dep-gated.wit.json +39 -0
  1606. data/rust-vendor/wit-parser/tests/ui/foreign-world-dep-gated.wit +17 -0
  1607. data/rust-vendor/wit-parser/tests/ui/foreign-world-dep-gated.wit.json +39 -0
  1608. data/rust-vendor/wit-parser/tests/ui/functions.wit +11 -0
  1609. data/rust-vendor/wit-parser/tests/ui/functions.wit.json +115 -0
  1610. data/rust-vendor/wit-parser/tests/ui/gated-include.wit +67 -0
  1611. data/rust-vendor/wit-parser/tests/ui/gated-include.wit.json +346 -0
  1612. data/rust-vendor/wit-parser/tests/ui/gated-use.wit +13 -0
  1613. data/rust-vendor/wit-parser/tests/ui/gated-use.wit.json +34 -0
  1614. data/rust-vendor/wit-parser/tests/ui/ignore-files-deps/deps/bar/types.wit +2 -0
  1615. data/rust-vendor/wit-parser/tests/ui/ignore-files-deps/deps/ignore-me.txt +1 -0
  1616. data/rust-vendor/wit-parser/tests/ui/ignore-files-deps/world.wit +5 -0
  1617. data/rust-vendor/wit-parser/tests/ui/ignore-files-deps.wit.json +41 -0
  1618. data/rust-vendor/wit-parser/tests/ui/import-export-overlap1.wit +5 -0
  1619. data/rust-vendor/wit-parser/tests/ui/import-export-overlap1.wit.json +37 -0
  1620. data/rust-vendor/wit-parser/tests/ui/import-export-overlap2.wit +5 -0
  1621. data/rust-vendor/wit-parser/tests/ui/import-export-overlap2.wit.json +42 -0
  1622. data/rust-vendor/wit-parser/tests/ui/include-reps.wit +15 -0
  1623. data/rust-vendor/wit-parser/tests/ui/include-reps.wit.json +68 -0
  1624. data/rust-vendor/wit-parser/tests/ui/kebab-name-include-with.wit +8 -0
  1625. data/rust-vendor/wit-parser/tests/ui/kebab-name-include-with.wit.json +66 -0
  1626. data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/a.wit +8 -0
  1627. data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/deps/b/root.wit +3 -0
  1628. data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/deps/c.wit +3 -0
  1629. data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/deps/d.wat +6 -0
  1630. data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/deps/e.wasm +0 -0
  1631. data/rust-vendor/wit-parser/tests/ui/kinds-of-deps.wit.json +95 -0
  1632. data/rust-vendor/wit-parser/tests/ui/many-names/a.wit +2 -0
  1633. data/rust-vendor/wit-parser/tests/ui/many-names/b.wit +5 -0
  1634. data/rust-vendor/wit-parser/tests/ui/many-names.wit.json +42 -0
  1635. data/rust-vendor/wit-parser/tests/ui/maps.wit +34 -0
  1636. data/rust-vendor/wit-parser/tests/ui/maps.wit.json +255 -0
  1637. data/rust-vendor/wit-parser/tests/ui/multi-file/bar.wit +21 -0
  1638. data/rust-vendor/wit-parser/tests/ui/multi-file/cycle-a.wit +7 -0
  1639. data/rust-vendor/wit-parser/tests/ui/multi-file/cycle-b.wit +3 -0
  1640. data/rust-vendor/wit-parser/tests/ui/multi-file/foo.wit +31 -0
  1641. data/rust-vendor/wit-parser/tests/ui/multi-file-multi-package/a.wit +24 -0
  1642. data/rust-vendor/wit-parser/tests/ui/multi-file-multi-package/b.wit +23 -0
  1643. data/rust-vendor/wit-parser/tests/ui/multi-file-multi-package.wit.json +255 -0
  1644. data/rust-vendor/wit-parser/tests/ui/multi-file.wit.json +300 -0
  1645. data/rust-vendor/wit-parser/tests/ui/multi-package-deps/deps/dep.wit +13 -0
  1646. data/rust-vendor/wit-parser/tests/ui/multi-package-deps/root.wit +16 -0
  1647. data/rust-vendor/wit-parser/tests/ui/multi-package-deps.wit.json +161 -0
  1648. data/rust-vendor/wit-parser/tests/ui/multi-package-gated-include.wit +114 -0
  1649. data/rust-vendor/wit-parser/tests/ui/multi-package-gated-include.wit.json +697 -0
  1650. data/rust-vendor/wit-parser/tests/ui/multi-package-shared-deps/deps/dep1/types.wit +4 -0
  1651. data/rust-vendor/wit-parser/tests/ui/multi-package-shared-deps/deps/dep2/types.wit +4 -0
  1652. data/rust-vendor/wit-parser/tests/ui/multi-package-shared-deps/packages.wit +41 -0
  1653. data/rust-vendor/wit-parser/tests/ui/multi-package-shared-deps.wit.json +261 -0
  1654. data/rust-vendor/wit-parser/tests/ui/multi-package-transitive-deps/deps/dep1/types.wit +8 -0
  1655. data/rust-vendor/wit-parser/tests/ui/multi-package-transitive-deps/deps/dep2/types.wit +14 -0
  1656. data/rust-vendor/wit-parser/tests/ui/multi-package-transitive-deps/packages.wit +12 -0
  1657. data/rust-vendor/wit-parser/tests/ui/multi-package-transitive-deps.wit.json +174 -0
  1658. data/rust-vendor/wit-parser/tests/ui/name-both-resource-and-type/deps/dep/foo.wit +5 -0
  1659. data/rust-vendor/wit-parser/tests/ui/name-both-resource-and-type/foo.wit +9 -0
  1660. data/rust-vendor/wit-parser/tests/ui/name-both-resource-and-type.wit.json +89 -0
  1661. data/rust-vendor/wit-parser/tests/ui/package-syntax1.wit +1 -0
  1662. data/rust-vendor/wit-parser/tests/ui/package-syntax1.wit.json +12 -0
  1663. data/rust-vendor/wit-parser/tests/ui/package-syntax3.wit +1 -0
  1664. data/rust-vendor/wit-parser/tests/ui/package-syntax3.wit.json +12 -0
  1665. data/rust-vendor/wit-parser/tests/ui/package-syntax4.wit +1 -0
  1666. data/rust-vendor/wit-parser/tests/ui/package-syntax4.wit.json +12 -0
  1667. data/rust-vendor/wit-parser/tests/ui/packages-multiple-nested.wit +35 -0
  1668. data/rust-vendor/wit-parser/tests/ui/packages-multiple-nested.wit.json +184 -0
  1669. data/rust-vendor/wit-parser/tests/ui/packages-nested-colliding-decl-names.wit +24 -0
  1670. data/rust-vendor/wit-parser/tests/ui/packages-nested-colliding-decl-names.wit.json +135 -0
  1671. data/rust-vendor/wit-parser/tests/ui/packages-nested-internal-references.wit +16 -0
  1672. data/rust-vendor/wit-parser/tests/ui/packages-nested-internal-references.wit.json +91 -0
  1673. data/rust-vendor/wit-parser/tests/ui/packages-nested-with-semver.wit +24 -0
  1674. data/rust-vendor/wit-parser/tests/ui/packages-nested-with-semver.wit.json +135 -0
  1675. data/rust-vendor/wit-parser/tests/ui/packages-single-nested.wit +12 -0
  1676. data/rust-vendor/wit-parser/tests/ui/packages-single-nested.wit.json +75 -0
  1677. data/rust-vendor/wit-parser/tests/ui/parse-fail/alias-no-type.wit +6 -0
  1678. data/rust-vendor/wit-parser/tests/ui/parse-fail/alias-no-type.wit.result +5 -0
  1679. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world.wit +6 -0
  1680. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world.wit.result +5 -0
  1681. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world2.wit +6 -0
  1682. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world2.wit.result +5 -0
  1683. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world3.wit +6 -0
  1684. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world3.wit.result +5 -0
  1685. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world4.wit +11 -0
  1686. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world4.wit.result +5 -0
  1687. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad1.wit +7 -0
  1688. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad1.wit.result +5 -0
  1689. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad2.wit +7 -0
  1690. data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad2.wit.result +5 -0
  1691. data/rust-vendor/wit-parser/tests/ui/parse-fail/async.wit.result +5 -0
  1692. data/rust-vendor/wit-parser/tests/ui/parse-fail/async1.wit.result +5 -0
  1693. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated1.wit +4 -0
  1694. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated1.wit.result +5 -0
  1695. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated2.wit +4 -0
  1696. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated2.wit.result +5 -0
  1697. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated3.wit +4 -0
  1698. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated3.wit.result +5 -0
  1699. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated4.wit +5 -0
  1700. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated4.wit.result +5 -0
  1701. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-function.wit +7 -0
  1702. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-function.wit.result +5 -0
  1703. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-function2.wit +7 -0
  1704. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-function2.wit.result +5 -0
  1705. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate1.wit +8 -0
  1706. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate1.wit.result +5 -0
  1707. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate2.wit +8 -0
  1708. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate2.wit.result +5 -0
  1709. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate3.wit +6 -0
  1710. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate3.wit.result +5 -0
  1711. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate4.wit +8 -0
  1712. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate4.wit.result +5 -0
  1713. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate5.wit +11 -0
  1714. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate5.wit.result +5 -0
  1715. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include1.wit +5 -0
  1716. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include1.wit.result +5 -0
  1717. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include2.wit +9 -0
  1718. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include2.wit.result +5 -0
  1719. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include3.wit +5 -0
  1720. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include3.wit.result +5 -0
  1721. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list.wit +7 -0
  1722. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list.wit.result +5 -0
  1723. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list2.wit +7 -0
  1724. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list2.wit.result +5 -0
  1725. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list3.wit +7 -0
  1726. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list3.wit.result +5 -0
  1727. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list4.wit +7 -0
  1728. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list4.wit.result +5 -0
  1729. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg1/root.wit +5 -0
  1730. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg1.wit.result +5 -0
  1731. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg2/deps/bar/empty.wit +1 -0
  1732. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg2/root.wit +5 -0
  1733. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg2.wit.result +5 -0
  1734. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg3/deps/bar/.gitkeep +0 -0
  1735. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg3/deps/bar/baz.wit +2 -0
  1736. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg3/root.wit +5 -0
  1737. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg3.wit.result +5 -0
  1738. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg4/deps/bar/.gitkeep +0 -0
  1739. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg4/deps/bar/baz.wit +4 -0
  1740. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg4/root.wit +4 -0
  1741. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg4.wit.result +5 -0
  1742. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg5/deps/bar/.gitkeep +0 -0
  1743. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg5/deps/bar/baz.wit +3 -0
  1744. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg5/root.wit +4 -0
  1745. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg5.wit.result +5 -0
  1746. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg6/deps/bar/.gitkeep +0 -0
  1747. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg6/deps/bar/baz.wit +4 -0
  1748. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg6/root.wit +4 -0
  1749. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg6.wit.result +8 -0
  1750. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource1.wit +5 -0
  1751. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource1.wit.result +5 -0
  1752. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource10.wit +5 -0
  1753. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource10.wit.result +5 -0
  1754. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource11.wit +5 -0
  1755. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource11.wit.result +5 -0
  1756. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource12.wit +6 -0
  1757. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource12.wit.result +5 -0
  1758. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource13.wit +6 -0
  1759. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource13.wit.result +5 -0
  1760. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource14.wit +7 -0
  1761. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource14.wit.result +5 -0
  1762. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource15/deps/foo/foo.wit +5 -0
  1763. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource15/foo.wit +7 -0
  1764. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource15.wit.result +5 -0
  1765. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource16.wit +7 -0
  1766. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource16.wit.result +5 -0
  1767. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource17.wit +8 -0
  1768. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource17.wit.result +5 -0
  1769. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource2.wit +5 -0
  1770. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource2.wit.result +5 -0
  1771. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource3.wit +6 -0
  1772. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource3.wit.result +5 -0
  1773. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource4.wit +6 -0
  1774. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource4.wit.result +5 -0
  1775. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource5.wit +7 -0
  1776. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource5.wit.result +5 -0
  1777. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource6.wit +7 -0
  1778. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource6.wit.result +5 -0
  1779. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource7.wit +8 -0
  1780. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource7.wit.result +5 -0
  1781. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource8.wit +8 -0
  1782. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource8.wit.result +5 -0
  1783. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource9.wit +7 -0
  1784. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource9.wit.result +5 -0
  1785. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-since1.wit +4 -0
  1786. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-since1.wit.result +5 -0
  1787. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-since3.wit +5 -0
  1788. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-since3.wit.result +5 -0
  1789. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-world-type1.wit +5 -0
  1790. data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-world-type1.wit.result +5 -0
  1791. data/rust-vendor/wit-parser/tests/ui/parse-fail/case-insensitive-duplicates.wit +9 -0
  1792. data/rust-vendor/wit-parser/tests/ui/parse-fail/case-insensitive-duplicates.wit.result +1 -0
  1793. data/rust-vendor/wit-parser/tests/ui/parse-fail/conflicting-package/a.wit +1 -0
  1794. data/rust-vendor/wit-parser/tests/ui/parse-fail/conflicting-package/b.wit +1 -0
  1795. data/rust-vendor/wit-parser/tests/ui/parse-fail/conflicting-package.wit.result +5 -0
  1796. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle.wit +6 -0
  1797. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle.wit.result +5 -0
  1798. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle2.wit +7 -0
  1799. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle2.wit.result +5 -0
  1800. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle3.wit +7 -0
  1801. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle3.wit.result +5 -0
  1802. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle4.wit +7 -0
  1803. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle4.wit.result +5 -0
  1804. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle5.wit +7 -0
  1805. data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle5.wit.result +5 -0
  1806. data/rust-vendor/wit-parser/tests/ui/parse-fail/dangling-type.wit +5 -0
  1807. data/rust-vendor/wit-parser/tests/ui/parse-fail/dangling-type.wit.result +5 -0
  1808. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-function-params.wit +7 -0
  1809. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-function-params.wit.result +5 -0
  1810. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-functions.wit +8 -0
  1811. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-functions.wit.result +5 -0
  1812. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface.wit +6 -0
  1813. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface.wit.result +5 -0
  1814. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface2/foo.wit +3 -0
  1815. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface2/foo2.wit +3 -0
  1816. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface2.wit.result +5 -0
  1817. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-type.wit +7 -0
  1818. data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-type.wit.result +5 -0
  1819. data/rust-vendor/wit-parser/tests/ui/parse-fail/empty-enum.wit +6 -0
  1820. data/rust-vendor/wit-parser/tests/ui/parse-fail/empty-enum.wit.result +5 -0
  1821. data/rust-vendor/wit-parser/tests/ui/parse-fail/empty-variant1.wit +6 -0
  1822. data/rust-vendor/wit-parser/tests/ui/parse-fail/empty-variant1.wit.result +5 -0
  1823. data/rust-vendor/wit-parser/tests/ui/parse-fail/export-twice.wit +8 -0
  1824. data/rust-vendor/wit-parser/tests/ui/parse-fail/export-twice.wit.result +5 -0
  1825. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export1.wit +17 -0
  1826. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export1.wit.result +5 -0
  1827. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export2.wit +18 -0
  1828. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export2.wit.result +5 -0
  1829. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export3.wit +37 -0
  1830. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export3.wit.result +5 -0
  1831. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export4.wit +44 -0
  1832. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export4.wit.result +5 -0
  1833. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export5.wit +18 -0
  1834. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export5.wit.result +5 -0
  1835. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-twice.wit +8 -0
  1836. data/rust-vendor/wit-parser/tests/ui/parse-fail/import-twice.wit.result +5 -0
  1837. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-cycle.wit +9 -0
  1838. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-cycle.wit.result +5 -0
  1839. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-foreign/deps/bar/empty.wit +3 -0
  1840. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-foreign/root.wit +5 -0
  1841. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-foreign.wit.result +5 -0
  1842. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-with-id.wit +11 -0
  1843. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-with-id.wit.result +5 -0
  1844. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-with-on-id.wit +11 -0
  1845. data/rust-vendor/wit-parser/tests/ui/parse-fail/include-with-on-id.wit.result +5 -0
  1846. data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-toplevel.wit +5 -0
  1847. data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-toplevel.wit.result +5 -0
  1848. data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-type-reference.wit +10 -0
  1849. data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-type-reference.wit.result +5 -0
  1850. data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-type-reference2.wit +6 -0
  1851. data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-type-reference2.wit.result +5 -0
  1852. data/rust-vendor/wit-parser/tests/ui/parse-fail/kebab-name-include-not-found.wit +8 -0
  1853. data/rust-vendor/wit-parser/tests/ui/parse-fail/kebab-name-include-not-found.wit.result +5 -0
  1854. data/rust-vendor/wit-parser/tests/ui/parse-fail/kebab-name-include.wit +8 -0
  1855. data/rust-vendor/wit-parser/tests/ui/parse-fail/kebab-name-include.wit.result +5 -0
  1856. data/rust-vendor/wit-parser/tests/ui/parse-fail/keyword.wit +5 -0
  1857. data/rust-vendor/wit-parser/tests/ui/parse-fail/keyword.wit.result +5 -0
  1858. data/rust-vendor/wit-parser/tests/ui/parse-fail/map-invalid-key.wit +7 -0
  1859. data/rust-vendor/wit-parser/tests/ui/parse-fail/map-invalid-key.wit.result +5 -0
  1860. data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-main-declaration-initial-main.wit +23 -0
  1861. data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-main-declaration-initial-main.wit.result +1 -0
  1862. data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-main-declaration-initial-nested.wit +23 -0
  1863. data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-main-declaration-initial-nested.wit.result +1 -0
  1864. data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-package.wit +0 -0
  1865. data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-package.wit.result +1 -0
  1866. data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-file-missing-delimiter/observe.wit +5 -0
  1867. data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-file-missing-delimiter/world.wit +5 -0
  1868. data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-file-missing-delimiter.wit.result +5 -0
  1869. data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-package-deps-share-nest/deps/dep1/types.wit +12 -0
  1870. data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-package-deps-share-nest/deps/dep2/types.wit +12 -0
  1871. data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-package-deps-share-nest/root.wit +8 -0
  1872. data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-package-deps-share-nest.wit.result +3 -0
  1873. data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-docs/a.wit +2 -0
  1874. data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-docs/b.wit +2 -0
  1875. data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-docs.wit.result +5 -0
  1876. data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-inline-cycle.wit +12 -0
  1877. data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-inline-cycle.wit.result +5 -0
  1878. data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-packages-no-scope-blocks.wit +15 -0
  1879. data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-packages-no-scope-blocks.wit.result +5 -0
  1880. data/rust-vendor/wit-parser/tests/ui/parse-fail/nested-packages-colliding-names.wit +5 -0
  1881. data/rust-vendor/wit-parser/tests/ui/parse-fail/nested-packages-colliding-names.wit.result +3 -0
  1882. data/rust-vendor/wit-parser/tests/ui/parse-fail/nested-packages-with-error.wit +14 -0
  1883. data/rust-vendor/wit-parser/tests/ui/parse-fail/nested-packages-with-error.wit.result +5 -0
  1884. data/rust-vendor/wit-parser/tests/ui/parse-fail/no-access-to-sibling-use/bar.wit +1 -0
  1885. data/rust-vendor/wit-parser/tests/ui/parse-fail/no-access-to-sibling-use/foo.wit +5 -0
  1886. data/rust-vendor/wit-parser/tests/ui/parse-fail/no-access-to-sibling-use.wit.result +5 -0
  1887. data/rust-vendor/wit-parser/tests/ui/parse-fail/non-existance-world-include/deps/bar/.gitkeep +0 -0
  1888. data/rust-vendor/wit-parser/tests/ui/parse-fail/non-existance-world-include/deps/bar/baz.wit +4 -0
  1889. data/rust-vendor/wit-parser/tests/ui/parse-fail/non-existance-world-include/root.wit +5 -0
  1890. data/rust-vendor/wit-parser/tests/ui/parse-fail/non-existance-world-include.wit.result +5 -0
  1891. data/rust-vendor/wit-parser/tests/ui/parse-fail/old-float-types.wit +5 -0
  1892. data/rust-vendor/wit-parser/tests/ui/parse-fail/old-float-types.wit.result +5 -0
  1893. data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle/deps/a1/root.wit +4 -0
  1894. data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle/root.wit +4 -0
  1895. data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle.wit.result +5 -0
  1896. data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle2/deps/a1/root.wit +4 -0
  1897. data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle2/deps/a2/root.wit +4 -0
  1898. data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle2/root.wit +4 -0
  1899. data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle2.wit.result +5 -0
  1900. data/rust-vendor/wit-parser/tests/ui/parse-fail/resources-multiple-returns-borrow.wit +10 -0
  1901. data/rust-vendor/wit-parser/tests/ui/parse-fail/resources-multiple-returns-borrow.wit.result +5 -0
  1902. data/rust-vendor/wit-parser/tests/ui/parse-fail/resources-return-borrow.wit +10 -0
  1903. data/rust-vendor/wit-parser/tests/ui/parse-fail/resources-return-borrow.wit.result +5 -0
  1904. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow1.wit +7 -0
  1905. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow1.wit.result +5 -0
  1906. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow2.wit +8 -0
  1907. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow2.wit.result +5 -0
  1908. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow3.wit +7 -0
  1909. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow3.wit.result +5 -0
  1910. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow4.wit +7 -0
  1911. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow4.wit.result +5 -0
  1912. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow5.wit +7 -0
  1913. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow5.wit.result +5 -0
  1914. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow6.wit +7 -0
  1915. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow6.wit.result +5 -0
  1916. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow7.wit +11 -0
  1917. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow7.wit.result +5 -0
  1918. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow8/deps/baz.wit +9 -0
  1919. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow8/foo.wit +7 -0
  1920. data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow8.wit.result +5 -0
  1921. data/rust-vendor/wit-parser/tests/ui/parse-fail/type-and-resource-same-name/deps/dep/foo.wit +5 -0
  1922. data/rust-vendor/wit-parser/tests/ui/parse-fail/type-and-resource-same-name/foo.wit +8 -0
  1923. data/rust-vendor/wit-parser/tests/ui/parse-fail/type-and-resource-same-name.wit.result +5 -0
  1924. data/rust-vendor/wit-parser/tests/ui/parse-fail/undefined-typed.wit +6 -0
  1925. data/rust-vendor/wit-parser/tests/ui/parse-fail/undefined-typed.wit.result +5 -0
  1926. data/rust-vendor/wit-parser/tests/ui/parse-fail/unknown-interface.wit +7 -0
  1927. data/rust-vendor/wit-parser/tests/ui/parse-fail/unknown-interface.wit.result +5 -0
  1928. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface1.wit +7 -0
  1929. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface1.wit.result +5 -0
  1930. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface2.wit +8 -0
  1931. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface2.wit.result +5 -0
  1932. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface3.wit +5 -0
  1933. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface3.wit.result +5 -0
  1934. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface4.wit +7 -0
  1935. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface4.wit.result +7 -0
  1936. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use1.wit +7 -0
  1937. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use1.wit.result +5 -0
  1938. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use10/bar.wit +5 -0
  1939. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use10/foo.wit +2 -0
  1940. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use10.wit.result +5 -0
  1941. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use2.wit +10 -0
  1942. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use2.wit.result +5 -0
  1943. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use3.wit +11 -0
  1944. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use3.wit.result +5 -0
  1945. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use7.wit +10 -0
  1946. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use7.wit.result +5 -0
  1947. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use8.wit +9 -0
  1948. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use8.wit.result +5 -0
  1949. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use9.wit +9 -0
  1950. data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use9.wit.result +5 -0
  1951. data/rust-vendor/wit-parser/tests/ui/parse-fail/unterminated-string.wit.result +5 -0
  1952. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-and-include-world/deps/bar/.gitkeep +0 -0
  1953. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-and-include-world/deps/bar/baz.wit +4 -0
  1954. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-and-include-world/root.wit +7 -0
  1955. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-and-include-world.wit.result +5 -0
  1956. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict.wit +11 -0
  1957. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict.wit.result +5 -0
  1958. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict2.wit +13 -0
  1959. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict2.wit.result +5 -0
  1960. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict3.wit +13 -0
  1961. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict3.wit.result +5 -0
  1962. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-cycle1.wit +7 -0
  1963. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-cycle1.wit.result +5 -0
  1964. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-cycle4.wit +14 -0
  1965. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-cycle4.wit.result +5 -0
  1966. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-shadow1.wit +7 -0
  1967. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-shadow1.wit.result +5 -0
  1968. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-world/deps/bar/.gitkeep +0 -0
  1969. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-world/deps/bar/baz.wit +4 -0
  1970. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-world/root.wit +7 -0
  1971. data/rust-vendor/wit-parser/tests/ui/parse-fail/use-world.wit.result +5 -0
  1972. data/rust-vendor/wit-parser/tests/ui/parse-fail/very-nested-packages.wit +8 -0
  1973. data/rust-vendor/wit-parser/tests/ui/parse-fail/very-nested-packages.wit.result +5 -0
  1974. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-interface-clash.wit +3 -0
  1975. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-interface-clash.wit.result +5 -0
  1976. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-same-fields2.wit +8 -0
  1977. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-same-fields2.wit.result +5 -0
  1978. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-same-fields3.wit +8 -0
  1979. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-same-fields3.wit.result +5 -0
  1980. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-top-level-func.wit +5 -0
  1981. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-top-level-func.wit.result +5 -0
  1982. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-top-level-func2.wit +4 -0
  1983. data/rust-vendor/wit-parser/tests/ui/parse-fail/world-top-level-func2.wit.result +5 -0
  1984. data/rust-vendor/wit-parser/tests/ui/random.wit +27 -0
  1985. data/rust-vendor/wit-parser/tests/ui/random.wit.json +56 -0
  1986. data/rust-vendor/wit-parser/tests/ui/resources-empty.wit +10 -0
  1987. data/rust-vendor/wit-parser/tests/ui/resources-empty.wit.json +70 -0
  1988. data/rust-vendor/wit-parser/tests/ui/resources-multiple-returns-own.wit +10 -0
  1989. data/rust-vendor/wit-parser/tests/ui/resources-multiple-returns-own.wit.json +85 -0
  1990. data/rust-vendor/wit-parser/tests/ui/resources-multiple.wit +17 -0
  1991. data/rust-vendor/wit-parser/tests/ui/resources-multiple.wit.json +207 -0
  1992. data/rust-vendor/wit-parser/tests/ui/resources-return-own.wit +10 -0
  1993. data/rust-vendor/wit-parser/tests/ui/resources-return-own.wit.json +73 -0
  1994. data/rust-vendor/wit-parser/tests/ui/resources.wit +55 -0
  1995. data/rust-vendor/wit-parser/tests/ui/resources.wit.json +387 -0
  1996. data/rust-vendor/wit-parser/tests/ui/resources1.wit +12 -0
  1997. data/rust-vendor/wit-parser/tests/ui/resources1.wit.json +92 -0
  1998. data/rust-vendor/wit-parser/tests/ui/same-name-import-export.wit +6 -0
  1999. data/rust-vendor/wit-parser/tests/ui/same-name-import-export.wit.json +39 -0
  2000. data/rust-vendor/wit-parser/tests/ui/shared-types.wit +10 -0
  2001. data/rust-vendor/wit-parser/tests/ui/shared-types.wit.json +79 -0
  2002. data/rust-vendor/wit-parser/tests/ui/simple-wasm-text.wat +6 -0
  2003. data/rust-vendor/wit-parser/tests/ui/simple-wasm-text.wit.json +21 -0
  2004. data/rust-vendor/wit-parser/tests/ui/since-and-unstable.wit +107 -0
  2005. data/rust-vendor/wit-parser/tests/ui/since-and-unstable.wit.json +608 -0
  2006. data/rust-vendor/wit-parser/tests/ui/streams-and-futures.wit +15 -0
  2007. data/rust-vendor/wit-parser/tests/ui/streams-and-futures.wit.json +205 -0
  2008. data/rust-vendor/wit-parser/tests/ui/stress-export-elaborate.wit +54 -0
  2009. data/rust-vendor/wit-parser/tests/ui/stress-export-elaborate.wit.json +1156 -0
  2010. data/rust-vendor/wit-parser/tests/ui/type-then-eof.wit +5 -0
  2011. data/rust-vendor/wit-parser/tests/ui/type-then-eof.wit.json +28 -0
  2012. data/rust-vendor/wit-parser/tests/ui/types.wit +59 -0
  2013. data/rust-vendor/wit-parser/tests/ui/types.wit.json +768 -0
  2014. data/rust-vendor/wit-parser/tests/ui/union-fuzz-1.wit +9 -0
  2015. data/rust-vendor/wit-parser/tests/ui/union-fuzz-1.wit.json +35 -0
  2016. data/rust-vendor/wit-parser/tests/ui/union-fuzz-2.wit +12 -0
  2017. data/rust-vendor/wit-parser/tests/ui/union-fuzz-2.wit.json +62 -0
  2018. data/rust-vendor/wit-parser/tests/ui/unstable-resource.wit +17 -0
  2019. data/rust-vendor/wit-parser/tests/ui/unstable-resource.wit.json +44 -0
  2020. data/rust-vendor/wit-parser/tests/ui/use-chain.wit +11 -0
  2021. data/rust-vendor/wit-parser/tests/ui/use-chain.wit.json +53 -0
  2022. data/rust-vendor/wit-parser/tests/ui/use.wit +34 -0
  2023. data/rust-vendor/wit-parser/tests/ui/use.wit.json +168 -0
  2024. data/rust-vendor/wit-parser/tests/ui/version-syntax.wit +10 -0
  2025. data/rust-vendor/wit-parser/tests/ui/version-syntax.wit.json +57 -0
  2026. data/rust-vendor/wit-parser/tests/ui/versions/deps/a1/foo.wit +5 -0
  2027. data/rust-vendor/wit-parser/tests/ui/versions/deps/a2/foo.wit +5 -0
  2028. data/rust-vendor/wit-parser/tests/ui/versions/foo.wit +7 -0
  2029. data/rust-vendor/wit-parser/tests/ui/versions.wit.json +91 -0
  2030. data/rust-vendor/wit-parser/tests/ui/wasi.wit +178 -0
  2031. data/rust-vendor/wit-parser/tests/ui/wasi.wit.json +539 -0
  2032. data/rust-vendor/wit-parser/tests/ui/with-resource-as.wit +15 -0
  2033. data/rust-vendor/wit-parser/tests/ui/with-resource-as.wit.json +221 -0
  2034. data/rust-vendor/wit-parser/tests/ui/world-diamond.wit +23 -0
  2035. data/rust-vendor/wit-parser/tests/ui/world-diamond.wit.json +115 -0
  2036. data/rust-vendor/wit-parser/tests/ui/world-iface-no-collide.wit +11 -0
  2037. data/rust-vendor/wit-parser/tests/ui/world-iface-no-collide.wit.json +67 -0
  2038. data/rust-vendor/wit-parser/tests/ui/world-implicit-import1.wit +12 -0
  2039. data/rust-vendor/wit-parser/tests/ui/world-implicit-import1.wit.json +81 -0
  2040. data/rust-vendor/wit-parser/tests/ui/world-implicit-import2.wit +11 -0
  2041. data/rust-vendor/wit-parser/tests/ui/world-implicit-import2.wit.json +68 -0
  2042. data/rust-vendor/wit-parser/tests/ui/world-implicit-import3.wit +11 -0
  2043. data/rust-vendor/wit-parser/tests/ui/world-implicit-import3.wit.json +69 -0
  2044. data/rust-vendor/wit-parser/tests/ui/world-same-fields4.wit +13 -0
  2045. data/rust-vendor/wit-parser/tests/ui/world-same-fields4.wit.json +82 -0
  2046. data/rust-vendor/wit-parser/tests/ui/world-top-level-funcs.wit +9 -0
  2047. data/rust-vendor/wit-parser/tests/ui/world-top-level-funcs.wit.json +79 -0
  2048. data/rust-vendor/wit-parser/tests/ui/world-top-level-resources.wit +24 -0
  2049. data/rust-vendor/wit-parser/tests/ui/world-top-level-resources.wit.json +225 -0
  2050. data/rust-vendor/wit-parser/tests/ui/worlds-union-dedup.wit +23 -0
  2051. data/rust-vendor/wit-parser/tests/ui/worlds-union-dedup.wit.json +112 -0
  2052. data/rust-vendor/wit-parser/tests/ui/worlds-with-types.wit +34 -0
  2053. data/rust-vendor/wit-parser/tests/ui/worlds-with-types.wit.json +188 -0
  2054. data/rust-vendor/zerocopy/.cargo-checksum.json +1 -1
  2055. data/rust-vendor/zerocopy/.cargo_vcs_info.json +1 -2
  2056. data/rust-vendor/zerocopy/Cargo.lock +3 -3
  2057. data/rust-vendor/zerocopy/Cargo.toml +4 -4
  2058. data/rust-vendor/zerocopy/Cargo.toml.orig +4 -4
  2059. data/rust-vendor/zerocopy/agent_docs/reviewing.md +8 -0
  2060. data/rust-vendor/zerocopy/build.rs +1 -0
  2061. data/rust-vendor/zerocopy/ci/release_crate_version.sh +3 -0
  2062. data/rust-vendor/zerocopy/src/doctests.rs +18 -2
  2063. data/rust-vendor/zerocopy/src/impls.rs +7 -4
  2064. data/rust-vendor/zerocopy/src/lib.rs +60 -28
  2065. data/rust-vendor/zerocopy/src/macros.rs +24 -4
  2066. data/rust-vendor/zerocopy/src/pointer/invariant.rs +31 -3
  2067. data/rust-vendor/zerocopy/src/pointer/mod.rs +2 -2
  2068. data/rust-vendor/zerocopy/src/pointer/ptr.rs +3 -3
  2069. data/rust-vendor/zerocopy/src/util/macros.rs +21 -6
  2070. data/rust-vendor/zerocopy/tests/trybuild.rs +3 -18
  2071. data/rust-vendor/zerocopy-derive/.cargo-checksum.json +1 -1
  2072. data/rust-vendor/zerocopy-derive/.cargo_vcs_info.json +1 -1
  2073. data/rust-vendor/zerocopy-derive/Cargo.lock +1 -1
  2074. data/rust-vendor/zerocopy-derive/Cargo.toml +9 -2
  2075. data/rust-vendor/zerocopy-derive/Cargo.toml.orig +5 -2
  2076. data/rust-vendor/zerocopy-derive/src/derive/from_bytes.rs +9 -7
  2077. data/rust-vendor/zerocopy-derive/src/derive/into_bytes.rs +8 -4
  2078. data/rust-vendor/zerocopy-derive/src/derive/try_from_bytes.rs +52 -18
  2079. data/rust-vendor/zerocopy-derive/src/derive/unaligned.rs +3 -3
  2080. data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_enum.expected.rs +7 -3
  2081. data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_struct.expected.rs +7 -3
  2082. data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_union.expected.rs +7 -3
  2083. data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_zeros.expected.rs +7 -3
  2084. data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes.expected.rs +7 -3
  2085. data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_1.expected.rs +22 -10
  2086. data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_2.expected.rs +22 -10
  2087. data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_3.expected.rs +22 -10
  2088. data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_trivial_is_bit_valid_enum.expected.rs +7 -3
  2089. data/rust-vendor/zerocopy-derive/src/util.rs +72 -5
  2090. data/rust-vendor/zerocopy-derive/tests/on_error.rs +169 -0
  2091. data/rust-vendor/zerocopy-derive/tests/trybuild.rs +9 -7
  2092. data/rust-vendor/zerocopy-derive/tests/ui-msrv/cfgs/on_error.rs +19 -0
  2093. data/rust-vendor/zerocopy-derive/tests/ui-msrv/cfgs/on_error.stderr +16 -0
  2094. data/rust-vendor/zerocopy-derive/tests/ui-msrv/{union_into_bytes_cfg → cfgs}/union_into_bytes_cfg.stderr +1 -1
  2095. data/rust-vendor/zerocopy-derive/tests/ui-nightly/cfgs/on_error.rs +19 -0
  2096. data/rust-vendor/zerocopy-derive/tests/ui-nightly/cfgs/on_error.stderr +31 -0
  2097. data/rust-vendor/zerocopy-derive/tests/ui-nightly/cfgs/union_into_bytes_cfg.stderr +8 -0
  2098. data/rust-vendor/zerocopy-derive/tests/ui-nightly/union.stderr +0 -14
  2099. data/rust-vendor/zerocopy-derive/tests/ui-stable/cfgs/on_error.rs +19 -0
  2100. data/rust-vendor/zerocopy-derive/tests/ui-stable/cfgs/on_error.stderr +27 -0
  2101. data/rust-vendor/zerocopy-derive/tests/ui-stable/cfgs/union_into_bytes_cfg.stderr +8 -0
  2102. data/rust-vendor/zerocopy-derive/tests/ui-stable/union.stderr +0 -14
  2103. data/rust-vendor/zmij/.cargo-checksum.json +1 -1
  2104. data/rust-vendor/zmij/.cargo_vcs_info.json +1 -1
  2105. data/rust-vendor/zmij/.github/workflows/ci.yml +9 -6
  2106. data/rust-vendor/zmij/Cargo.lock +281 -58
  2107. data/rust-vendor/zmij/Cargo.toml +3 -3
  2108. data/rust-vendor/zmij/Cargo.toml.orig +3 -3
  2109. data/rust-vendor/zmij/README.md +1 -1
  2110. data/rust-vendor/zmij/src/lib.rs +124 -79
  2111. data/rust-vendor/zmij/src/tests.rs +11 -5
  2112. data/rust-vendor/zmij/tests/ryu_comparison.rs +3 -3
  2113. metadata +1841 -55
  2114. data/rust-vendor/libc/src/qurt/hexagon.rs +0 -340
  2115. data/rust-vendor/regex/.vim/coc-settings.json +0 -6
  2116. data/rust-vendor/regex/Cross.toml +0 -7
  2117. data/rust-vendor/regex/rustfmt.toml +0 -2
  2118. data/rust-vendor/regex/test +0 -46
  2119. data/rust-vendor/regex/testdata/README.md +0 -22
  2120. data/rust-vendor/regex/testdata/fowler/basic.toml +0 -1611
  2121. data/rust-vendor/regex/testdata/fowler/dat/README +0 -25
  2122. data/rust-vendor/regex/testdata/fowler/dat/basic.dat +0 -223
  2123. data/rust-vendor/regex/testdata/fowler/dat/nullsubexpr.dat +0 -74
  2124. data/rust-vendor/regex/testdata/fowler/dat/repetition.dat +0 -169
  2125. data/rust-vendor/regex/testdata/fowler/nullsubexpr.toml +0 -405
  2126. data/rust-vendor/regex/testdata/fowler/repetition.toml +0 -746
  2127. data/rust-vendor/regex-automata/test +0 -95
  2128. data/rust-vendor/regex-automata/tests/fuzz/mod.rs +0 -2
  2129. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_dense_crash-9486fb7c8a93b12c12a62166b43d31640c0208a9 +0 -0
  2130. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_dense_minimized-from-9486fb7c8a93b12c12a62166b43d31640c0208a9 +0 -0
  2131. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-0da59c0434eaf35e5a6b470fa9244bb79c72b000 +0 -0
  2132. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-18cfc246f2ddfc3dfc92b0c7893178c7cf65efa9 +0 -0
  2133. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-61fd8e3003bf9d99f6c1e5a8488727eefd234b98 +0 -0
  2134. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-a1b839d899ced76d5d7d0f78f9edb7a421505838 +0 -0
  2135. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-c383ae07ec5e191422eadc492117439011816570 +0 -0
  2136. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-d07703ceb94b10dcd9e4acb809f2051420449e2b +0 -0
  2137. data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-dbb8172d3984e7e7d03f4b5f8bb86ecd1460eff9 +0 -0
  2138. data/rust-vendor/regex-automata/tests/gen/README.md +0 -65
  2139. data/rust-vendor/regex-automata/tests/gen/dense/multi_pattern_v2_fwd.bigendian.dfa +0 -0
  2140. data/rust-vendor/regex-automata/tests/gen/dense/multi_pattern_v2_fwd.littleendian.dfa +0 -0
  2141. data/rust-vendor/regex-automata/tests/gen/dense/multi_pattern_v2_rev.bigendian.dfa +0 -0
  2142. data/rust-vendor/regex-automata/tests/gen/dense/multi_pattern_v2_rev.littleendian.dfa +0 -0
  2143. data/rust-vendor/regex-automata/tests/gen/sparse/multi_pattern_v2_fwd.bigendian.dfa +0 -0
  2144. data/rust-vendor/regex-automata/tests/gen/sparse/multi_pattern_v2_fwd.littleendian.dfa +0 -0
  2145. data/rust-vendor/regex-automata/tests/gen/sparse/multi_pattern_v2_rev.bigendian.dfa +0 -0
  2146. data/rust-vendor/regex-automata/tests/gen/sparse/multi_pattern_v2_rev.littleendian.dfa +0 -0
  2147. data/rust-vendor/regex-syntax/benches/bench.rs +0 -63
  2148. data/rust-vendor/regex-syntax/test +0 -30
  2149. data/rust-vendor/zerocopy/tests/ui-msrv/invalid-impls/invalid-impls.rs +0 -31
  2150. data/rust-vendor/zerocopy/tests/ui-msrv/invalid-impls/invalid-impls.stderr +0 -159
  2151. data/rust-vendor/zerocopy/tests/ui-nightly/invalid-impls/invalid-impls.rs +0 -31
  2152. data/rust-vendor/zerocopy/tests/ui-nightly/invalid-impls/invalid-impls.stderr +0 -139
  2153. data/rust-vendor/zerocopy/tests/ui-stable/invalid-impls/invalid-impls.rs +0 -31
  2154. data/rust-vendor/zerocopy/tests/ui-stable/invalid-impls/invalid-impls.stderr +0 -155
  2155. data/rust-vendor/zerocopy-derive/tests/ui-nightly/union_into_bytes_cfg/union_into_bytes_cfg.stderr +0 -22
  2156. data/rust-vendor/zerocopy-derive/tests/ui-stable/union_into_bytes_cfg/union_into_bytes_cfg.stderr +0 -22
  2157. /data/rust-vendor/{getrandom → getrandom-0.3.4}/src/backends/sanitizer.rs +0 -0
  2158. /data/rust-vendor/{getrandom → getrandom-0.3.4}/src/backends/wasi_p2.rs +0 -0
  2159. /data/rust-vendor/{getrandom → getrandom-0.3.4}/src/lazy.rs +0 -0
  2160. /data/rust-vendor/{getrandom → getrandom-0.3.4}/src/util_libc.rs +0 -0
  2161. /data/rust-vendor/{wit-bindgen → wit-bindgen-0.46.0}/src/rt/wit_bindgen_cabi.c +0 -0
  2162. /data/rust-vendor/{wit-bindgen → wit-bindgen-0.46.0}/src/rt/wit_bindgen_cabi.o +0 -0
  2163. /data/rust-vendor/zerocopy-derive/tests/ui-msrv/{union_into_bytes_cfg → cfgs}/union_into_bytes_cfg.rs +0 -0
  2164. /data/rust-vendor/zerocopy-derive/tests/ui-nightly/{union_into_bytes_cfg → cfgs}/union_into_bytes_cfg.rs +0 -0
  2165. /data/rust-vendor/zerocopy-derive/tests/ui-stable/{union_into_bytes_cfg → cfgs}/union_into_bytes_cfg.rs +0 -0
@@ -0,0 +1,3231 @@
1
+ //! Support for encoding a core wasm module into a component.
2
+ //!
3
+ //! This module, at a high level, is tasked with transforming a core wasm
4
+ //! module into a component. This will process the imports/exports of the core
5
+ //! wasm module and translate between the `wit-parser` AST and the component
6
+ //! model binary format, producing a final component which will import
7
+ //! `*.wit` defined interfaces and export `*.wit` defined interfaces as well
8
+ //! with everything wired up internally according to the canonical ABI and such.
9
+ //!
10
+ //! This doc block here is not currently 100% complete and doesn't cover the
11
+ //! full functionality of this module.
12
+ //!
13
+ //! # Adapter Modules
14
+ //!
15
+ //! One feature of this encoding process which is non-obvious is the support for
16
+ //! "adapter modules". The general idea here is that historical host API
17
+ //! definitions have been around for quite some time, such as
18
+ //! `wasi_snapshot_preview1`, but these host API definitions are not compatible
19
+ //! with the canonical ABI or component model exactly. These APIs, however, can
20
+ //! in most situations be roughly adapted to component-model equivalents. This
21
+ //! is where adapter modules come into play, they're converting from some
22
+ //! arbitrary API/ABI into a component-model using API.
23
+ //!
24
+ //! An adapter module is a separately compiled `*.wasm` blob which will export
25
+ //! functions matching the desired ABI (e.g. exporting functions matching the
26
+ //! `wasi_snapshot_preview1` ABI). The `*.wasm` blob will then import functions
27
+ //! in the canonical ABI and internally adapt the exported functions to the
28
+ //! imported functions. The encoding support in this module is what wires
29
+ //! everything up and makes sure that everything is imported and exported to the
30
+ //! right place. Adapter modules currently always use "indirect lowerings"
31
+ //! meaning that a shim module is created and provided as the imports to the
32
+ //! main core wasm module, and the shim module is "filled in" at a later time
33
+ //! during the instantiation process.
34
+ //!
35
+ //! Adapter modules are not intended to be general purpose and are currently
36
+ //! very restrictive, namely:
37
+ //!
38
+ //! * They must import a linear memory and not define their own linear memory
39
+ //! otherwise. In other words they import memory and cannot use multi-memory.
40
+ //! * They cannot define any `elem` or `data` segments since otherwise there's
41
+ //! no knowledge ahead-of-time of where their data or element segments could
42
+ //! go. This means things like no panics, no indirect calls, etc.
43
+ //! * If the adapter uses a shadow stack, the global that points to it must be a
44
+ //! mutable `i32` named `__stack_pointer`. This stack is automatically
45
+ //! allocated with an injected `allocate_stack` function that will either use
46
+ //! the main module's `cabi_realloc` export (if present) or `memory.grow`. It
47
+ //! allocates only 64KB of stack space, and there is no protection if that
48
+ //! overflows.
49
+ //! * If the adapter has a global, mutable `i32` named `allocation_state`, it
50
+ //! will be used to keep track of stack allocation status and avoid infinite
51
+ //! recursion if the main module's `cabi_realloc` function calls back into the
52
+ //! adapter. `allocate_stack` will check this global on entry; if it is zero,
53
+ //! it will set it to one, then allocate the stack, and finally set it to two.
54
+ //! If it is non-zero, `allocate_stack` will do nothing and return immediately
55
+ //! (because either the stack has already been allocated or is in the process
56
+ //! of being allocated). If the adapter does not have an `allocation_state`,
57
+ //! `allocate_stack` will use `memory.grow` to allocate the stack; it will
58
+ //! _not_ use the main module's `cabi_realloc` even if it's available.
59
+ //! * If the adapter imports a `cabi_realloc` function, and the main module
60
+ //! exports one, they'll be linked together via an alias. If the adapter
61
+ //! imports such a function but the main module does _not_ export one, we'll
62
+ //! synthesize one based on `memory.grow` (which will trap for any size other
63
+ //! than 64KB). Note that the main module's `cabi_realloc` function may call
64
+ //! back into the adapter before the shadow stack has been allocated. In this
65
+ //! case (when `allocation_state` is zero or one), the adapter should return
66
+ //! whatever dummy value(s) it can immediately without touching the stack.
67
+ //!
68
+ //! This means that adapter modules are not meant to be written by everyone.
69
+ //! It's assumed that these will be relatively few and far between yet still a
70
+ //! crucial part of the transition process from to the component model since
71
+ //! otherwise there's no way to run a `wasi_snapshot_preview1` module within the
72
+ //! component model.
73
+
74
+ use crate::StringEncoding;
75
+ use crate::metadata::{self, Bindgen, ModuleMetadata};
76
+ use crate::validation::{
77
+ Export, ExportMap, Import, ImportInstance, ImportMap, PayloadInfo, PayloadType,
78
+ };
79
+ use anyhow::{Context, Result, anyhow, bail};
80
+ use indexmap::{IndexMap, IndexSet};
81
+ use std::borrow::Cow;
82
+ use std::collections::HashMap;
83
+ use std::hash::Hash;
84
+ use std::mem;
85
+ use wasm_encoder::*;
86
+ use wasmparser::{Validator, WasmFeatures};
87
+ use wit_parser::{
88
+ Function, FunctionKind, InterfaceId, LiveTypes, Resolve, Stability, Type, TypeDefKind, TypeId,
89
+ TypeOwner, WorldItem, WorldKey,
90
+ abi::{AbiVariant, WasmSignature, WasmType},
91
+ };
92
+
93
+ const INDIRECT_TABLE_NAME: &str = "$imports";
94
+
95
+ mod wit;
96
+ pub use wit::{encode, encode_world};
97
+
98
+ mod types;
99
+ use types::{InstanceTypeEncoder, RootTypeEncoder, TypeEncodingMaps, ValtypeEncoder};
100
+ mod world;
101
+ use world::{ComponentWorld, ImportedInterface, Lowering};
102
+
103
+ mod dedupe;
104
+ pub(crate) use dedupe::ModuleImportMap;
105
+ use wasm_metadata::AddMetadataField;
106
+
107
+ fn to_val_type(ty: &WasmType) -> ValType {
108
+ match ty {
109
+ WasmType::I32 => ValType::I32,
110
+ WasmType::I64 => ValType::I64,
111
+ WasmType::F32 => ValType::F32,
112
+ WasmType::F64 => ValType::F64,
113
+ WasmType::Pointer => ValType::I32,
114
+ WasmType::PointerOrI64 => ValType::I64,
115
+ WasmType::Length => ValType::I32,
116
+ }
117
+ }
118
+
119
+ bitflags::bitflags! {
120
+ /// Options in the `canon lower` or `canon lift` required for a particular
121
+ /// function.
122
+ #[derive(Copy, Clone, Debug)]
123
+ pub struct RequiredOptions: u8 {
124
+ /// A memory must be specified, typically the "main module"'s memory
125
+ /// export.
126
+ const MEMORY = 1 << 0;
127
+ /// A `realloc` function must be specified, typically named
128
+ /// `cabi_realloc`.
129
+ const REALLOC = 1 << 1;
130
+ /// A string encoding must be specified, which is always utf-8 for now
131
+ /// today.
132
+ const STRING_ENCODING = 1 << 2;
133
+ const ASYNC = 1 << 3;
134
+ }
135
+ }
136
+
137
+ impl RequiredOptions {
138
+ fn for_import(resolve: &Resolve, func: &Function, abi: AbiVariant) -> RequiredOptions {
139
+ let sig = resolve.wasm_signature(abi, func);
140
+ let mut ret = RequiredOptions::empty();
141
+ // Lift the params and lower the results for imports
142
+ ret.add_lift(TypeContents::for_types(
143
+ resolve,
144
+ func.params.iter().map(|(_, t)| t),
145
+ ));
146
+ ret.add_lower(TypeContents::for_types(resolve, &func.result));
147
+
148
+ // If anything is indirect then `memory` will be required to read the
149
+ // indirect values.
150
+ if sig.retptr || sig.indirect_params {
151
+ ret |= RequiredOptions::MEMORY;
152
+ }
153
+ if abi == AbiVariant::GuestImportAsync {
154
+ ret |= RequiredOptions::ASYNC;
155
+ }
156
+ ret
157
+ }
158
+
159
+ fn for_export(resolve: &Resolve, func: &Function, abi: AbiVariant) -> RequiredOptions {
160
+ let sig = resolve.wasm_signature(abi, func);
161
+ let mut ret = RequiredOptions::empty();
162
+ // Lower the params and lift the results for exports
163
+ ret.add_lower(TypeContents::for_types(
164
+ resolve,
165
+ func.params.iter().map(|(_, t)| t),
166
+ ));
167
+ ret.add_lift(TypeContents::for_types(resolve, &func.result));
168
+
169
+ // If anything is indirect then `memory` will be required to read the
170
+ // indirect values, but if the arguments are indirect then `realloc` is
171
+ // additionally required to allocate space for the parameters.
172
+ if sig.retptr || sig.indirect_params {
173
+ ret |= RequiredOptions::MEMORY;
174
+ if sig.indirect_params {
175
+ ret |= RequiredOptions::REALLOC;
176
+ }
177
+ }
178
+ if let AbiVariant::GuestExportAsync | AbiVariant::GuestExportAsyncStackful = abi {
179
+ ret |= RequiredOptions::ASYNC;
180
+ ret |= task_return_options_and_type(resolve, func.result).0;
181
+ }
182
+ ret
183
+ }
184
+
185
+ fn add_lower(&mut self, types: TypeContents) {
186
+ // If lists/strings are lowered into wasm then memory is required as
187
+ // usual but `realloc` is also required to allow the external caller to
188
+ // allocate space in the destination for the list/string.
189
+ if types.contains(TypeContents::NEEDS_MEMORY) {
190
+ *self |= RequiredOptions::MEMORY | RequiredOptions::REALLOC;
191
+ }
192
+ if types.contains(TypeContents::STRING) {
193
+ *self |= RequiredOptions::MEMORY
194
+ | RequiredOptions::STRING_ENCODING
195
+ | RequiredOptions::REALLOC;
196
+ }
197
+ }
198
+
199
+ fn add_lift(&mut self, types: TypeContents) {
200
+ // Unlike for `lower` when lifting a string/list all that's needed is
201
+ // memory, since the string/list already resides in memory `realloc`
202
+ // isn't needed.
203
+ if types.contains(TypeContents::NEEDS_MEMORY) {
204
+ *self |= RequiredOptions::MEMORY;
205
+ }
206
+ if types.contains(TypeContents::STRING) {
207
+ *self |= RequiredOptions::MEMORY | RequiredOptions::STRING_ENCODING;
208
+ }
209
+ }
210
+
211
+ fn into_iter(
212
+ self,
213
+ encoding: StringEncoding,
214
+ memory_index: Option<u32>,
215
+ realloc_index: Option<u32>,
216
+ ) -> Result<impl ExactSizeIterator<Item = CanonicalOption>> {
217
+ #[derive(Default)]
218
+ struct Iter {
219
+ options: [Option<CanonicalOption>; 5],
220
+ current: usize,
221
+ count: usize,
222
+ }
223
+
224
+ impl Iter {
225
+ fn push(&mut self, option: CanonicalOption) {
226
+ assert!(self.count < self.options.len());
227
+ self.options[self.count] = Some(option);
228
+ self.count += 1;
229
+ }
230
+ }
231
+
232
+ impl Iterator for Iter {
233
+ type Item = CanonicalOption;
234
+
235
+ fn next(&mut self) -> Option<Self::Item> {
236
+ if self.current == self.count {
237
+ return None;
238
+ }
239
+ let option = self.options[self.current];
240
+ self.current += 1;
241
+ option
242
+ }
243
+
244
+ fn size_hint(&self) -> (usize, Option<usize>) {
245
+ (self.count - self.current, Some(self.count - self.current))
246
+ }
247
+ }
248
+
249
+ impl ExactSizeIterator for Iter {}
250
+
251
+ let mut iter = Iter::default();
252
+
253
+ if self.contains(RequiredOptions::MEMORY) {
254
+ iter.push(CanonicalOption::Memory(memory_index.ok_or_else(|| {
255
+ anyhow!("module does not export a memory named `memory`")
256
+ })?));
257
+ }
258
+
259
+ if self.contains(RequiredOptions::REALLOC) {
260
+ iter.push(CanonicalOption::Realloc(realloc_index.ok_or_else(
261
+ || anyhow!("module does not export a function named `cabi_realloc`"),
262
+ )?));
263
+ }
264
+
265
+ if self.contains(RequiredOptions::STRING_ENCODING) {
266
+ iter.push(encoding.into());
267
+ }
268
+
269
+ if self.contains(RequiredOptions::ASYNC) {
270
+ iter.push(CanonicalOption::Async);
271
+ }
272
+
273
+ Ok(iter)
274
+ }
275
+ }
276
+
277
+ bitflags::bitflags! {
278
+ /// Flags about what kinds of types are present within the recursive
279
+ /// structure of a type.
280
+ struct TypeContents: u8 {
281
+ const STRING = 1 << 0;
282
+ const NEEDS_MEMORY = 1 << 1;
283
+ }
284
+ }
285
+
286
+ impl TypeContents {
287
+ fn for_types<'a>(resolve: &Resolve, types: impl IntoIterator<Item = &'a Type>) -> Self {
288
+ let mut cur = TypeContents::empty();
289
+ for ty in types {
290
+ cur |= Self::for_type(resolve, ty);
291
+ }
292
+ cur
293
+ }
294
+
295
+ fn for_optional_types<'a>(
296
+ resolve: &Resolve,
297
+ types: impl Iterator<Item = Option<&'a Type>>,
298
+ ) -> Self {
299
+ Self::for_types(resolve, types.flatten())
300
+ }
301
+
302
+ fn for_optional_type(resolve: &Resolve, ty: Option<&Type>) -> Self {
303
+ match ty {
304
+ Some(ty) => Self::for_type(resolve, ty),
305
+ None => Self::empty(),
306
+ }
307
+ }
308
+
309
+ fn for_type(resolve: &Resolve, ty: &Type) -> Self {
310
+ match ty {
311
+ Type::Id(id) => match &resolve.types[*id].kind {
312
+ TypeDefKind::Handle(h) => match h {
313
+ wit_parser::Handle::Own(_) => Self::empty(),
314
+ wit_parser::Handle::Borrow(_) => Self::empty(),
315
+ },
316
+ TypeDefKind::Resource => Self::empty(),
317
+ TypeDefKind::Record(r) => Self::for_types(resolve, r.fields.iter().map(|f| &f.ty)),
318
+ TypeDefKind::Tuple(t) => Self::for_types(resolve, t.types.iter()),
319
+ TypeDefKind::Flags(_) => Self::empty(),
320
+ TypeDefKind::Option(t) => Self::for_type(resolve, t),
321
+ TypeDefKind::Result(r) => {
322
+ Self::for_optional_type(resolve, r.ok.as_ref())
323
+ | Self::for_optional_type(resolve, r.err.as_ref())
324
+ }
325
+ TypeDefKind::Variant(v) => {
326
+ Self::for_optional_types(resolve, v.cases.iter().map(|c| c.ty.as_ref()))
327
+ }
328
+ TypeDefKind::Enum(_) => Self::empty(),
329
+ TypeDefKind::List(t) => Self::for_type(resolve, t) | Self::NEEDS_MEMORY,
330
+ TypeDefKind::Map(k, v) => {
331
+ Self::for_type(resolve, k) | Self::for_type(resolve, v) | Self::NEEDS_MEMORY
332
+ }
333
+ TypeDefKind::FixedSizeList(t, _elements) => Self::for_type(resolve, t),
334
+ TypeDefKind::Type(t) => Self::for_type(resolve, t),
335
+ TypeDefKind::Future(_) => Self::empty(),
336
+ TypeDefKind::Stream(_) => Self::empty(),
337
+ TypeDefKind::Unknown => unreachable!(),
338
+ },
339
+ Type::String => Self::STRING,
340
+ _ => Self::empty(),
341
+ }
342
+ }
343
+ }
344
+
345
+ /// State relating to encoding a component.
346
+ pub struct EncodingState<'a> {
347
+ /// The component being encoded.
348
+ component: ComponentBuilder,
349
+ /// The index into the core module index space for the inner core module.
350
+ ///
351
+ /// If `None`, the core module has not been encoded.
352
+ module_index: Option<u32>,
353
+ /// The index into the core instance index space for the inner core module.
354
+ ///
355
+ /// If `None`, the core module has not been instantiated.
356
+ instance_index: Option<u32>,
357
+ /// The index in the core memory index space for the exported memory.
358
+ ///
359
+ /// If `None`, then the memory has not yet been aliased.
360
+ memory_index: Option<u32>,
361
+ /// The index of the shim instance used for lowering imports into the core instance.
362
+ ///
363
+ /// If `None`, then the shim instance how not yet been encoded.
364
+ shim_instance_index: Option<u32>,
365
+ /// The index of the fixups module to instantiate to fill in the lowered imports.
366
+ ///
367
+ /// If `None`, then a fixup module has not yet been encoded.
368
+ fixups_module_index: Option<u32>,
369
+
370
+ /// A map of named adapter modules and the index that the module was defined
371
+ /// at.
372
+ adapter_modules: IndexMap<&'a str, u32>,
373
+ /// A map of adapter module instances and the index of their instance.
374
+ adapter_instances: IndexMap<&'a str, u32>,
375
+
376
+ /// Imported instances and what index they were imported as.
377
+ imported_instances: IndexMap<InterfaceId, u32>,
378
+ imported_funcs: IndexMap<String, u32>,
379
+ exported_instances: IndexMap<InterfaceId, u32>,
380
+
381
+ /// Maps used when translating types to the component model binary format.
382
+ /// Note that imports and exports are stored in separate maps since they
383
+ /// need fresh hierarchies of types in case the same interface is both
384
+ /// imported and exported.
385
+ import_type_encoding_maps: TypeEncodingMaps<'a>,
386
+ export_type_encoding_maps: TypeEncodingMaps<'a>,
387
+
388
+ /// Cache of items that have been aliased from core instances.
389
+ ///
390
+ /// This is a helper to reduce the number of aliases created by ensuring
391
+ /// that repeated requests for the same item return the same index of an
392
+ /// original `core alias` item.
393
+ aliased_core_items: HashMap<(u32, String), u32>,
394
+
395
+ /// Metadata about the world inferred from the input to `ComponentEncoder`.
396
+ info: &'a ComponentWorld<'a>,
397
+ }
398
+
399
+ impl<'a> EncodingState<'a> {
400
+ fn encode_core_modules(&mut self) {
401
+ assert!(self.module_index.is_none());
402
+ let idx = self
403
+ .component
404
+ .core_module_raw(Some("main"), &self.info.encoder.module);
405
+ self.module_index = Some(idx);
406
+
407
+ for (name, adapter) in self.info.adapters.iter() {
408
+ let debug_name = if adapter.library_info.is_some() {
409
+ name.to_string()
410
+ } else {
411
+ format!("wit-component:adapter:{name}")
412
+ };
413
+ let idx = if self.info.encoder.debug_names {
414
+ let mut add_meta = wasm_metadata::AddMetadata::default();
415
+ add_meta.name = AddMetadataField::Set(debug_name.clone());
416
+ let wasm = add_meta
417
+ .to_wasm(&adapter.wasm)
418
+ .expect("core wasm can get name added");
419
+ self.component.core_module_raw(Some(&debug_name), &wasm)
420
+ } else {
421
+ self.component
422
+ .core_module_raw(Some(&debug_name), &adapter.wasm)
423
+ };
424
+ let prev = self.adapter_modules.insert(name, idx);
425
+ assert!(prev.is_none());
426
+ }
427
+ }
428
+
429
+ fn root_import_type_encoder(
430
+ &mut self,
431
+ interface: Option<InterfaceId>,
432
+ ) -> RootTypeEncoder<'_, 'a> {
433
+ RootTypeEncoder {
434
+ state: self,
435
+ interface,
436
+ import_types: true,
437
+ }
438
+ }
439
+
440
+ fn root_export_type_encoder(
441
+ &mut self,
442
+ interface: Option<InterfaceId>,
443
+ ) -> RootTypeEncoder<'_, 'a> {
444
+ RootTypeEncoder {
445
+ state: self,
446
+ interface,
447
+ import_types: false,
448
+ }
449
+ }
450
+
451
+ fn instance_type_encoder(&mut self, interface: InterfaceId) -> InstanceTypeEncoder<'_, 'a> {
452
+ InstanceTypeEncoder {
453
+ state: self,
454
+ interface,
455
+ type_encoding_maps: Default::default(),
456
+ ty: Default::default(),
457
+ }
458
+ }
459
+
460
+ fn encode_imports(&mut self, name_map: &HashMap<String, String>) -> Result<()> {
461
+ let mut has_funcs = false;
462
+ for (name, info) in self.info.import_map.iter() {
463
+ match name {
464
+ Some(name) => {
465
+ self.encode_interface_import(name_map.get(name).unwrap_or(name), info)?
466
+ }
467
+ None => has_funcs = true,
468
+ }
469
+ }
470
+
471
+ let resolve = &self.info.encoder.metadata.resolve;
472
+ let world = &resolve.worlds[self.info.encoder.metadata.world];
473
+
474
+ // FIXME: ideally this would use the liveness analysis from
475
+ // world-building to only encode live types, not all type in a world.
476
+ for (_name, item) in world.imports.iter() {
477
+ if let WorldItem::Type(ty) = item {
478
+ self.root_import_type_encoder(None)
479
+ .encode_valtype(resolve, &Type::Id(*ty))?;
480
+ }
481
+ }
482
+
483
+ if has_funcs {
484
+ let info = &self.info.import_map[&None];
485
+ self.encode_root_import_funcs(info)?;
486
+ }
487
+ Ok(())
488
+ }
489
+
490
+ fn encode_interface_import(&mut self, name: &str, info: &ImportedInterface) -> Result<()> {
491
+ let resolve = &self.info.encoder.metadata.resolve;
492
+ let interface_id = info.interface.as_ref().unwrap();
493
+ let interface_id = *interface_id;
494
+ let interface = &resolve.interfaces[interface_id];
495
+ log::trace!("encoding imports for `{name}` as {interface_id:?}");
496
+ let mut encoder = self.instance_type_encoder(interface_id);
497
+
498
+ // First encode all type information
499
+ if let Some(live) = encoder.state.info.live_type_imports.get(&interface_id) {
500
+ for ty in live {
501
+ log::trace!(
502
+ "encoding extra type {ty:?} name={:?}",
503
+ resolve.types[*ty].name
504
+ );
505
+ encoder.encode_valtype(resolve, &Type::Id(*ty))?;
506
+ }
507
+ }
508
+
509
+ // Next encode all required functions from this imported interface
510
+ // into the instance type.
511
+ for (_, func) in interface.functions.iter() {
512
+ if !(info
513
+ .lowerings
514
+ .contains_key(&(func.name.clone(), AbiVariant::GuestImport))
515
+ || info
516
+ .lowerings
517
+ .contains_key(&(func.name.clone(), AbiVariant::GuestImportAsync)))
518
+ {
519
+ continue;
520
+ }
521
+ log::trace!("encoding function type for `{}`", func.name);
522
+ let idx = encoder.encode_func_type(resolve, func)?;
523
+
524
+ encoder.ty.export(&func.name, ComponentTypeRef::Func(idx));
525
+ }
526
+
527
+ let ty = encoder.ty;
528
+ // Don't encode empty instance types since they're not
529
+ // meaningful to the runtime of the component anyway.
530
+ if ty.is_empty() {
531
+ return Ok(());
532
+ }
533
+ let instance_type_idx = self
534
+ .component
535
+ .type_instance(Some(&format!("ty-{name}")), &ty);
536
+ let instance_idx = self
537
+ .component
538
+ .import(name, ComponentTypeRef::Instance(instance_type_idx));
539
+ let prev = self.imported_instances.insert(interface_id, instance_idx);
540
+ assert!(prev.is_none());
541
+ Ok(())
542
+ }
543
+
544
+ fn encode_root_import_funcs(&mut self, info: &ImportedInterface) -> Result<()> {
545
+ let resolve = &self.info.encoder.metadata.resolve;
546
+ let world = self.info.encoder.metadata.world;
547
+ for (name, item) in resolve.worlds[world].imports.iter() {
548
+ let func = match item {
549
+ WorldItem::Function(f) => f,
550
+ WorldItem::Interface { .. } | WorldItem::Type(_) => continue,
551
+ };
552
+ let name = resolve.name_world_key(name);
553
+ if !(info
554
+ .lowerings
555
+ .contains_key(&(name.clone(), AbiVariant::GuestImport))
556
+ || info
557
+ .lowerings
558
+ .contains_key(&(name.clone(), AbiVariant::GuestImportAsync)))
559
+ {
560
+ continue;
561
+ }
562
+ log::trace!("encoding function type for `{}`", func.name);
563
+ let idx = self
564
+ .root_import_type_encoder(None)
565
+ .encode_func_type(resolve, func)?;
566
+ let func_idx = self.component.import(&name, ComponentTypeRef::Func(idx));
567
+ let prev = self.imported_funcs.insert(name, func_idx);
568
+ assert!(prev.is_none());
569
+ }
570
+ Ok(())
571
+ }
572
+
573
+ fn alias_imported_type(&mut self, interface: InterfaceId, id: TypeId) -> u32 {
574
+ let ty = &self.info.encoder.metadata.resolve.types[id];
575
+ let name = ty.name.as_ref().expect("type must have a name");
576
+ let instance = self.imported_instances[&interface];
577
+ self.component
578
+ .alias_export(instance, name, ComponentExportKind::Type)
579
+ }
580
+
581
+ fn alias_exported_type(&mut self, interface: InterfaceId, id: TypeId) -> u32 {
582
+ let ty = &self.info.encoder.metadata.resolve.types[id];
583
+ let name = ty.name.as_ref().expect("type must have a name");
584
+ let instance = self.exported_instances[&interface];
585
+ self.component
586
+ .alias_export(instance, name, ComponentExportKind::Type)
587
+ }
588
+
589
+ fn encode_core_instantiation(&mut self) -> Result<()> {
590
+ // Encode a shim instantiation if needed
591
+ let shims = self.encode_shim_instantiation()?;
592
+
593
+ // Next declare any types needed for imported intrinsics. This
594
+ // populates `export_type_map` and will additionally be used for
595
+ // imports to modules instantiated below.
596
+ self.declare_types_for_imported_intrinsics(&shims)?;
597
+
598
+ // Next instantiate the main module. This provides the linear memory to
599
+ // use for all future adapters and enables creating indirect lowerings
600
+ // at the end.
601
+ self.instantiate_main_module(&shims)?;
602
+
603
+ // Separate the adapters according which should be instantiated before
604
+ // and after indirect lowerings are encoded.
605
+ let (before, after) = self
606
+ .info
607
+ .adapters
608
+ .iter()
609
+ .partition::<Vec<_>, _>(|(_, adapter)| {
610
+ !matches!(
611
+ adapter.library_info,
612
+ Some(LibraryInfo {
613
+ instantiate_after_shims: true,
614
+ ..
615
+ })
616
+ )
617
+ });
618
+
619
+ for (name, _adapter) in before {
620
+ self.instantiate_adapter_module(&shims, name)?;
621
+ }
622
+
623
+ // With all the relevant core wasm instances in play now the original shim
624
+ // module, if present, can be filled in with lowerings/adapters/etc.
625
+ self.encode_indirect_lowerings(&shims)?;
626
+
627
+ for (name, _adapter) in after {
628
+ self.instantiate_adapter_module(&shims, name)?;
629
+ }
630
+
631
+ self.encode_initialize_with_start()?;
632
+
633
+ Ok(())
634
+ }
635
+
636
+ fn lookup_resource_index(&mut self, id: TypeId) -> u32 {
637
+ let resolve = &self.info.encoder.metadata.resolve;
638
+ let ty = &resolve.types[id];
639
+ match ty.owner {
640
+ // If this resource is owned by a world then it's a top-level
641
+ // resource which means it must have already been translated so
642
+ // it's available for lookup in `import_type_map`.
643
+ TypeOwner::World(_) => self.import_type_encoding_maps.id_to_index[&id],
644
+ TypeOwner::Interface(i) => {
645
+ let instance = self.imported_instances[&i];
646
+ let name = ty.name.as_ref().expect("resources must be named");
647
+ self.component
648
+ .alias_export(instance, name, ComponentExportKind::Type)
649
+ }
650
+ TypeOwner::None => panic!("resources must have an owner"),
651
+ }
652
+ }
653
+
654
+ fn encode_exports(&mut self, module: CustomModule) -> Result<()> {
655
+ let resolve = &self.info.encoder.metadata.resolve;
656
+ let exports = match module {
657
+ CustomModule::Main => &self.info.encoder.main_module_exports,
658
+ CustomModule::Adapter(name) => &self.info.encoder.adapters[name].required_exports,
659
+ };
660
+
661
+ if exports.is_empty() {
662
+ return Ok(());
663
+ }
664
+
665
+ let mut interface_func_core_names = IndexMap::new();
666
+ let mut world_func_core_names = IndexMap::new();
667
+ for (core_name, export) in self.info.exports_for(module).iter() {
668
+ match export {
669
+ Export::WorldFunc(_, name, _) => {
670
+ let prev = world_func_core_names.insert(name, core_name);
671
+ assert!(prev.is_none());
672
+ }
673
+ Export::InterfaceFunc(_, id, name, _) => {
674
+ let prev = interface_func_core_names
675
+ .entry(id)
676
+ .or_insert(IndexMap::new())
677
+ .insert(name.as_str(), core_name);
678
+ assert!(prev.is_none());
679
+ }
680
+ Export::WorldFuncCallback(..)
681
+ | Export::InterfaceFuncCallback(..)
682
+ | Export::WorldFuncPostReturn(..)
683
+ | Export::InterfaceFuncPostReturn(..)
684
+ | Export::ResourceDtor(..)
685
+ | Export::Memory
686
+ | Export::GeneralPurposeRealloc
687
+ | Export::GeneralPurposeExportRealloc
688
+ | Export::GeneralPurposeImportRealloc
689
+ | Export::Initialize
690
+ | Export::ReallocForAdapter
691
+ | Export::IndirectFunctionTable => continue,
692
+ }
693
+ }
694
+
695
+ let world = &resolve.worlds[self.info.encoder.metadata.world];
696
+
697
+ for export_name in exports {
698
+ let export_string = resolve.name_world_key(export_name);
699
+ match &world.exports[export_name] {
700
+ WorldItem::Function(func) => {
701
+ let ty = self
702
+ .root_import_type_encoder(None)
703
+ .encode_func_type(resolve, func)?;
704
+ let core_name = world_func_core_names[&func.name];
705
+ let idx = self.encode_lift(module, &core_name, export_name, func, ty)?;
706
+ self.component
707
+ .export(&export_string, ComponentExportKind::Func, idx, None);
708
+ }
709
+ WorldItem::Interface { id, .. } => {
710
+ let core_names = interface_func_core_names.get(id);
711
+ self.encode_interface_export(
712
+ &export_string,
713
+ module,
714
+ export_name,
715
+ *id,
716
+ core_names,
717
+ )?;
718
+ }
719
+ WorldItem::Type(_) => unreachable!(),
720
+ }
721
+ }
722
+
723
+ Ok(())
724
+ }
725
+
726
+ fn encode_interface_export(
727
+ &mut self,
728
+ export_name: &str,
729
+ module: CustomModule<'_>,
730
+ key: &WorldKey,
731
+ export: InterfaceId,
732
+ interface_func_core_names: Option<&IndexMap<&str, &str>>,
733
+ ) -> Result<()> {
734
+ log::trace!("encode interface export `{export_name}`");
735
+ let resolve = &self.info.encoder.metadata.resolve;
736
+
737
+ // First execute a `canon lift` for all the functions in this interface
738
+ // from the core wasm export. This requires type information but notably
739
+ // not exported type information since we don't want to export this
740
+ // interface's types from the root of the component. Each lifted
741
+ // function is saved off into an `imports` array to get imported into
742
+ // the nested component synthesized below.
743
+ let mut imports = Vec::new();
744
+ let mut root = self.root_export_type_encoder(Some(export));
745
+ for (_, func) in &resolve.interfaces[export].functions {
746
+ let core_name = interface_func_core_names.unwrap()[func.name.as_str()];
747
+ let ty = root.encode_func_type(resolve, func)?;
748
+ let func_index = root.state.encode_lift(module, &core_name, key, func, ty)?;
749
+ imports.push((
750
+ import_func_name(func),
751
+ ComponentExportKind::Func,
752
+ func_index,
753
+ ));
754
+ }
755
+
756
+ // Next a nested component is created which will import the functions
757
+ // above and then reexport them. The purpose of them is to "re-type" the
758
+ // functions through type ascription on each `func` item.
759
+ let mut nested = NestedComponentTypeEncoder {
760
+ component: ComponentBuilder::default(),
761
+ type_encoding_maps: Default::default(),
762
+ export_types: false,
763
+ interface: export,
764
+ state: self,
765
+ imports: IndexMap::new(),
766
+ };
767
+
768
+ // Import all transitively-referenced types from other interfaces into
769
+ // this component. This temporarily switches the `interface` listed to
770
+ // the interface of the referred-to-type to generate the import. After
771
+ // this loop `interface` is rewritten to `export`.
772
+ //
773
+ // Each component is a standalone "island" so the necessary type
774
+ // information needs to be rebuilt within this component. This ensures
775
+ // that we're able to build a valid component and additionally connect
776
+ // all the type information to the outer context.
777
+ let mut types_to_import = LiveTypes::default();
778
+ types_to_import.add_interface(resolve, export);
779
+ let exports_used = &nested.state.info.exports_used[&export];
780
+ for ty in types_to_import.iter() {
781
+ if let TypeOwner::Interface(owner) = resolve.types[ty].owner {
782
+ if owner == export {
783
+ // Here this deals with the current exported interface which
784
+ // is handled below.
785
+ continue;
786
+ }
787
+
788
+ // Ensure that `self` has encoded this type before. If so this
789
+ // is a noop but otherwise it generates the type here.
790
+ let mut encoder = if exports_used.contains(&owner) {
791
+ nested.state.root_export_type_encoder(Some(export))
792
+ } else {
793
+ nested.state.root_import_type_encoder(Some(export))
794
+ };
795
+ encoder.encode_valtype(resolve, &Type::Id(ty))?;
796
+
797
+ // Next generate the same type but this time within the
798
+ // component itself. The type generated above (or prior) will be
799
+ // used to satisfy this type import.
800
+ nested.interface = owner;
801
+ nested.encode_valtype(resolve, &Type::Id(ty))?;
802
+ }
803
+ }
804
+ nested.interface = export;
805
+
806
+ // Record the map of types imported to their index at where they were
807
+ // imported. This is used after imports are encoded as exported types
808
+ // will refer to these.
809
+ let imported_type_maps = nested.type_encoding_maps.clone();
810
+
811
+ // Handle resource types for this instance specially, namely importing
812
+ // them into the nested component. This models how the resource is
813
+ // imported from its definition in the outer component to get reexported
814
+ // internally. This chiefly avoids creating a second resource which is
815
+ // not desired in this situation.
816
+ let mut resources = HashMap::new();
817
+ for (_name, ty) in resolve.interfaces[export].types.iter() {
818
+ if !matches!(resolve.types[*ty].kind, TypeDefKind::Resource) {
819
+ continue;
820
+ }
821
+ let idx = match nested.encode_valtype(resolve, &Type::Id(*ty))? {
822
+ ComponentValType::Type(idx) => idx,
823
+ _ => unreachable!(),
824
+ };
825
+ resources.insert(*ty, idx);
826
+ }
827
+
828
+ // Next import each function of this interface. This will end up
829
+ // defining local types as necessary or using the types as imported
830
+ // above.
831
+ for (_, func) in resolve.interfaces[export].functions.iter() {
832
+ let ty = nested.encode_func_type(resolve, func)?;
833
+ nested
834
+ .component
835
+ .import(&import_func_name(func), ComponentTypeRef::Func(ty));
836
+ }
837
+
838
+ // Swap the `nested.type_map` which was previously from `TypeId` to
839
+ // `u32` to instead being from `u32` to `TypeId`. This reverse map is
840
+ // then used in conjunction with `self.type_map` to satisfy all type
841
+ // imports of the nested component generated. The type import's index in
842
+ // the inner component is translated to a `TypeId` via `reverse_map`
843
+ // which is then translated back to our own index space via `type_map`.
844
+ let reverse_map = nested
845
+ .type_encoding_maps
846
+ .id_to_index
847
+ .drain()
848
+ .map(|p| (p.1, p.0))
849
+ .collect::<HashMap<_, _>>();
850
+ nested.type_encoding_maps.def_to_index.clear();
851
+ for (name, idx) in nested.imports.drain(..) {
852
+ let id = reverse_map[&idx];
853
+ let owner = match resolve.types[id].owner {
854
+ TypeOwner::Interface(id) => id,
855
+ _ => unreachable!(),
856
+ };
857
+ let idx = if owner == export || exports_used.contains(&owner) {
858
+ log::trace!("consulting exports for {id:?}");
859
+ nested.state.export_type_encoding_maps.id_to_index[&id]
860
+ } else {
861
+ log::trace!("consulting imports for {id:?}");
862
+ nested.state.import_type_encoding_maps.id_to_index[&id]
863
+ };
864
+ imports.push((name, ComponentExportKind::Type, idx))
865
+ }
866
+
867
+ // Before encoding exports reset the type map to what all was imported
868
+ // from foreign interfaces. This will enable any encoded types below to
869
+ // refer to imports which, after type substitution, will point to the
870
+ // correct type in the outer component context.
871
+ nested.type_encoding_maps = imported_type_maps;
872
+
873
+ // Next the component reexports all of its imports, but notably uses the
874
+ // type ascription feature to change the type of the function. Note that
875
+ // no structural change is happening to the types here but instead types
876
+ // are getting proper names and such now that this nested component is a
877
+ // new type index space. Hence the `export_types = true` flag here which
878
+ // flows through the type encoding and when types are emitted.
879
+ nested.export_types = true;
880
+ nested.type_encoding_maps.func_type_map.clear();
881
+
882
+ // To start off all type information is encoded. This will be used by
883
+ // functions below but notably this also has special handling for
884
+ // resources. Resources reexport their imported resource type under
885
+ // the final name which achieves the desired goal of threading through
886
+ // the original resource without creating a new one.
887
+ for (_, id) in resolve.interfaces[export].types.iter() {
888
+ let ty = &resolve.types[*id];
889
+ match ty.kind {
890
+ TypeDefKind::Resource => {
891
+ let idx = nested.component.export(
892
+ ty.name.as_ref().expect("resources must be named"),
893
+ ComponentExportKind::Type,
894
+ resources[id],
895
+ None,
896
+ );
897
+ nested.type_encoding_maps.id_to_index.insert(*id, idx);
898
+ }
899
+ _ => {
900
+ nested.encode_valtype(resolve, &Type::Id(*id))?;
901
+ }
902
+ }
903
+ }
904
+
905
+ for (i, (_, func)) in resolve.interfaces[export].functions.iter().enumerate() {
906
+ let ty = nested.encode_func_type(resolve, func)?;
907
+ nested.component.export(
908
+ &func.name,
909
+ ComponentExportKind::Func,
910
+ i as u32,
911
+ Some(ComponentTypeRef::Func(ty)),
912
+ );
913
+ }
914
+
915
+ // Embed the component within our component and then instantiate it with
916
+ // the lifted functions. That final instance is then exported under the
917
+ // appropriate name as the final typed export of this component.
918
+ let component = nested.component;
919
+ let component_index = self
920
+ .component
921
+ .component(Some(&format!("{export_name}-shim-component")), component);
922
+ let instance_index = self.component.instantiate(
923
+ Some(&format!("{export_name}-shim-instance")),
924
+ component_index,
925
+ imports,
926
+ );
927
+ let idx = self.component.export(
928
+ export_name,
929
+ ComponentExportKind::Instance,
930
+ instance_index,
931
+ None,
932
+ );
933
+ let prev = self.exported_instances.insert(export, idx);
934
+ assert!(prev.is_none());
935
+
936
+ // After everything is all said and done remove all the type information
937
+ // about type exports of this interface. Any entries in the map
938
+ // currently were used to create the instance above but aren't the
939
+ // actual copy of the exported type since that comes from the exported
940
+ // instance itself. Entries will be re-inserted into this map as
941
+ // necessary via aliases from the exported instance which is the new
942
+ // source of truth for all these types.
943
+ for (_name, id) in resolve.interfaces[export].types.iter() {
944
+ self.export_type_encoding_maps.id_to_index.remove(id);
945
+ self.export_type_encoding_maps
946
+ .def_to_index
947
+ .remove(&resolve.types[*id].kind);
948
+ }
949
+
950
+ return Ok(());
951
+
952
+ struct NestedComponentTypeEncoder<'state, 'a> {
953
+ component: ComponentBuilder,
954
+ type_encoding_maps: TypeEncodingMaps<'a>,
955
+ export_types: bool,
956
+ interface: InterfaceId,
957
+ state: &'state mut EncodingState<'a>,
958
+ imports: IndexMap<String, u32>,
959
+ }
960
+
961
+ impl<'a> ValtypeEncoder<'a> for NestedComponentTypeEncoder<'_, 'a> {
962
+ fn defined_type(&mut self) -> (u32, ComponentDefinedTypeEncoder<'_>) {
963
+ self.component.type_defined(None)
964
+ }
965
+ fn define_function_type(&mut self) -> (u32, ComponentFuncTypeEncoder<'_>) {
966
+ self.component.type_function(None)
967
+ }
968
+ fn export_type(&mut self, idx: u32, name: &'a str) -> Option<u32> {
969
+ if self.export_types {
970
+ Some(
971
+ self.component
972
+ .export(name, ComponentExportKind::Type, idx, None),
973
+ )
974
+ } else {
975
+ let name = self.unique_import_name(name);
976
+ let ret = self
977
+ .component
978
+ .import(&name, ComponentTypeRef::Type(TypeBounds::Eq(idx)));
979
+ self.imports.insert(name, ret);
980
+ Some(ret)
981
+ }
982
+ }
983
+ fn export_resource(&mut self, name: &'a str) -> u32 {
984
+ if self.export_types {
985
+ panic!("resources should already be exported")
986
+ } else {
987
+ let name = self.unique_import_name(name);
988
+ let ret = self
989
+ .component
990
+ .import(&name, ComponentTypeRef::Type(TypeBounds::SubResource));
991
+ self.imports.insert(name, ret);
992
+ ret
993
+ }
994
+ }
995
+ fn import_type(&mut self, _: InterfaceId, _id: TypeId) -> u32 {
996
+ unreachable!()
997
+ }
998
+ fn type_encoding_maps(&mut self) -> &mut TypeEncodingMaps<'a> {
999
+ &mut self.type_encoding_maps
1000
+ }
1001
+ fn interface(&self) -> Option<InterfaceId> {
1002
+ Some(self.interface)
1003
+ }
1004
+ }
1005
+
1006
+ impl NestedComponentTypeEncoder<'_, '_> {
1007
+ fn unique_import_name(&mut self, name: &str) -> String {
1008
+ let mut name = format!("import-type-{name}");
1009
+ let mut n = 0;
1010
+ while self.imports.contains_key(&name) {
1011
+ name = format!("{name}{n}");
1012
+ n += 1;
1013
+ }
1014
+ name
1015
+ }
1016
+ }
1017
+
1018
+ fn import_func_name(f: &Function) -> String {
1019
+ match f.kind {
1020
+ FunctionKind::Freestanding | FunctionKind::AsyncFreestanding => {
1021
+ format!("import-func-{}", f.item_name())
1022
+ }
1023
+
1024
+ // transform `[method]foo.bar` into `import-method-foo-bar` to
1025
+ // have it be a valid kebab-name which can't conflict with
1026
+ // anything else.
1027
+ //
1028
+ // There's probably a better and more "formal" way to do this
1029
+ // but quick-and-dirty string manipulation should work well
1030
+ // enough for now hopefully.
1031
+ FunctionKind::Method(_)
1032
+ | FunctionKind::AsyncMethod(_)
1033
+ | FunctionKind::Static(_)
1034
+ | FunctionKind::AsyncStatic(_)
1035
+ | FunctionKind::Constructor(_) => {
1036
+ format!(
1037
+ "import-{}",
1038
+ f.name.replace('[', "").replace([']', '.', ' '], "-")
1039
+ )
1040
+ }
1041
+ }
1042
+ }
1043
+ }
1044
+
1045
+ fn encode_lift(
1046
+ &mut self,
1047
+ module: CustomModule<'_>,
1048
+ core_name: &str,
1049
+ key: &WorldKey,
1050
+ func: &Function,
1051
+ ty: u32,
1052
+ ) -> Result<u32> {
1053
+ let resolve = &self.info.encoder.metadata.resolve;
1054
+ let metadata = self.info.module_metadata_for(module);
1055
+ let instance_index = self.instance_for(module);
1056
+ let core_func_index =
1057
+ self.core_alias_export(Some(core_name), instance_index, core_name, ExportKind::Func);
1058
+ let exports = self.info.exports_for(module);
1059
+
1060
+ let options = RequiredOptions::for_export(
1061
+ resolve,
1062
+ func,
1063
+ exports
1064
+ .abi(key, func)
1065
+ .ok_or_else(|| anyhow!("no ABI found for {}", func.name))?,
1066
+ );
1067
+
1068
+ let encoding = metadata
1069
+ .export_encodings
1070
+ .get(resolve, key, &func.name)
1071
+ .unwrap();
1072
+ let exports = self.info.exports_for(module);
1073
+ let realloc_index = exports
1074
+ .export_realloc_for(key, &func.name)
1075
+ .map(|name| self.core_alias_export(Some(name), instance_index, name, ExportKind::Func));
1076
+ let mut options = options
1077
+ .into_iter(encoding, self.memory_index, realloc_index)?
1078
+ .collect::<Vec<_>>();
1079
+
1080
+ if let Some(post_return) = exports.post_return(key, func) {
1081
+ let post_return = self.core_alias_export(
1082
+ Some(post_return),
1083
+ instance_index,
1084
+ post_return,
1085
+ ExportKind::Func,
1086
+ );
1087
+ options.push(CanonicalOption::PostReturn(post_return));
1088
+ }
1089
+ if let Some(callback) = exports.callback(key, func) {
1090
+ let callback =
1091
+ self.core_alias_export(Some(callback), instance_index, callback, ExportKind::Func);
1092
+ options.push(CanonicalOption::Callback(callback));
1093
+ }
1094
+ let func_index = self
1095
+ .component
1096
+ .lift_func(Some(&func.name), core_func_index, ty, options);
1097
+ Ok(func_index)
1098
+ }
1099
+
1100
+ fn encode_shim_instantiation(&mut self) -> Result<Shims<'a>> {
1101
+ let mut ret = Shims::default();
1102
+
1103
+ ret.append_indirect(self.info, CustomModule::Main)
1104
+ .context("failed to register indirect shims for main module")?;
1105
+
1106
+ // For all required adapter modules a shim is created for each required
1107
+ // function and additionally a set of shims are created for the
1108
+ // interface imported into the shim module itself.
1109
+ for (adapter_name, _adapter) in self.info.adapters.iter() {
1110
+ ret.append_indirect(self.info, CustomModule::Adapter(adapter_name))
1111
+ .with_context(|| {
1112
+ format!("failed to register indirect shims for adapter {adapter_name}")
1113
+ })?;
1114
+ }
1115
+
1116
+ if ret.shims.is_empty() {
1117
+ return Ok(ret);
1118
+ }
1119
+
1120
+ assert!(self.shim_instance_index.is_none());
1121
+ assert!(self.fixups_module_index.is_none());
1122
+
1123
+ // This function encodes two modules:
1124
+ // - A shim module that defines a table and exports functions
1125
+ // that indirectly call through the table.
1126
+ // - A fixup module that imports that table and a set of functions
1127
+ // and populates the imported table via active element segments. The
1128
+ // fixup module is used to populate the shim's table once the
1129
+ // imported functions have been lowered.
1130
+
1131
+ let mut types = TypeSection::new();
1132
+ let mut tables = TableSection::new();
1133
+ let mut functions = FunctionSection::new();
1134
+ let mut exports = ExportSection::new();
1135
+ let mut code = CodeSection::new();
1136
+ let mut sigs = IndexMap::new();
1137
+ let mut imports_section = ImportSection::new();
1138
+ let mut elements = ElementSection::new();
1139
+ let mut func_indexes = Vec::new();
1140
+ let mut func_names = NameMap::new();
1141
+
1142
+ for (i, shim) in ret.shims.values().enumerate() {
1143
+ let i = i as u32;
1144
+ let type_index = *sigs.entry(&shim.sig).or_insert_with(|| {
1145
+ let index = types.len();
1146
+ types.ty().function(
1147
+ shim.sig.params.iter().map(to_val_type),
1148
+ shim.sig.results.iter().map(to_val_type),
1149
+ );
1150
+ index
1151
+ });
1152
+
1153
+ functions.function(type_index);
1154
+ Self::encode_shim_function(type_index, i, &mut code, shim.sig.params.len() as u32);
1155
+ exports.export(&shim.name, ExportKind::Func, i);
1156
+
1157
+ imports_section.import("", &shim.name, EntityType::Function(type_index));
1158
+ func_indexes.push(i);
1159
+ func_names.append(i, &shim.debug_name);
1160
+ }
1161
+ let mut names = NameSection::new();
1162
+ names.module("wit-component:shim");
1163
+ names.functions(&func_names);
1164
+
1165
+ let table_type = TableType {
1166
+ element_type: RefType::FUNCREF,
1167
+ minimum: ret.shims.len() as u64,
1168
+ maximum: Some(ret.shims.len() as u64),
1169
+ table64: false,
1170
+ shared: false,
1171
+ };
1172
+
1173
+ tables.table(table_type);
1174
+
1175
+ exports.export(INDIRECT_TABLE_NAME, ExportKind::Table, 0);
1176
+ imports_section.import("", INDIRECT_TABLE_NAME, table_type);
1177
+
1178
+ elements.active(
1179
+ None,
1180
+ &ConstExpr::i32_const(0),
1181
+ Elements::Functions(func_indexes.into()),
1182
+ );
1183
+
1184
+ let mut shim = Module::new();
1185
+ shim.section(&types);
1186
+ shim.section(&functions);
1187
+ shim.section(&tables);
1188
+ shim.section(&exports);
1189
+ shim.section(&code);
1190
+ shim.section(&RawCustomSection(
1191
+ &crate::base_producers().raw_custom_section(),
1192
+ ));
1193
+ if self.info.encoder.debug_names {
1194
+ shim.section(&names);
1195
+ }
1196
+
1197
+ let mut fixups = Module::default();
1198
+ fixups.section(&types);
1199
+ fixups.section(&imports_section);
1200
+ fixups.section(&elements);
1201
+ fixups.section(&RawCustomSection(
1202
+ &crate::base_producers().raw_custom_section(),
1203
+ ));
1204
+
1205
+ if self.info.encoder.debug_names {
1206
+ let mut names = NameSection::new();
1207
+ names.module("wit-component:fixups");
1208
+ fixups.section(&names);
1209
+ }
1210
+
1211
+ let shim_module_index = self
1212
+ .component
1213
+ .core_module(Some("wit-component-shim-module"), &shim);
1214
+ let fixup_index = self
1215
+ .component
1216
+ .core_module(Some("wit-component-fixup"), &fixups);
1217
+ self.fixups_module_index = Some(fixup_index);
1218
+ let shim_instance = self.component.core_instantiate(
1219
+ Some("wit-component-shim-instance"),
1220
+ shim_module_index,
1221
+ [],
1222
+ );
1223
+ self.shim_instance_index = Some(shim_instance);
1224
+
1225
+ return Ok(ret);
1226
+ }
1227
+
1228
+ fn encode_shim_function(
1229
+ type_index: u32,
1230
+ func_index: u32,
1231
+ code: &mut CodeSection,
1232
+ param_count: u32,
1233
+ ) {
1234
+ let mut func = wasm_encoder::Function::new(std::iter::empty());
1235
+ for i in 0..param_count {
1236
+ func.instructions().local_get(i);
1237
+ }
1238
+ func.instructions().i32_const(func_index as i32);
1239
+ func.instructions().call_indirect(0, type_index);
1240
+ func.instructions().end();
1241
+ code.function(&func);
1242
+ }
1243
+
1244
+ fn encode_indirect_lowerings(&mut self, shims: &Shims<'_>) -> Result<()> {
1245
+ if shims.shims.is_empty() {
1246
+ return Ok(());
1247
+ }
1248
+
1249
+ let shim_instance_index = self
1250
+ .shim_instance_index
1251
+ .expect("must have an instantiated shim");
1252
+
1253
+ let table_index = self.core_alias_export(
1254
+ Some("shim table"),
1255
+ shim_instance_index,
1256
+ INDIRECT_TABLE_NAME,
1257
+ ExportKind::Table,
1258
+ );
1259
+
1260
+ let resolve = &self.info.encoder.metadata.resolve;
1261
+
1262
+ let mut exports = Vec::new();
1263
+ exports.push((INDIRECT_TABLE_NAME, ExportKind::Table, table_index));
1264
+
1265
+ for shim in shims.shims.values() {
1266
+ let core_func_index = match &shim.kind {
1267
+ // Indirect lowerings are a `canon lower`'d function with
1268
+ // options specified from a previously instantiated instance.
1269
+ // This previous instance could either be the main module or an
1270
+ // adapter module, which affects the `realloc` option here.
1271
+ // Currently only one linear memory is supported so the linear
1272
+ // memory always comes from the main module.
1273
+ ShimKind::IndirectLowering {
1274
+ interface,
1275
+ index,
1276
+ realloc,
1277
+ encoding,
1278
+ } => {
1279
+ let interface = &self.info.import_map[interface];
1280
+ let ((name, _), _) = interface.lowerings.get_index(*index).unwrap();
1281
+ let func_index = match &interface.interface {
1282
+ Some(interface_id) => {
1283
+ let instance_index = self.imported_instances[interface_id];
1284
+ self.component.alias_export(
1285
+ instance_index,
1286
+ name,
1287
+ ComponentExportKind::Func,
1288
+ )
1289
+ }
1290
+ None => self.imported_funcs[name],
1291
+ };
1292
+
1293
+ let realloc = self
1294
+ .info
1295
+ .exports_for(*realloc)
1296
+ .import_realloc_for(interface.interface, name)
1297
+ .map(|name| {
1298
+ let instance = self.instance_for(*realloc);
1299
+ self.core_alias_export(
1300
+ Some("realloc"),
1301
+ instance,
1302
+ name,
1303
+ ExportKind::Func,
1304
+ )
1305
+ });
1306
+
1307
+ self.component.lower_func(
1308
+ Some(&shim.debug_name),
1309
+ func_index,
1310
+ shim.options
1311
+ .into_iter(*encoding, self.memory_index, realloc)?,
1312
+ )
1313
+ }
1314
+
1315
+ // Adapter shims are defined by an export from an adapter
1316
+ // instance, so use the specified name here and the previously
1317
+ // created instances to get the core item that represents the
1318
+ // shim.
1319
+ ShimKind::Adapter { adapter, func } => self.core_alias_export(
1320
+ Some(func),
1321
+ self.adapter_instances[adapter],
1322
+ func,
1323
+ ExportKind::Func,
1324
+ ),
1325
+
1326
+ // Resources are required for a module to be instantiated
1327
+ // meaning that any destructor for the resource must be called
1328
+ // indirectly due to the otherwise circular dependency between
1329
+ // the module and the resource itself.
1330
+ ShimKind::ResourceDtor { module, export } => self.core_alias_export(
1331
+ Some(export),
1332
+ self.instance_for(*module),
1333
+ export,
1334
+ ExportKind::Func,
1335
+ ),
1336
+
1337
+ ShimKind::PayloadFunc {
1338
+ for_module,
1339
+ info,
1340
+ kind,
1341
+ } => {
1342
+ let metadata = self.info.module_metadata_for(*for_module);
1343
+ let exports = self.info.exports_for(*for_module);
1344
+ let instance_index = self.instance_for(*for_module);
1345
+ let (encoding, realloc) = match &info.ty {
1346
+ PayloadType::Type { function, .. } => {
1347
+ if info.imported {
1348
+ (
1349
+ metadata.import_encodings.get(resolve, &info.key, function),
1350
+ exports.import_realloc_for(info.interface, function),
1351
+ )
1352
+ } else {
1353
+ (
1354
+ metadata.export_encodings.get(resolve, &info.key, function),
1355
+ exports.export_realloc_for(&info.key, function),
1356
+ )
1357
+ }
1358
+ }
1359
+ PayloadType::UnitFuture | PayloadType::UnitStream => (None, None),
1360
+ };
1361
+ let encoding = encoding.unwrap_or(StringEncoding::UTF8);
1362
+ let realloc_index = realloc.map(|name| {
1363
+ self.core_alias_export(
1364
+ Some("realloc"),
1365
+ instance_index,
1366
+ name,
1367
+ ExportKind::Func,
1368
+ )
1369
+ });
1370
+ let type_index = self.payload_type_index(info)?;
1371
+ let options =
1372
+ shim.options
1373
+ .into_iter(encoding, self.memory_index, realloc_index)?;
1374
+
1375
+ match kind {
1376
+ PayloadFuncKind::FutureWrite => {
1377
+ self.component.future_write(type_index, options)
1378
+ }
1379
+ PayloadFuncKind::FutureRead => {
1380
+ self.component.future_read(type_index, options)
1381
+ }
1382
+ PayloadFuncKind::StreamWrite => {
1383
+ self.component.stream_write(type_index, options)
1384
+ }
1385
+ PayloadFuncKind::StreamRead => {
1386
+ self.component.stream_read(type_index, options)
1387
+ }
1388
+ }
1389
+ }
1390
+
1391
+ ShimKind::WaitableSetWait { cancellable } => self
1392
+ .component
1393
+ .waitable_set_wait(*cancellable, self.memory_index.unwrap()),
1394
+ ShimKind::WaitableSetPoll { cancellable } => self
1395
+ .component
1396
+ .waitable_set_poll(*cancellable, self.memory_index.unwrap()),
1397
+ ShimKind::ErrorContextNew { encoding } => self.component.error_context_new(
1398
+ shim.options.into_iter(*encoding, self.memory_index, None)?,
1399
+ ),
1400
+ ShimKind::ErrorContextDebugMessage {
1401
+ for_module,
1402
+ encoding,
1403
+ } => {
1404
+ let instance_index = self.instance_for(*for_module);
1405
+ let realloc = self.info.exports_for(*for_module).import_realloc_fallback();
1406
+ let realloc_index = realloc.map(|r| {
1407
+ self.core_alias_export(Some("realloc"), instance_index, r, ExportKind::Func)
1408
+ });
1409
+
1410
+ self.component
1411
+ .error_context_debug_message(shim.options.into_iter(
1412
+ *encoding,
1413
+ self.memory_index,
1414
+ realloc_index,
1415
+ )?)
1416
+ }
1417
+ ShimKind::TaskReturn {
1418
+ interface,
1419
+ func,
1420
+ result,
1421
+ encoding,
1422
+ for_module,
1423
+ } => {
1424
+ // See `Import::ExportedTaskReturn` handling for why this
1425
+ // encoder is treated specially.
1426
+ let mut encoder = if interface.is_none() {
1427
+ self.root_import_type_encoder(*interface)
1428
+ } else {
1429
+ self.root_export_type_encoder(*interface)
1430
+ };
1431
+ let result = match result {
1432
+ Some(ty) => Some(encoder.encode_valtype(resolve, ty)?),
1433
+ None => None,
1434
+ };
1435
+
1436
+ let exports = self.info.exports_for(*for_module);
1437
+ let realloc = exports.import_realloc_for(*interface, func);
1438
+
1439
+ let instance_index = self.instance_for(*for_module);
1440
+ let realloc_index = realloc.map(|r| {
1441
+ self.core_alias_export(Some("realloc"), instance_index, r, ExportKind::Func)
1442
+ });
1443
+ let options =
1444
+ shim.options
1445
+ .into_iter(*encoding, self.memory_index, realloc_index)?;
1446
+ self.component.task_return(result, options)
1447
+ }
1448
+ ShimKind::ThreadNewIndirect {
1449
+ for_module,
1450
+ func_ty,
1451
+ } => {
1452
+ // Encode the function type for the thread start function so we can reference it in the `canon` call.
1453
+ let (func_ty_idx, f) = self.component.core_type(Some("thread-start"));
1454
+ f.core().func_type(func_ty);
1455
+
1456
+ // In order for the funcref table referenced by `thread.new-indirect` to be used,
1457
+ // it must have been exported by the module.
1458
+ let exports = self.info.exports_for(*for_module);
1459
+ let instance_index = self.instance_for(*for_module);
1460
+ let table_idx = exports.indirect_function_table().map(|table| {
1461
+ self.core_alias_export(
1462
+ Some("indirect-function-table"),
1463
+ instance_index,
1464
+ table,
1465
+ ExportKind::Table,
1466
+ )
1467
+ }).ok_or_else(|| {
1468
+ anyhow!(
1469
+ "table __indirect_function_table must be an exported funcref table for thread.new-indirect"
1470
+ )
1471
+ })?;
1472
+
1473
+ self.component.thread_new_indirect(func_ty_idx, table_idx)
1474
+ }
1475
+ };
1476
+
1477
+ exports.push((shim.name.as_str(), ExportKind::Func, core_func_index));
1478
+ }
1479
+
1480
+ let instance_index = self
1481
+ .component
1482
+ .core_instantiate_exports(Some("fixup-args"), exports);
1483
+ self.component.core_instantiate(
1484
+ Some("fixup"),
1485
+ self.fixups_module_index.expect("must have fixup module"),
1486
+ [("", ModuleArg::Instance(instance_index))],
1487
+ );
1488
+ Ok(())
1489
+ }
1490
+
1491
+ /// Encode the specified `stream` or `future` type in the component using
1492
+ /// either the `root_import_type_encoder` or the `root_export_type_encoder`
1493
+ /// depending on the value of `imported`.
1494
+ ///
1495
+ /// Note that the payload type `T` of `stream<T>` or `future<T>` may be an
1496
+ /// imported or exported type, and that determines the appropriate type
1497
+ /// encoder to use.
1498
+ fn payload_type_index(&mut self, info: &PayloadInfo) -> Result<u32> {
1499
+ let resolve = &self.info.encoder.metadata.resolve;
1500
+ // What exactly is selected here as the encoder is a bit unusual here.
1501
+ // If the interface is imported, an import encoder is used. An import
1502
+ // encoder is also used though if `info` is exported and
1503
+ // `info.interface` is `None`, meaning that this is for a function that
1504
+ // is in the top-level of a world. At the top level of a world all
1505
+ // types are imported.
1506
+ //
1507
+ // Additionally for the import encoder the interface passed in is
1508
+ // `None`, not `info.interface`. Notably this means that references to
1509
+ // named types will be aliased from their imported versions, which is
1510
+ // what we want here.
1511
+ //
1512
+ // Finally though exports do use `info.interface`. Honestly I'm not
1513
+ // really entirely sure why. Fuzzing is happy though, and truly
1514
+ // everything must be ok if the fuzzers are happy, right?
1515
+ let mut encoder = if info.imported || info.interface.is_none() {
1516
+ self.root_import_type_encoder(None)
1517
+ } else {
1518
+ self.root_export_type_encoder(info.interface)
1519
+ };
1520
+ match info.ty {
1521
+ PayloadType::Type { id, .. } => match encoder.encode_valtype(resolve, &Type::Id(id))? {
1522
+ ComponentValType::Type(index) => Ok(index),
1523
+ ComponentValType::Primitive(_) => unreachable!(),
1524
+ },
1525
+ PayloadType::UnitFuture => Ok(encoder.encode_unit_future()),
1526
+ PayloadType::UnitStream => Ok(encoder.encode_unit_stream()),
1527
+ }
1528
+ }
1529
+
1530
+ /// This is a helper function that will declare any types necessary for
1531
+ /// declaring intrinsics that are imported into the module or adapter.
1532
+ ///
1533
+ /// For example resources must be declared to generate
1534
+ /// destructors/constructors/etc. Additionally types must also be declared
1535
+ /// for `task.return` with the component model async feature.
1536
+ fn declare_types_for_imported_intrinsics(&mut self, shims: &Shims<'_>) -> Result<()> {
1537
+ let resolve = &self.info.encoder.metadata.resolve;
1538
+ let world = &resolve.worlds[self.info.encoder.metadata.world];
1539
+
1540
+ // Iterate over the main module's exports and the exports of all
1541
+ // adapters. Look for exported interfaces.
1542
+ let main_module_keys = self.info.encoder.main_module_exports.iter();
1543
+ let main_module_keys = main_module_keys.map(|key| (CustomModule::Main, key));
1544
+ let adapter_keys = self.info.encoder.adapters.iter().flat_map(|(name, info)| {
1545
+ info.required_exports
1546
+ .iter()
1547
+ .map(move |key| (CustomModule::Adapter(name), key))
1548
+ });
1549
+ for (for_module, key) in main_module_keys.chain(adapter_keys) {
1550
+ let id = match &world.exports[key] {
1551
+ WorldItem::Interface { id, .. } => *id,
1552
+ WorldItem::Type { .. } => unreachable!(),
1553
+ WorldItem::Function(_) => continue,
1554
+ };
1555
+
1556
+ for ty in resolve.interfaces[id].types.values() {
1557
+ let def = &resolve.types[*ty];
1558
+ match &def.kind {
1559
+ // Declare exported resources specially as they generally
1560
+ // need special treatment for later handling exports and
1561
+ // such.
1562
+ TypeDefKind::Resource => {
1563
+ // Load the destructor, previously detected in module
1564
+ // validation, if one is present.
1565
+ let exports = self.info.exports_for(for_module);
1566
+ let dtor = exports.resource_dtor(*ty).map(|name| {
1567
+ let shim = &shims.shims[&ShimKind::ResourceDtor {
1568
+ module: for_module,
1569
+ export: name,
1570
+ }];
1571
+ let index = self.shim_instance_index.unwrap();
1572
+ self.core_alias_export(
1573
+ Some(&shim.debug_name),
1574
+ index,
1575
+ &shim.name,
1576
+ ExportKind::Func,
1577
+ )
1578
+ });
1579
+
1580
+ // Declare the resource with this destructor and register it in
1581
+ // our internal map. This should be the first and only time this
1582
+ // type is inserted into this map.
1583
+ let resource_idx = self.component.type_resource(
1584
+ Some(def.name.as_ref().unwrap()),
1585
+ ValType::I32,
1586
+ dtor,
1587
+ );
1588
+ let prev = self
1589
+ .export_type_encoding_maps
1590
+ .id_to_index
1591
+ .insert(*ty, resource_idx);
1592
+ assert!(prev.is_none());
1593
+ }
1594
+ _other => {
1595
+ self.root_export_type_encoder(Some(id))
1596
+ .encode_valtype(resolve, &Type::Id(*ty))?;
1597
+ }
1598
+ }
1599
+ }
1600
+ }
1601
+ Ok(())
1602
+ }
1603
+
1604
+ /// Helper to instantiate the main module and record various results of its
1605
+ /// instantiation within `self`.
1606
+ fn instantiate_main_module(&mut self, shims: &Shims<'_>) -> Result<()> {
1607
+ assert!(self.instance_index.is_none());
1608
+
1609
+ let instance_index = self.instantiate_core_module(shims, CustomModule::Main)?;
1610
+
1611
+ if let Some(memory) = self.info.info.exports.memory() {
1612
+ self.memory_index = Some(self.core_alias_export(
1613
+ Some("memory"),
1614
+ instance_index,
1615
+ memory,
1616
+ ExportKind::Memory,
1617
+ ));
1618
+ }
1619
+
1620
+ self.instance_index = Some(instance_index);
1621
+ Ok(())
1622
+ }
1623
+
1624
+ /// This function will instantiate the specified adapter module, which may
1625
+ /// depend on previously-instantiated modules.
1626
+ fn instantiate_adapter_module(&mut self, shims: &Shims<'_>, name: &'a str) -> Result<()> {
1627
+ let instance = self.instantiate_core_module(shims, CustomModule::Adapter(name))?;
1628
+ self.adapter_instances.insert(name, instance);
1629
+ Ok(())
1630
+ }
1631
+
1632
+ /// Generic helper to instantiate a module.
1633
+ ///
1634
+ /// The `for_module` provided will have all of its imports satisfied from
1635
+ /// either previous instantiations or the `shims` module present. This
1636
+ /// iterates over the metadata produced during validation to determine what
1637
+ /// hooks up to what import.
1638
+ fn instantiate_core_module(
1639
+ &mut self,
1640
+ shims: &Shims,
1641
+ for_module: CustomModule<'_>,
1642
+ ) -> Result<u32> {
1643
+ let module = self.module_for(for_module);
1644
+
1645
+ let mut args = Vec::new();
1646
+ for (core_wasm_name, instance) in self.info.imports_for(for_module).modules() {
1647
+ match instance {
1648
+ // For import modules that are a "bag of names" iterate over
1649
+ // each name and materialize it into this component with the
1650
+ // `materialize_import` helper. This is then all bottled up into
1651
+ // a bag-of-exports instance which is then used for
1652
+ // instantiation.
1653
+ ImportInstance::Names(names) => {
1654
+ let mut exports = Vec::new();
1655
+ for (name, import) in names {
1656
+ log::trace!(
1657
+ "attempting to materialize import of `{core_wasm_name}::{name}` for {for_module:?}"
1658
+ );
1659
+ let (kind, index) = self
1660
+ .materialize_import(&shims, for_module, import)
1661
+ .with_context(|| {
1662
+ format!("failed to satisfy import `{core_wasm_name}::{name}`")
1663
+ })?;
1664
+ exports.push((name.as_str(), kind, index));
1665
+ }
1666
+ let index = self
1667
+ .component
1668
+ .core_instantiate_exports(Some(core_wasm_name), exports);
1669
+ args.push((core_wasm_name.as_str(), ModuleArg::Instance(index)));
1670
+ }
1671
+
1672
+ // Some imports are entire instances, so use the instance for
1673
+ // the module identifier as the import.
1674
+ ImportInstance::Whole(which) => {
1675
+ let instance = self.instance_for(which.to_custom_module());
1676
+ args.push((core_wasm_name.as_str(), ModuleArg::Instance(instance)));
1677
+ }
1678
+ }
1679
+ }
1680
+
1681
+ // And with all arguments prepared now, instantiate the module.
1682
+ Ok(self
1683
+ .component
1684
+ .core_instantiate(Some(for_module.debug_name()), module, args))
1685
+ }
1686
+
1687
+ /// Helper function to materialize an import into a core module within the
1688
+ /// component being built.
1689
+ ///
1690
+ /// This function is called for individual imports and uses the results of
1691
+ /// validation, notably the `Import` type, to determine what WIT-level or
1692
+ /// component-level construct is being hooked up.
1693
+ fn materialize_import(
1694
+ &mut self,
1695
+ shims: &Shims<'_>,
1696
+ for_module: CustomModule<'_>,
1697
+ import: &'a Import,
1698
+ ) -> Result<(ExportKind, u32)> {
1699
+ let resolve = &self.info.encoder.metadata.resolve;
1700
+ match import {
1701
+ // Main module dependencies on an adapter in use are done with an
1702
+ // indirection here, so load the shim function and use that.
1703
+ Import::AdapterExport {
1704
+ adapter,
1705
+ func,
1706
+ ty: _,
1707
+ } => {
1708
+ assert!(self.info.encoder.adapters.contains_key(adapter));
1709
+ Ok(self.materialize_shim_import(shims, &ShimKind::Adapter { adapter, func }))
1710
+ }
1711
+
1712
+ // Adapters might use the main module's memory, in which case it
1713
+ // should have been previously instantiated.
1714
+ Import::MainModuleMemory => {
1715
+ let index = self
1716
+ .memory_index
1717
+ .ok_or_else(|| anyhow!("main module cannot import memory"))?;
1718
+ Ok((ExportKind::Memory, index))
1719
+ }
1720
+
1721
+ // Grab-bag of "this adapter wants this thing from the main module".
1722
+ Import::MainModuleExport { name, kind } => {
1723
+ let instance = self.instance_index.unwrap();
1724
+ let index = self.core_alias_export(Some(name), instance, name, *kind);
1725
+ Ok((*kind, index))
1726
+ }
1727
+
1728
+ // A similar grab-bag to above but with a slightly different
1729
+ // structure. Should probably refactor to make these two the same in
1730
+ // the future.
1731
+ Import::Item(item) => {
1732
+ let instance = self.instance_for(item.which.to_custom_module());
1733
+ let index =
1734
+ self.core_alias_export(Some(&item.name), instance, &item.name, item.kind);
1735
+ Ok((item.kind, index))
1736
+ }
1737
+
1738
+ // Resource intrinsics related to exported resources. Despite being
1739
+ // an exported resource the component still provides necessary
1740
+ // intrinsics for manipulating resource state. These are all
1741
+ // handled here using the resource types created during
1742
+ // `declare_types_for_imported_intrinsics` above.
1743
+ Import::ExportedResourceDrop(_key, id) => {
1744
+ let index = self
1745
+ .component
1746
+ .resource_drop(self.export_type_encoding_maps.id_to_index[id]);
1747
+ Ok((ExportKind::Func, index))
1748
+ }
1749
+ Import::ExportedResourceRep(_key, id) => {
1750
+ let index = self
1751
+ .component
1752
+ .resource_rep(self.export_type_encoding_maps.id_to_index[id]);
1753
+ Ok((ExportKind::Func, index))
1754
+ }
1755
+ Import::ExportedResourceNew(_key, id) => {
1756
+ let index = self
1757
+ .component
1758
+ .resource_new(self.export_type_encoding_maps.id_to_index[id]);
1759
+ Ok((ExportKind::Func, index))
1760
+ }
1761
+
1762
+ // And finally here at the end these cases are going to all fall
1763
+ // through to the code below. This is where these are connected to a
1764
+ // WIT `ImportedInterface` one way or another with the name that was
1765
+ // detected during validation.
1766
+ Import::ImportedResourceDrop(key, iface, id) => {
1767
+ let ty = &resolve.types[*id];
1768
+ let name = ty.name.as_ref().unwrap();
1769
+ self.materialize_wit_import(
1770
+ shims,
1771
+ for_module,
1772
+ iface.map(|_| resolve.name_world_key(key)),
1773
+ &format!("{name}_drop"),
1774
+ key,
1775
+ AbiVariant::GuestImport,
1776
+ )
1777
+ }
1778
+ Import::ExportedTaskReturn(key, interface, func, result) => {
1779
+ let (options, _sig) = task_return_options_and_type(resolve, *result);
1780
+ if options.is_empty() {
1781
+ // Note that an "import type encoder" is used here despite
1782
+ // this being for an exported function if the `interface`
1783
+ // is none, meaning that this is for a top-level world
1784
+ // function. In that situation all types that can be
1785
+ // referred to are imported, not exported.
1786
+ let mut encoder = if interface.is_none() {
1787
+ self.root_import_type_encoder(*interface)
1788
+ } else {
1789
+ self.root_export_type_encoder(*interface)
1790
+ };
1791
+
1792
+ let result = match result {
1793
+ Some(ty) => Some(encoder.encode_valtype(resolve, ty)?),
1794
+ None => None,
1795
+ };
1796
+ let index = self.component.task_return(result, []);
1797
+ Ok((ExportKind::Func, index))
1798
+ } else {
1799
+ let metadata = &self.info.module_metadata_for(for_module);
1800
+ let encoding = metadata.export_encodings.get(resolve, key, func).unwrap();
1801
+ Ok(self.materialize_shim_import(
1802
+ shims,
1803
+ &ShimKind::TaskReturn {
1804
+ for_module,
1805
+ interface: *interface,
1806
+ func,
1807
+ result: *result,
1808
+ encoding,
1809
+ },
1810
+ ))
1811
+ }
1812
+ }
1813
+ Import::BackpressureInc => {
1814
+ let index = self.component.backpressure_inc();
1815
+ Ok((ExportKind::Func, index))
1816
+ }
1817
+ Import::BackpressureDec => {
1818
+ let index = self.component.backpressure_dec();
1819
+ Ok((ExportKind::Func, index))
1820
+ }
1821
+ Import::WaitableSetWait { cancellable } => Ok(self.materialize_shim_import(
1822
+ shims,
1823
+ &ShimKind::WaitableSetWait {
1824
+ cancellable: *cancellable,
1825
+ },
1826
+ )),
1827
+ Import::WaitableSetPoll { cancellable } => Ok(self.materialize_shim_import(
1828
+ shims,
1829
+ &ShimKind::WaitableSetPoll {
1830
+ cancellable: *cancellable,
1831
+ },
1832
+ )),
1833
+ Import::ThreadYield { cancellable } => {
1834
+ let index = self.component.thread_yield(*cancellable);
1835
+ Ok((ExportKind::Func, index))
1836
+ }
1837
+ Import::SubtaskDrop => {
1838
+ let index = self.component.subtask_drop();
1839
+ Ok((ExportKind::Func, index))
1840
+ }
1841
+ Import::SubtaskCancel { async_ } => {
1842
+ let index = self.component.subtask_cancel(*async_);
1843
+ Ok((ExportKind::Func, index))
1844
+ }
1845
+ Import::StreamNew(info) => {
1846
+ let ty = self.payload_type_index(info)?;
1847
+ let index = self.component.stream_new(ty);
1848
+ Ok((ExportKind::Func, index))
1849
+ }
1850
+ Import::StreamRead { info, .. } => Ok(self.materialize_payload_import(
1851
+ shims,
1852
+ for_module,
1853
+ info,
1854
+ PayloadFuncKind::StreamRead,
1855
+ )),
1856
+ Import::StreamWrite { info, .. } => Ok(self.materialize_payload_import(
1857
+ shims,
1858
+ for_module,
1859
+ info,
1860
+ PayloadFuncKind::StreamWrite,
1861
+ )),
1862
+ Import::StreamCancelRead { info, async_ } => {
1863
+ let ty = self.payload_type_index(info)?;
1864
+ let index = self.component.stream_cancel_read(ty, *async_);
1865
+ Ok((ExportKind::Func, index))
1866
+ }
1867
+ Import::StreamCancelWrite { info, async_ } => {
1868
+ let ty = self.payload_type_index(info)?;
1869
+ let index = self.component.stream_cancel_write(ty, *async_);
1870
+ Ok((ExportKind::Func, index))
1871
+ }
1872
+ Import::StreamDropReadable(info) => {
1873
+ let type_index = self.payload_type_index(info)?;
1874
+ let index = self.component.stream_drop_readable(type_index);
1875
+ Ok((ExportKind::Func, index))
1876
+ }
1877
+ Import::StreamDropWritable(info) => {
1878
+ let type_index = self.payload_type_index(info)?;
1879
+ let index = self.component.stream_drop_writable(type_index);
1880
+ Ok((ExportKind::Func, index))
1881
+ }
1882
+ Import::FutureNew(info) => {
1883
+ let ty = self.payload_type_index(info)?;
1884
+ let index = self.component.future_new(ty);
1885
+ Ok((ExportKind::Func, index))
1886
+ }
1887
+ Import::FutureRead { info, .. } => Ok(self.materialize_payload_import(
1888
+ shims,
1889
+ for_module,
1890
+ info,
1891
+ PayloadFuncKind::FutureRead,
1892
+ )),
1893
+ Import::FutureWrite { info, .. } => Ok(self.materialize_payload_import(
1894
+ shims,
1895
+ for_module,
1896
+ info,
1897
+ PayloadFuncKind::FutureWrite,
1898
+ )),
1899
+ Import::FutureCancelRead { info, async_ } => {
1900
+ let ty = self.payload_type_index(info)?;
1901
+ let index = self.component.future_cancel_read(ty, *async_);
1902
+ Ok((ExportKind::Func, index))
1903
+ }
1904
+ Import::FutureCancelWrite { info, async_ } => {
1905
+ let ty = self.payload_type_index(info)?;
1906
+ let index = self.component.future_cancel_write(ty, *async_);
1907
+ Ok((ExportKind::Func, index))
1908
+ }
1909
+ Import::FutureDropReadable(info) => {
1910
+ let type_index = self.payload_type_index(info)?;
1911
+ let index = self.component.future_drop_readable(type_index);
1912
+ Ok((ExportKind::Func, index))
1913
+ }
1914
+ Import::FutureDropWritable(info) => {
1915
+ let type_index = self.payload_type_index(info)?;
1916
+ let index = self.component.future_drop_writable(type_index);
1917
+ Ok((ExportKind::Func, index))
1918
+ }
1919
+ Import::ErrorContextNew { encoding } => Ok(self.materialize_shim_import(
1920
+ shims,
1921
+ &ShimKind::ErrorContextNew {
1922
+ encoding: *encoding,
1923
+ },
1924
+ )),
1925
+ Import::ErrorContextDebugMessage { encoding } => Ok(self.materialize_shim_import(
1926
+ shims,
1927
+ &ShimKind::ErrorContextDebugMessage {
1928
+ for_module,
1929
+ encoding: *encoding,
1930
+ },
1931
+ )),
1932
+ Import::ErrorContextDrop => {
1933
+ let index = self.component.error_context_drop();
1934
+ Ok((ExportKind::Func, index))
1935
+ }
1936
+ Import::WorldFunc(key, name, abi) => {
1937
+ self.materialize_wit_import(shims, for_module, None, name, key, *abi)
1938
+ }
1939
+ Import::InterfaceFunc(key, _, name, abi) => self.materialize_wit_import(
1940
+ shims,
1941
+ for_module,
1942
+ Some(resolve.name_world_key(key)),
1943
+ name,
1944
+ key,
1945
+ *abi,
1946
+ ),
1947
+
1948
+ Import::WaitableSetNew => {
1949
+ let index = self.component.waitable_set_new();
1950
+ Ok((ExportKind::Func, index))
1951
+ }
1952
+ Import::WaitableSetDrop => {
1953
+ let index = self.component.waitable_set_drop();
1954
+ Ok((ExportKind::Func, index))
1955
+ }
1956
+ Import::WaitableJoin => {
1957
+ let index = self.component.waitable_join();
1958
+ Ok((ExportKind::Func, index))
1959
+ }
1960
+ Import::ContextGet(n) => {
1961
+ let index = self.component.context_get(*n);
1962
+ Ok((ExportKind::Func, index))
1963
+ }
1964
+ Import::ContextSet(n) => {
1965
+ let index = self.component.context_set(*n);
1966
+ Ok((ExportKind::Func, index))
1967
+ }
1968
+ Import::ExportedTaskCancel => {
1969
+ let index = self.component.task_cancel();
1970
+ Ok((ExportKind::Func, index))
1971
+ }
1972
+ Import::ThreadIndex => {
1973
+ let index = self.component.thread_index();
1974
+ Ok((ExportKind::Func, index))
1975
+ }
1976
+ Import::ThreadNewIndirect => Ok(self.materialize_shim_import(
1977
+ shims,
1978
+ &ShimKind::ThreadNewIndirect {
1979
+ for_module,
1980
+ // This is fixed for now
1981
+ func_ty: FuncType::new([ValType::I32], []),
1982
+ },
1983
+ )),
1984
+ Import::ThreadSwitchTo { cancellable } => {
1985
+ let index = self.component.thread_switch_to(*cancellable);
1986
+ Ok((ExportKind::Func, index))
1987
+ }
1988
+ Import::ThreadSuspend { cancellable } => {
1989
+ let index = self.component.thread_suspend(*cancellable);
1990
+ Ok((ExportKind::Func, index))
1991
+ }
1992
+ Import::ThreadResumeLater => {
1993
+ let index = self.component.thread_resume_later();
1994
+ Ok((ExportKind::Func, index))
1995
+ }
1996
+ Import::ThreadYieldTo { cancellable } => {
1997
+ let index = self.component.thread_yield_to(*cancellable);
1998
+ Ok((ExportKind::Func, index))
1999
+ }
2000
+ }
2001
+ }
2002
+
2003
+ /// Helper for `materialize_import` above for materializing functions that
2004
+ /// are part of the "shim module" generated.
2005
+ fn materialize_shim_import(&mut self, shims: &Shims<'_>, kind: &ShimKind) -> (ExportKind, u32) {
2006
+ let index = self.core_alias_export(
2007
+ Some(&shims.shims[kind].debug_name),
2008
+ self.shim_instance_index
2009
+ .expect("shim should be instantiated"),
2010
+ &shims.shims[kind].name,
2011
+ ExportKind::Func,
2012
+ );
2013
+ (ExportKind::Func, index)
2014
+ }
2015
+
2016
+ /// Helper for `materialize_import` above for generating imports for
2017
+ /// future/stream read/write intrinsics.
2018
+ fn materialize_payload_import(
2019
+ &mut self,
2020
+ shims: &Shims<'_>,
2021
+ for_module: CustomModule<'_>,
2022
+ info: &PayloadInfo,
2023
+ kind: PayloadFuncKind,
2024
+ ) -> (ExportKind, u32) {
2025
+ self.materialize_shim_import(
2026
+ shims,
2027
+ &ShimKind::PayloadFunc {
2028
+ for_module,
2029
+ info,
2030
+ kind,
2031
+ },
2032
+ )
2033
+ }
2034
+
2035
+ /// Helper for `materialize_import` above which specifically operates on
2036
+ /// WIT-level functions identified by `interface_key`, `name`, and `abi`.
2037
+ fn materialize_wit_import(
2038
+ &mut self,
2039
+ shims: &Shims<'_>,
2040
+ for_module: CustomModule<'_>,
2041
+ interface_key: Option<String>,
2042
+ name: &String,
2043
+ key: &WorldKey,
2044
+ abi: AbiVariant,
2045
+ ) -> Result<(ExportKind, u32)> {
2046
+ let resolve = &self.info.encoder.metadata.resolve;
2047
+ let import = &self.info.import_map[&interface_key];
2048
+ let (index, _, lowering) = import.lowerings.get_full(&(name.clone(), abi)).unwrap();
2049
+ let metadata = self.info.module_metadata_for(for_module);
2050
+
2051
+ let index = match lowering {
2052
+ // All direct lowerings can be `canon lower`'d here immediately
2053
+ // and passed as arguments.
2054
+ Lowering::Direct => {
2055
+ let func_index = match &import.interface {
2056
+ Some(interface) => {
2057
+ let instance_index = self.imported_instances[interface];
2058
+ self.component
2059
+ .alias_export(instance_index, name, ComponentExportKind::Func)
2060
+ }
2061
+ None => self.imported_funcs[name],
2062
+ };
2063
+ self.component.lower_func(
2064
+ Some(name),
2065
+ func_index,
2066
+ if let AbiVariant::GuestImportAsync = abi {
2067
+ vec![CanonicalOption::Async]
2068
+ } else {
2069
+ Vec::new()
2070
+ },
2071
+ )
2072
+ }
2073
+
2074
+ // Indirect lowerings come from the shim that was previously
2075
+ // created, so the specific export is loaded here and used as an
2076
+ // import.
2077
+ Lowering::Indirect { .. } => {
2078
+ let encoding = metadata.import_encodings.get(resolve, key, name).unwrap();
2079
+ return Ok(self.materialize_shim_import(
2080
+ shims,
2081
+ &ShimKind::IndirectLowering {
2082
+ interface: interface_key,
2083
+ index,
2084
+ realloc: for_module,
2085
+ encoding,
2086
+ },
2087
+ ));
2088
+ }
2089
+
2090
+ // A "resource drop" intrinsic only needs to find the index of the
2091
+ // resource type itself and then the intrinsic is declared.
2092
+ Lowering::ResourceDrop(id) => {
2093
+ let resource_idx = self.lookup_resource_index(*id);
2094
+ self.component.resource_drop(resource_idx)
2095
+ }
2096
+ };
2097
+ Ok((ExportKind::Func, index))
2098
+ }
2099
+
2100
+ /// Generates component bits that are responsible for executing
2101
+ /// `_initialize`, if found, in the original component.
2102
+ ///
2103
+ /// The `_initialize` function was a part of WASIp1 where it generally is
2104
+ /// intended to run after imports and memory and such are all "hooked up"
2105
+ /// and performs other various initialization tasks. This is additionally
2106
+ /// specified in https://github.com/WebAssembly/component-model/pull/378
2107
+ /// to be part of the component model lowerings as well.
2108
+ ///
2109
+ /// This implements this functionality by encoding a core module that
2110
+ /// imports a function and then registers a `start` section with that
2111
+ /// imported function. This is all encoded after the
2112
+ /// imports/lowerings/tables/etc are all filled in above meaning that this
2113
+ /// is the last piece to run. That means that when this is running
2114
+ /// everything should be hooked up for all imported functions to work.
2115
+ ///
2116
+ /// Note that at this time `_initialize` is only detected in the "main
2117
+ /// module", not adapters/libraries.
2118
+ fn encode_initialize_with_start(&mut self) -> Result<()> {
2119
+ let initialize = match self.info.info.exports.initialize() {
2120
+ Some(name) => name,
2121
+ // If this core module didn't have `_initialize` or similar, then
2122
+ // there's nothing to do here.
2123
+ None => return Ok(()),
2124
+ };
2125
+ let initialize_index = self.core_alias_export(
2126
+ Some("start"),
2127
+ self.instance_index.unwrap(),
2128
+ initialize,
2129
+ ExportKind::Func,
2130
+ );
2131
+ let mut shim = Module::default();
2132
+ let mut section = TypeSection::new();
2133
+ section.ty().function([], []);
2134
+ shim.section(&section);
2135
+ let mut section = ImportSection::new();
2136
+ section.import("", "", EntityType::Function(0));
2137
+ shim.section(&section);
2138
+ shim.section(&StartSection { function_index: 0 });
2139
+
2140
+ // Declare the core module within the component, create a dummy core
2141
+ // instance with one export of our `_initialize` function, and then use
2142
+ // that to instantiate the module we emit to run the `start` function in
2143
+ // core wasm to run `_initialize`.
2144
+ let shim_module_index = self.component.core_module(Some("start-shim-module"), &shim);
2145
+ let shim_args_instance_index = self.component.core_instantiate_exports(
2146
+ Some("start-shim-args"),
2147
+ [("", ExportKind::Func, initialize_index)],
2148
+ );
2149
+ self.component.core_instantiate(
2150
+ Some("start-shim-instance"),
2151
+ shim_module_index,
2152
+ [("", ModuleArg::Instance(shim_args_instance_index))],
2153
+ );
2154
+ Ok(())
2155
+ }
2156
+
2157
+ /// Convenience function to go from `CustomModule` to the instance index
2158
+ /// corresponding to what that points to.
2159
+ fn instance_for(&self, module: CustomModule) -> u32 {
2160
+ match module {
2161
+ CustomModule::Main => self.instance_index.expect("instantiated by now"),
2162
+ CustomModule::Adapter(name) => self.adapter_instances[name],
2163
+ }
2164
+ }
2165
+
2166
+ /// Convenience function to go from `CustomModule` to the module index
2167
+ /// corresponding to what that points to.
2168
+ fn module_for(&self, module: CustomModule) -> u32 {
2169
+ match module {
2170
+ CustomModule::Main => self.module_index.unwrap(),
2171
+ CustomModule::Adapter(name) => self.adapter_modules[name],
2172
+ }
2173
+ }
2174
+
2175
+ /// Convenience function which caches aliases created so repeated calls to
2176
+ /// this function will all return the same index.
2177
+ fn core_alias_export(
2178
+ &mut self,
2179
+ debug_name: Option<&str>,
2180
+ instance: u32,
2181
+ name: &str,
2182
+ kind: ExportKind,
2183
+ ) -> u32 {
2184
+ *self
2185
+ .aliased_core_items
2186
+ .entry((instance, name.to_string()))
2187
+ .or_insert_with(|| {
2188
+ self.component
2189
+ .core_alias_export(debug_name, instance, name, kind)
2190
+ })
2191
+ }
2192
+ }
2193
+
2194
+ /// A list of "shims" which start out during the component instantiation process
2195
+ /// as functions which immediately trap due to a `call_indirect`-to-`null` but
2196
+ /// will get filled in by the time the component instantiation process
2197
+ /// completes.
2198
+ ///
2199
+ /// Shims currently include:
2200
+ ///
2201
+ /// * "Indirect functions" lowered from imported instances where the lowering
2202
+ /// requires an item exported from the main module. These are indirect due to
2203
+ /// the circular dependency between the module needing an import and the
2204
+ /// import needing the module.
2205
+ ///
2206
+ /// * Adapter modules which convert from a historical ABI to the component
2207
+ /// model's ABI (e.g. wasi preview1 to preview2) get a shim since the adapters
2208
+ /// are currently indicated as always requiring the memory of the main module.
2209
+ ///
2210
+ /// This structure is created by `encode_shim_instantiation`.
2211
+ #[derive(Default)]
2212
+ struct Shims<'a> {
2213
+ /// The list of all shims that a module will require.
2214
+ shims: IndexMap<ShimKind<'a>, Shim<'a>>,
2215
+ }
2216
+
2217
+ struct Shim<'a> {
2218
+ /// Canonical ABI options required by this shim, used during `canon lower`
2219
+ /// operations.
2220
+ options: RequiredOptions,
2221
+
2222
+ /// The name, in the shim instance, of this shim.
2223
+ ///
2224
+ /// Currently this is `"0"`, `"1"`, ...
2225
+ name: String,
2226
+
2227
+ /// A human-readable debugging name for this shim, used in a core wasm
2228
+ /// `name` section.
2229
+ debug_name: String,
2230
+
2231
+ /// Precise information about what this shim is a lowering of.
2232
+ kind: ShimKind<'a>,
2233
+
2234
+ /// Wasm type of this shim.
2235
+ sig: WasmSignature,
2236
+ }
2237
+
2238
+ /// Which variation of `{stream|future}.{read|write}` we're emitting for a
2239
+ /// `ShimKind::PayloadFunc`.
2240
+ #[derive(Debug, Clone, Hash, Eq, PartialEq)]
2241
+ enum PayloadFuncKind {
2242
+ FutureWrite,
2243
+ FutureRead,
2244
+ StreamWrite,
2245
+ StreamRead,
2246
+ }
2247
+
2248
+ #[derive(Debug, Clone, Hash, Eq, PartialEq)]
2249
+ enum ShimKind<'a> {
2250
+ /// This shim is a late indirect lowering of an imported function in a
2251
+ /// component which is only possible after prior core wasm modules are
2252
+ /// instantiated so their memories and functions are available.
2253
+ IndirectLowering {
2254
+ /// The name of the interface that's being lowered.
2255
+ interface: Option<String>,
2256
+ /// The index within the `lowerings` array of the function being lowered.
2257
+ index: usize,
2258
+ /// Which instance to pull the `realloc` function from, if necessary.
2259
+ realloc: CustomModule<'a>,
2260
+ /// The string encoding that this lowering is going to use.
2261
+ encoding: StringEncoding,
2262
+ },
2263
+ /// This shim is a core wasm function defined in an adapter module but isn't
2264
+ /// available until the adapter module is itself instantiated.
2265
+ Adapter {
2266
+ /// The name of the adapter module this shim comes from.
2267
+ adapter: &'a str,
2268
+ /// The name of the export in the adapter module this shim points to.
2269
+ func: &'a str,
2270
+ },
2271
+ /// A shim used as the destructor for a resource which allows defining the
2272
+ /// resource before the core module being instantiated.
2273
+ ResourceDtor {
2274
+ /// Which instance to pull the destructor function from.
2275
+ module: CustomModule<'a>,
2276
+ /// The exported function name of this destructor in the core module.
2277
+ export: &'a str,
2278
+ },
2279
+ /// A shim used for a `{stream|future}.{read|write}` built-in function,
2280
+ /// which must refer to the core module instance's memory from/to which
2281
+ /// payload values must be lifted/lowered.
2282
+ PayloadFunc {
2283
+ /// Which instance to pull the `realloc` function and string encoding
2284
+ /// from, if necessary.
2285
+ for_module: CustomModule<'a>,
2286
+ /// Additional information regarding the function where this `stream` or
2287
+ /// `future` type appeared, which we use in combination with
2288
+ /// `for_module` to determine which `realloc` and string encoding to
2289
+ /// use, as well as which type to specify when emitting the built-in.
2290
+ info: &'a PayloadInfo,
2291
+ /// Which variation of `{stream|future}.{read|write}` we're emitting.
2292
+ kind: PayloadFuncKind,
2293
+ },
2294
+ /// A shim used for the `waitable-set.wait` built-in function, which must
2295
+ /// refer to the core module instance's memory to which results will be
2296
+ /// written.
2297
+ WaitableSetWait { cancellable: bool },
2298
+ /// A shim used for the `waitable-set.poll` built-in function, which must
2299
+ /// refer to the core module instance's memory to which results will be
2300
+ /// written.
2301
+ WaitableSetPoll { cancellable: bool },
2302
+ /// Shim for `task.return` to handle a reference to a `memory` which may
2303
+ TaskReturn {
2304
+ /// The interface (optional) that owns `func` below. If `None` then it's
2305
+ /// a world export.
2306
+ interface: Option<InterfaceId>,
2307
+ /// The function that this `task.return` is returning for, owned
2308
+ /// within `interface` above.
2309
+ func: &'a str,
2310
+ /// The WIT type that `func` returns.
2311
+ result: Option<Type>,
2312
+ /// Which instance to pull the `realloc` function from, if necessary.
2313
+ for_module: CustomModule<'a>,
2314
+ /// String encoding to use in the ABI options.
2315
+ encoding: StringEncoding,
2316
+ },
2317
+ /// A shim used for the `error-context.new` built-in function, which must
2318
+ /// refer to the core module instance's memory from which the debug message
2319
+ /// will be read.
2320
+ ErrorContextNew {
2321
+ /// String encoding to use when lifting the debug message.
2322
+ encoding: StringEncoding,
2323
+ },
2324
+ /// A shim used for the `error-context.debug-message` built-in function,
2325
+ /// which must refer to the core module instance's memory to which results
2326
+ /// will be written.
2327
+ ErrorContextDebugMessage {
2328
+ /// Which instance to pull the `realloc` function from, if necessary.
2329
+ for_module: CustomModule<'a>,
2330
+ /// The string encoding to use when lowering the debug message.
2331
+ encoding: StringEncoding,
2332
+ },
2333
+ /// A shim used for the `thread.new-indirect` built-in function, which
2334
+ /// must refer to the core module instance's indirect function table.
2335
+ ThreadNewIndirect {
2336
+ /// Which instance to pull the function table from.
2337
+ for_module: CustomModule<'a>,
2338
+ /// The function type to use when creating the thread.
2339
+ func_ty: FuncType,
2340
+ },
2341
+ }
2342
+
2343
+ /// Indicator for which module is being used for a lowering or where options
2344
+ /// like `realloc` are drawn from.
2345
+ ///
2346
+ /// This is necessary for situations such as an imported function being lowered
2347
+ /// into the main module and additionally into an adapter module. For example an
2348
+ /// adapter might adapt from preview1 to preview2 for the standard library of a
2349
+ /// programming language but the main module's custom application code may also
2350
+ /// explicitly import from preview2. These two different lowerings of a preview2
2351
+ /// function are parameterized by this enumeration.
2352
+ #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)]
2353
+ enum CustomModule<'a> {
2354
+ /// This points to the "main module" which is generally the "output of LLVM"
2355
+ /// or what a user wrote.
2356
+ Main,
2357
+ /// This is selecting an adapter module, identified by name here, where
2358
+ /// something is being lowered into.
2359
+ Adapter(&'a str),
2360
+ }
2361
+
2362
+ impl<'a> CustomModule<'a> {
2363
+ fn debug_name(&self) -> &'a str {
2364
+ match self {
2365
+ CustomModule::Main => "main",
2366
+ CustomModule::Adapter(s) => s,
2367
+ }
2368
+ }
2369
+ }
2370
+
2371
+ impl<'a> Shims<'a> {
2372
+ /// Adds all shims necessary for the instantiation of `for_module`.
2373
+ ///
2374
+ /// This function will iterate over all the imports required by this module
2375
+ /// and for those that require a shim they're registered here.
2376
+ fn append_indirect(
2377
+ &mut self,
2378
+ world: &'a ComponentWorld<'a>,
2379
+ for_module: CustomModule<'a>,
2380
+ ) -> Result<()> {
2381
+ let module_imports = world.imports_for(for_module);
2382
+ let module_exports = world.exports_for(for_module);
2383
+ let resolve = &world.encoder.metadata.resolve;
2384
+
2385
+ for (module, field, import) in module_imports.imports() {
2386
+ match import {
2387
+ // These imports don't require shims, they can be satisfied
2388
+ // as-needed when required.
2389
+ Import::ImportedResourceDrop(..)
2390
+ | Import::MainModuleMemory
2391
+ | Import::MainModuleExport { .. }
2392
+ | Import::Item(_)
2393
+ | Import::ExportedResourceDrop(..)
2394
+ | Import::ExportedResourceRep(..)
2395
+ | Import::ExportedResourceNew(..)
2396
+ | Import::ExportedTaskCancel
2397
+ | Import::ErrorContextDrop
2398
+ | Import::BackpressureInc
2399
+ | Import::BackpressureDec
2400
+ | Import::ThreadYield { .. }
2401
+ | Import::SubtaskDrop
2402
+ | Import::SubtaskCancel { .. }
2403
+ | Import::FutureNew(..)
2404
+ | Import::StreamNew(..)
2405
+ | Import::FutureCancelRead { .. }
2406
+ | Import::FutureCancelWrite { .. }
2407
+ | Import::FutureDropWritable { .. }
2408
+ | Import::FutureDropReadable { .. }
2409
+ | Import::StreamCancelRead { .. }
2410
+ | Import::StreamCancelWrite { .. }
2411
+ | Import::StreamDropWritable { .. }
2412
+ | Import::StreamDropReadable { .. }
2413
+ | Import::WaitableSetNew
2414
+ | Import::WaitableSetDrop
2415
+ | Import::WaitableJoin
2416
+ | Import::ContextGet(_)
2417
+ | Import::ContextSet(_)
2418
+ | Import::ThreadIndex
2419
+ | Import::ThreadSwitchTo { .. }
2420
+ | Import::ThreadSuspend { .. }
2421
+ | Import::ThreadResumeLater
2422
+ | Import::ThreadYieldTo { .. } => {}
2423
+
2424
+ // If `task.return` needs to be indirect then generate a shim
2425
+ // for it, otherwise skip the shim and let it get materialized
2426
+ // naturally later.
2427
+ Import::ExportedTaskReturn(key, interface, func, ty) => {
2428
+ let (options, sig) = task_return_options_and_type(resolve, *ty);
2429
+ if options.is_empty() {
2430
+ continue;
2431
+ }
2432
+ let name = self.shims.len().to_string();
2433
+ let encoding = world
2434
+ .module_metadata_for(for_module)
2435
+ .export_encodings
2436
+ .get(resolve, key, func)
2437
+ .ok_or_else(|| {
2438
+ anyhow::anyhow!(
2439
+ "missing component metadata for export of \
2440
+ `{module}::{field}`"
2441
+ )
2442
+ })?;
2443
+ self.push(Shim {
2444
+ name,
2445
+ debug_name: format!("task-return-{func}"),
2446
+ options,
2447
+ kind: ShimKind::TaskReturn {
2448
+ interface: *interface,
2449
+ func,
2450
+ result: *ty,
2451
+ for_module,
2452
+ encoding,
2453
+ },
2454
+ sig,
2455
+ });
2456
+ }
2457
+
2458
+ Import::FutureWrite { async_, info } => {
2459
+ self.append_indirect_payload_push(
2460
+ resolve,
2461
+ for_module,
2462
+ module,
2463
+ *async_,
2464
+ info,
2465
+ PayloadFuncKind::FutureWrite,
2466
+ vec![WasmType::I32; 2],
2467
+ vec![WasmType::I32],
2468
+ );
2469
+ }
2470
+ Import::FutureRead { async_, info } => {
2471
+ self.append_indirect_payload_push(
2472
+ resolve,
2473
+ for_module,
2474
+ module,
2475
+ *async_,
2476
+ info,
2477
+ PayloadFuncKind::FutureRead,
2478
+ vec![WasmType::I32; 2],
2479
+ vec![WasmType::I32],
2480
+ );
2481
+ }
2482
+ Import::StreamWrite { async_, info } => {
2483
+ self.append_indirect_payload_push(
2484
+ resolve,
2485
+ for_module,
2486
+ module,
2487
+ *async_,
2488
+ info,
2489
+ PayloadFuncKind::StreamWrite,
2490
+ vec![WasmType::I32; 3],
2491
+ vec![WasmType::I32],
2492
+ );
2493
+ }
2494
+ Import::StreamRead { async_, info } => {
2495
+ self.append_indirect_payload_push(
2496
+ resolve,
2497
+ for_module,
2498
+ module,
2499
+ *async_,
2500
+ info,
2501
+ PayloadFuncKind::StreamRead,
2502
+ vec![WasmType::I32; 3],
2503
+ vec![WasmType::I32],
2504
+ );
2505
+ }
2506
+
2507
+ Import::WaitableSetWait { cancellable } => {
2508
+ let name = self.shims.len().to_string();
2509
+ self.push(Shim {
2510
+ name,
2511
+ debug_name: "waitable-set.wait".to_string(),
2512
+ options: RequiredOptions::empty(),
2513
+ kind: ShimKind::WaitableSetWait {
2514
+ cancellable: *cancellable,
2515
+ },
2516
+ sig: WasmSignature {
2517
+ params: vec![WasmType::I32; 2],
2518
+ results: vec![WasmType::I32],
2519
+ indirect_params: false,
2520
+ retptr: false,
2521
+ },
2522
+ });
2523
+ }
2524
+
2525
+ Import::WaitableSetPoll { cancellable } => {
2526
+ let name = self.shims.len().to_string();
2527
+ self.push(Shim {
2528
+ name,
2529
+ debug_name: "waitable-set.poll".to_string(),
2530
+ options: RequiredOptions::empty(),
2531
+ kind: ShimKind::WaitableSetPoll {
2532
+ cancellable: *cancellable,
2533
+ },
2534
+ sig: WasmSignature {
2535
+ params: vec![WasmType::I32; 2],
2536
+ results: vec![WasmType::I32],
2537
+ indirect_params: false,
2538
+ retptr: false,
2539
+ },
2540
+ });
2541
+ }
2542
+
2543
+ Import::ErrorContextNew { encoding } => {
2544
+ let name = self.shims.len().to_string();
2545
+ self.push(Shim {
2546
+ name,
2547
+ debug_name: "error-new".to_string(),
2548
+ options: RequiredOptions::MEMORY | RequiredOptions::STRING_ENCODING,
2549
+ kind: ShimKind::ErrorContextNew {
2550
+ encoding: *encoding,
2551
+ },
2552
+ sig: WasmSignature {
2553
+ params: vec![WasmType::I32; 2],
2554
+ results: vec![WasmType::I32],
2555
+ indirect_params: false,
2556
+ retptr: false,
2557
+ },
2558
+ });
2559
+ }
2560
+
2561
+ Import::ErrorContextDebugMessage { encoding } => {
2562
+ let name = self.shims.len().to_string();
2563
+ self.push(Shim {
2564
+ name,
2565
+ debug_name: "error-debug-message".to_string(),
2566
+ options: RequiredOptions::MEMORY
2567
+ | RequiredOptions::STRING_ENCODING
2568
+ | RequiredOptions::REALLOC,
2569
+ kind: ShimKind::ErrorContextDebugMessage {
2570
+ for_module,
2571
+ encoding: *encoding,
2572
+ },
2573
+ sig: WasmSignature {
2574
+ params: vec![WasmType::I32; 2],
2575
+ results: vec![],
2576
+ indirect_params: false,
2577
+ retptr: false,
2578
+ },
2579
+ });
2580
+ }
2581
+
2582
+ Import::ThreadNewIndirect => {
2583
+ let name = self.shims.len().to_string();
2584
+ self.push(Shim {
2585
+ name,
2586
+ debug_name: "thread.new-indirect".to_string(),
2587
+ options: RequiredOptions::empty(),
2588
+ kind: ShimKind::ThreadNewIndirect {
2589
+ for_module,
2590
+ // This is fixed for now
2591
+ func_ty: FuncType::new([ValType::I32], vec![]),
2592
+ },
2593
+ sig: WasmSignature {
2594
+ params: vec![WasmType::I32; 2],
2595
+ results: vec![WasmType::I32],
2596
+ indirect_params: false,
2597
+ retptr: false,
2598
+ },
2599
+ });
2600
+ }
2601
+
2602
+ // Adapter imports into the main module must got through an
2603
+ // indirection, so that's registered here.
2604
+ Import::AdapterExport { adapter, func, ty } => {
2605
+ let name = self.shims.len().to_string();
2606
+ log::debug!("shim {name} is adapter `{module}::{field}`");
2607
+ self.push(Shim {
2608
+ name,
2609
+ debug_name: format!("adapt-{module}-{field}"),
2610
+ // Pessimistically assume that all adapters require
2611
+ // memory in one form or another. While this isn't
2612
+ // technically true it's true enough for WASI.
2613
+ options: RequiredOptions::MEMORY,
2614
+ kind: ShimKind::Adapter { adapter, func },
2615
+ sig: WasmSignature {
2616
+ params: ty.params().iter().map(to_wasm_type).collect(),
2617
+ results: ty.results().iter().map(to_wasm_type).collect(),
2618
+ indirect_params: false,
2619
+ retptr: false,
2620
+ },
2621
+ });
2622
+
2623
+ fn to_wasm_type(ty: &wasmparser::ValType) -> WasmType {
2624
+ match ty {
2625
+ wasmparser::ValType::I32 => WasmType::I32,
2626
+ wasmparser::ValType::I64 => WasmType::I64,
2627
+ wasmparser::ValType::F32 => WasmType::F32,
2628
+ wasmparser::ValType::F64 => WasmType::F64,
2629
+ _ => unreachable!(),
2630
+ }
2631
+ }
2632
+ }
2633
+
2634
+ // WIT-level functions may require an indirection, so yield some
2635
+ // metadata out of this `match` to the loop below to figure that
2636
+ // out.
2637
+ Import::InterfaceFunc(key, _, name, abi) => {
2638
+ self.append_indirect_wit_func(
2639
+ world,
2640
+ for_module,
2641
+ module,
2642
+ field,
2643
+ key,
2644
+ name,
2645
+ Some(resolve.name_world_key(key)),
2646
+ *abi,
2647
+ )?;
2648
+ }
2649
+ Import::WorldFunc(key, name, abi) => {
2650
+ self.append_indirect_wit_func(
2651
+ world, for_module, module, field, key, name, None, *abi,
2652
+ )?;
2653
+ }
2654
+ }
2655
+ }
2656
+
2657
+ // In addition to all the shims added for imports above this module also
2658
+ // requires shims for resource destructors that it exports. Resource
2659
+ // types are declared before the module is instantiated so the actual
2660
+ // destructor is registered as a shim (defined here) and it's then
2661
+ // filled in with the module's exports later.
2662
+ for (export_name, export) in module_exports.iter() {
2663
+ let id = match export {
2664
+ Export::ResourceDtor(id) => id,
2665
+ _ => continue,
2666
+ };
2667
+ let resource = resolve.types[*id].name.as_ref().unwrap();
2668
+ let name = self.shims.len().to_string();
2669
+ self.push(Shim {
2670
+ name,
2671
+ debug_name: format!("dtor-{resource}"),
2672
+ options: RequiredOptions::empty(),
2673
+ kind: ShimKind::ResourceDtor {
2674
+ module: for_module,
2675
+ export: export_name,
2676
+ },
2677
+ sig: WasmSignature {
2678
+ params: vec![WasmType::I32],
2679
+ results: Vec::new(),
2680
+ indirect_params: false,
2681
+ retptr: false,
2682
+ },
2683
+ });
2684
+ }
2685
+
2686
+ Ok(())
2687
+ }
2688
+
2689
+ /// Helper of `append_indirect` above which pushes information for
2690
+ /// futures/streams read/write intrinsics.
2691
+ fn append_indirect_payload_push(
2692
+ &mut self,
2693
+ resolve: &Resolve,
2694
+ for_module: CustomModule<'a>,
2695
+ module: &str,
2696
+ async_: bool,
2697
+ info: &'a PayloadInfo,
2698
+ kind: PayloadFuncKind,
2699
+ params: Vec<WasmType>,
2700
+ results: Vec<WasmType>,
2701
+ ) {
2702
+ let debug_name = format!("{module}-{}", info.name);
2703
+ let name = self.shims.len().to_string();
2704
+
2705
+ let payload = info.payload(resolve);
2706
+ let (wit_param, wit_result) = match kind {
2707
+ PayloadFuncKind::StreamRead | PayloadFuncKind::FutureRead => (None, payload),
2708
+ PayloadFuncKind::StreamWrite | PayloadFuncKind::FutureWrite => (payload, None),
2709
+ };
2710
+ self.push(Shim {
2711
+ name,
2712
+ debug_name,
2713
+ options: RequiredOptions::MEMORY
2714
+ | RequiredOptions::for_import(
2715
+ resolve,
2716
+ &Function {
2717
+ name: String::new(),
2718
+ kind: FunctionKind::Freestanding,
2719
+ params: match wit_param {
2720
+ Some(ty) => vec![("a".to_string(), ty)],
2721
+ None => Vec::new(),
2722
+ },
2723
+ result: wit_result,
2724
+ docs: Default::default(),
2725
+ stability: Stability::Unknown,
2726
+ },
2727
+ if async_ {
2728
+ AbiVariant::GuestImportAsync
2729
+ } else {
2730
+ AbiVariant::GuestImport
2731
+ },
2732
+ ),
2733
+ kind: ShimKind::PayloadFunc {
2734
+ for_module,
2735
+ info,
2736
+ kind,
2737
+ },
2738
+ sig: WasmSignature {
2739
+ params,
2740
+ results,
2741
+ indirect_params: false,
2742
+ retptr: false,
2743
+ },
2744
+ });
2745
+ }
2746
+
2747
+ /// Helper for `append_indirect` above which will conditionally push a shim
2748
+ /// for the WIT function specified by `interface_key`, `name`, and `abi`.
2749
+ fn append_indirect_wit_func(
2750
+ &mut self,
2751
+ world: &'a ComponentWorld<'a>,
2752
+ for_module: CustomModule<'a>,
2753
+ module: &str,
2754
+ field: &str,
2755
+ key: &WorldKey,
2756
+ name: &String,
2757
+ interface_key: Option<String>,
2758
+ abi: AbiVariant,
2759
+ ) -> Result<()> {
2760
+ let resolve = &world.encoder.metadata.resolve;
2761
+ let metadata = world.module_metadata_for(for_module);
2762
+ let interface = &world.import_map[&interface_key];
2763
+ let (index, _, lowering) = interface.lowerings.get_full(&(name.clone(), abi)).unwrap();
2764
+ let shim_name = self.shims.len().to_string();
2765
+ match lowering {
2766
+ Lowering::Direct | Lowering::ResourceDrop(_) => {}
2767
+
2768
+ Lowering::Indirect { sig, options } => {
2769
+ log::debug!(
2770
+ "shim {shim_name} is import `{module}::{field}` lowering {index} `{name}`",
2771
+ );
2772
+ let encoding = metadata
2773
+ .import_encodings
2774
+ .get(resolve, key, name)
2775
+ .ok_or_else(|| {
2776
+ anyhow::anyhow!(
2777
+ "missing component metadata for import of \
2778
+ `{module}::{field}`"
2779
+ )
2780
+ })?;
2781
+ self.push(Shim {
2782
+ name: shim_name,
2783
+ debug_name: format!("indirect-{module}-{field}"),
2784
+ options: *options,
2785
+ kind: ShimKind::IndirectLowering {
2786
+ interface: interface_key,
2787
+ index,
2788
+ realloc: for_module,
2789
+ encoding,
2790
+ },
2791
+ sig: sig.clone(),
2792
+ });
2793
+ }
2794
+ }
2795
+
2796
+ Ok(())
2797
+ }
2798
+
2799
+ fn push(&mut self, shim: Shim<'a>) {
2800
+ // Only one shim per `ShimKind` is retained, so if it's already present
2801
+ // don't overwrite it. If it's not present though go ahead and insert
2802
+ // it.
2803
+ if !self.shims.contains_key(&shim.kind) {
2804
+ self.shims.insert(shim.kind.clone(), shim);
2805
+ }
2806
+ }
2807
+ }
2808
+
2809
+ fn task_return_options_and_type(
2810
+ resolve: &Resolve,
2811
+ ty: Option<Type>,
2812
+ ) -> (RequiredOptions, WasmSignature) {
2813
+ let func_tmp = Function {
2814
+ name: String::new(),
2815
+ kind: FunctionKind::Freestanding,
2816
+ params: match ty {
2817
+ Some(ty) => vec![("a".to_string(), ty)],
2818
+ None => Vec::new(),
2819
+ },
2820
+ result: None,
2821
+ docs: Default::default(),
2822
+ stability: Stability::Unknown,
2823
+ };
2824
+ let abi = AbiVariant::GuestImport;
2825
+ let options = RequiredOptions::for_import(resolve, &func_tmp, abi);
2826
+ let sig = resolve.wasm_signature(abi, &func_tmp);
2827
+ (options, sig)
2828
+ }
2829
+
2830
+ /// Alias argument to an instantiation
2831
+ #[derive(Clone, Debug)]
2832
+ pub struct Item {
2833
+ pub alias: String,
2834
+ pub kind: ExportKind,
2835
+ pub which: MainOrAdapter,
2836
+ pub name: String,
2837
+ }
2838
+
2839
+ /// Module argument to an instantiation
2840
+ #[derive(Debug, PartialEq, Clone)]
2841
+ pub enum MainOrAdapter {
2842
+ Main,
2843
+ Adapter(String),
2844
+ }
2845
+
2846
+ impl MainOrAdapter {
2847
+ fn to_custom_module(&self) -> CustomModule<'_> {
2848
+ match self {
2849
+ MainOrAdapter::Main => CustomModule::Main,
2850
+ MainOrAdapter::Adapter(s) => CustomModule::Adapter(s),
2851
+ }
2852
+ }
2853
+ }
2854
+
2855
+ /// Module instantiation argument
2856
+ #[derive(Clone)]
2857
+ pub enum Instance {
2858
+ /// Module argument
2859
+ MainOrAdapter(MainOrAdapter),
2860
+
2861
+ /// Alias argument
2862
+ Items(Vec<Item>),
2863
+ }
2864
+
2865
+ /// Provides fine-grained control of how a library module is instantiated
2866
+ /// relative to other module instances
2867
+ #[derive(Clone)]
2868
+ pub struct LibraryInfo {
2869
+ /// If true, instantiate any shims prior to this module
2870
+ pub instantiate_after_shims: bool,
2871
+
2872
+ /// Instantiation arguments
2873
+ pub arguments: Vec<(String, Instance)>,
2874
+ }
2875
+
2876
+ /// Represents an adapter or library to be instantiated as part of the component
2877
+ pub(super) struct Adapter {
2878
+ /// The wasm of the module itself, with `component-type` sections stripped
2879
+ wasm: Vec<u8>,
2880
+
2881
+ /// The metadata for the adapter
2882
+ metadata: ModuleMetadata,
2883
+
2884
+ /// The set of exports from the final world which are defined by this
2885
+ /// adapter or library
2886
+ required_exports: IndexSet<WorldKey>,
2887
+
2888
+ /// If present, treat this module as a library rather than a "minimal" adapter
2889
+ ///
2890
+ /// TODO: We should refactor how various flavors of module are represented
2891
+ /// and differentiated to avoid mistaking one for another.
2892
+ library_info: Option<LibraryInfo>,
2893
+ }
2894
+
2895
+ /// An encoder of components based on `wit` interface definitions.
2896
+ #[derive(Default)]
2897
+ pub struct ComponentEncoder {
2898
+ module: Vec<u8>,
2899
+ module_import_map: Option<ModuleImportMap>,
2900
+ pub(super) metadata: Bindgen,
2901
+ validate: bool,
2902
+ pub(super) main_module_exports: IndexSet<WorldKey>,
2903
+ pub(super) adapters: IndexMap<String, Adapter>,
2904
+ import_name_map: HashMap<String, String>,
2905
+ realloc_via_memory_grow: bool,
2906
+ merge_imports_based_on_semver: Option<bool>,
2907
+ pub(super) reject_legacy_names: bool,
2908
+ debug_names: bool,
2909
+ }
2910
+
2911
+ impl ComponentEncoder {
2912
+ /// Set the core module to encode as a component.
2913
+ /// This method will also parse any component type information stored in custom sections
2914
+ /// inside the module and add them as the interface, imports, and exports.
2915
+ /// It will also add any producers information inside the component type information to the
2916
+ /// core module.
2917
+ pub fn module(mut self, module: &[u8]) -> Result<Self> {
2918
+ let (wasm, metadata) = self.decode(module.as_ref())?;
2919
+ let (wasm, module_import_map) = ModuleImportMap::new(wasm)?;
2920
+ let exports = self
2921
+ .merge_metadata(metadata)
2922
+ .context("failed merge WIT metadata for module with previous metadata")?;
2923
+ self.main_module_exports.extend(exports);
2924
+ self.module = if let Some(producers) = &self.metadata.producers {
2925
+ producers.add_to_wasm(&wasm)?
2926
+ } else {
2927
+ wasm.to_vec()
2928
+ };
2929
+ self.module_import_map = module_import_map;
2930
+ Ok(self)
2931
+ }
2932
+
2933
+ fn decode<'a>(&self, wasm: &'a [u8]) -> Result<(Cow<'a, [u8]>, Bindgen)> {
2934
+ let (bytes, metadata) = metadata::decode(wasm)?;
2935
+ match bytes {
2936
+ Some(wasm) => Ok((Cow::Owned(wasm), metadata)),
2937
+ None => Ok((Cow::Borrowed(wasm), metadata)),
2938
+ }
2939
+ }
2940
+
2941
+ fn merge_metadata(&mut self, metadata: Bindgen) -> Result<IndexSet<WorldKey>> {
2942
+ self.metadata.merge(metadata)
2943
+ }
2944
+
2945
+ /// Sets whether or not the encoder will validate its output.
2946
+ pub fn validate(mut self, validate: bool) -> Self {
2947
+ self.validate = validate;
2948
+ self
2949
+ }
2950
+
2951
+ /// Sets whether or not to generate debug names in the output component.
2952
+ pub fn debug_names(mut self, debug_names: bool) -> Self {
2953
+ self.debug_names = debug_names;
2954
+ self
2955
+ }
2956
+
2957
+ /// Sets whether to merge imports based on semver to the specified value.
2958
+ ///
2959
+ /// This affects how when to WIT worlds are merged together, for example
2960
+ /// from two different libraries, whether their imports are unified when the
2961
+ /// semver version ranges for interface allow it.
2962
+ ///
2963
+ /// This is enabled by default.
2964
+ pub fn merge_imports_based_on_semver(mut self, merge: bool) -> Self {
2965
+ self.merge_imports_based_on_semver = Some(merge);
2966
+ self
2967
+ }
2968
+
2969
+ /// Sets whether to reject the historical mangling/name scheme for core wasm
2970
+ /// imports/exports as they map to the component model.
2971
+ ///
2972
+ /// The `wit-component` crate supported a different set of names prior to
2973
+ /// WebAssembly/component-model#378 and this can be used to disable this
2974
+ /// support.
2975
+ ///
2976
+ /// This is disabled by default.
2977
+ pub fn reject_legacy_names(mut self, reject: bool) -> Self {
2978
+ self.reject_legacy_names = reject;
2979
+ self
2980
+ }
2981
+
2982
+ /// Specifies a new adapter which is used to translate from a historical
2983
+ /// wasm ABI to the canonical ABI and the `interface` provided.
2984
+ ///
2985
+ /// This is primarily used to polyfill, for example,
2986
+ /// `wasi_snapshot_preview1` with a component-model using interface. The
2987
+ /// `name` provided is the module name of the adapter that is being
2988
+ /// polyfilled, for example `"wasi_snapshot_preview1"`.
2989
+ ///
2990
+ /// The `bytes` provided is a core wasm module which implements the `name`
2991
+ /// interface in terms of the `interface` interface. This core wasm module
2992
+ /// is severely restricted in its shape, for example it cannot have any data
2993
+ /// segments or element segments.
2994
+ ///
2995
+ /// The `interface` provided is the component-model-using-interface that the
2996
+ /// wasm module specified by `bytes` imports. The `bytes` will then import
2997
+ /// `interface` and export functions to get imported from the module `name`
2998
+ /// in the core wasm that's being wrapped.
2999
+ pub fn adapter(self, name: &str, bytes: &[u8]) -> Result<Self> {
3000
+ self.library_or_adapter(name, bytes, None)
3001
+ }
3002
+
3003
+ /// Specifies a shared-everything library to link into the component.
3004
+ ///
3005
+ /// Unlike adapters, libraries _may_ have data and/or element segments, but
3006
+ /// they must operate on an imported memory and table, respectively. In
3007
+ /// this case, the correct amount of space is presumed to have been
3008
+ /// statically allocated in the main module's memory and table at the
3009
+ /// offsets which the segments target, e.g. as arranged by
3010
+ /// [super::linking::Linker].
3011
+ ///
3012
+ /// Libraries are treated similarly to adapters, except that they are not
3013
+ /// "minified" the way adapters are, and instantiation is controlled
3014
+ /// declaratively via the `library_info` parameter.
3015
+ pub fn library(self, name: &str, bytes: &[u8], library_info: LibraryInfo) -> Result<Self> {
3016
+ self.library_or_adapter(name, bytes, Some(library_info))
3017
+ }
3018
+
3019
+ fn library_or_adapter(
3020
+ mut self,
3021
+ name: &str,
3022
+ bytes: &[u8],
3023
+ library_info: Option<LibraryInfo>,
3024
+ ) -> Result<Self> {
3025
+ let (wasm, mut metadata) = self.decode(bytes)?;
3026
+ // Merge the adapter's document into our own document to have one large
3027
+ // document, and then afterwards merge worlds as well.
3028
+ //
3029
+ // Note that the `metadata` tracking import/export encodings is removed
3030
+ // since this adapter can get different lowerings and is allowed to
3031
+ // differ from the main module. This is then tracked within the
3032
+ // `Adapter` structure produced below.
3033
+ let adapter_metadata = mem::take(&mut metadata.metadata);
3034
+ let exports = self.merge_metadata(metadata).with_context(|| {
3035
+ format!("failed to merge WIT packages of adapter `{name}` into main packages")
3036
+ })?;
3037
+ if let Some(library_info) = &library_info {
3038
+ // Validate that all referenced modules can be resolved.
3039
+ for (_, instance) in &library_info.arguments {
3040
+ let resolve = |which: &_| match which {
3041
+ MainOrAdapter::Main => Ok(()),
3042
+ MainOrAdapter::Adapter(name) => {
3043
+ if self.adapters.contains_key(name.as_str()) {
3044
+ Ok(())
3045
+ } else {
3046
+ Err(anyhow!("instance refers to unknown adapter `{name}`"))
3047
+ }
3048
+ }
3049
+ };
3050
+
3051
+ match instance {
3052
+ Instance::MainOrAdapter(which) => resolve(which)?,
3053
+ Instance::Items(items) => {
3054
+ for item in items {
3055
+ resolve(&item.which)?;
3056
+ }
3057
+ }
3058
+ }
3059
+ }
3060
+ }
3061
+ self.adapters.insert(
3062
+ name.to_string(),
3063
+ Adapter {
3064
+ wasm: wasm.to_vec(),
3065
+ metadata: adapter_metadata,
3066
+ required_exports: exports,
3067
+ library_info,
3068
+ },
3069
+ );
3070
+ Ok(self)
3071
+ }
3072
+
3073
+ /// True if the realloc and stack allocation should use memory.grow
3074
+ /// The default is to use the main module realloc
3075
+ /// Can be useful if cabi_realloc cannot be called before the host
3076
+ /// runtime is initialized.
3077
+ pub fn realloc_via_memory_grow(mut self, value: bool) -> Self {
3078
+ self.realloc_via_memory_grow = value;
3079
+ self
3080
+ }
3081
+
3082
+ /// The instance import name map to use.
3083
+ ///
3084
+ /// This is used to rename instance imports in the final component.
3085
+ ///
3086
+ /// For example, if there is an instance import `foo:bar/baz` and it is
3087
+ /// desired that the import actually be an `unlocked-dep` name, then
3088
+ /// `foo:bar/baz` can be mapped to `unlocked-dep=<a:b/c@{>=x.y.z}>`.
3089
+ ///
3090
+ /// Note: the replacement names are not validated during encoding unless
3091
+ /// the `validate` option is set to true.
3092
+ pub fn import_name_map(mut self, map: HashMap<String, String>) -> Self {
3093
+ self.import_name_map = map;
3094
+ self
3095
+ }
3096
+
3097
+ /// Encode the component and return the bytes.
3098
+ pub fn encode(&mut self) -> Result<Vec<u8>> {
3099
+ if self.module.is_empty() {
3100
+ bail!("a module is required when encoding a component");
3101
+ }
3102
+
3103
+ if self.merge_imports_based_on_semver.unwrap_or(true) {
3104
+ self.metadata
3105
+ .resolve
3106
+ .merge_world_imports_based_on_semver(self.metadata.world)?;
3107
+ }
3108
+
3109
+ let world = ComponentWorld::new(self).context("failed to decode world from module")?;
3110
+ let mut state = EncodingState {
3111
+ component: ComponentBuilder::default(),
3112
+ module_index: None,
3113
+ instance_index: None,
3114
+ memory_index: None,
3115
+ shim_instance_index: None,
3116
+ fixups_module_index: None,
3117
+ adapter_modules: IndexMap::new(),
3118
+ adapter_instances: IndexMap::new(),
3119
+ import_type_encoding_maps: Default::default(),
3120
+ export_type_encoding_maps: Default::default(),
3121
+ imported_instances: Default::default(),
3122
+ imported_funcs: Default::default(),
3123
+ exported_instances: Default::default(),
3124
+ aliased_core_items: Default::default(),
3125
+ info: &world,
3126
+ };
3127
+ state.encode_imports(&self.import_name_map)?;
3128
+ state.encode_core_modules();
3129
+ state.encode_core_instantiation()?;
3130
+ state.encode_exports(CustomModule::Main)?;
3131
+ for name in self.adapters.keys() {
3132
+ state.encode_exports(CustomModule::Adapter(name))?;
3133
+ }
3134
+ state.component.append_names();
3135
+ state
3136
+ .component
3137
+ .raw_custom_section(&crate::base_producers().raw_custom_section());
3138
+ let bytes = state.component.finish();
3139
+
3140
+ if self.validate {
3141
+ Validator::new_with_features(WasmFeatures::all())
3142
+ .validate_all(&bytes)
3143
+ .context("failed to validate component output")?;
3144
+ }
3145
+
3146
+ Ok(bytes)
3147
+ }
3148
+ }
3149
+
3150
+ impl ComponentWorld<'_> {
3151
+ /// Convenience function to lookup a module's import map.
3152
+ fn imports_for(&self, module: CustomModule) -> &ImportMap {
3153
+ match module {
3154
+ CustomModule::Main => &self.info.imports,
3155
+ CustomModule::Adapter(name) => &self.adapters[name].info.imports,
3156
+ }
3157
+ }
3158
+
3159
+ /// Convenience function to lookup a module's export map.
3160
+ fn exports_for(&self, module: CustomModule) -> &ExportMap {
3161
+ match module {
3162
+ CustomModule::Main => &self.info.exports,
3163
+ CustomModule::Adapter(name) => &self.adapters[name].info.exports,
3164
+ }
3165
+ }
3166
+
3167
+ /// Convenience function to lookup a module's metadata.
3168
+ fn module_metadata_for(&self, module: CustomModule) -> &ModuleMetadata {
3169
+ match module {
3170
+ CustomModule::Main => &self.encoder.metadata.metadata,
3171
+ CustomModule::Adapter(name) => &self.encoder.adapters[name].metadata,
3172
+ }
3173
+ }
3174
+ }
3175
+
3176
+ #[cfg(all(test, feature = "dummy-module"))]
3177
+ mod test {
3178
+ use super::*;
3179
+ use crate::{dummy_module, embed_component_metadata};
3180
+ use wit_parser::ManglingAndAbi;
3181
+
3182
+ #[test]
3183
+ fn it_renames_imports() {
3184
+ let mut resolve = Resolve::new();
3185
+ let pkg = resolve
3186
+ .push_str(
3187
+ "test.wit",
3188
+ r#"
3189
+ package test:wit;
3190
+
3191
+ interface i {
3192
+ f: func();
3193
+ }
3194
+
3195
+ world test {
3196
+ import i;
3197
+ import foo: interface {
3198
+ f: func();
3199
+ }
3200
+ }
3201
+ "#,
3202
+ )
3203
+ .unwrap();
3204
+ let world = resolve.select_world(&[pkg], None).unwrap();
3205
+
3206
+ let mut module = dummy_module(&resolve, world, ManglingAndAbi::Standard32);
3207
+
3208
+ embed_component_metadata(&mut module, &resolve, world, StringEncoding::UTF8).unwrap();
3209
+
3210
+ let encoded = ComponentEncoder::default()
3211
+ .import_name_map(HashMap::from([
3212
+ (
3213
+ "foo".to_string(),
3214
+ "unlocked-dep=<foo:bar/foo@{>=1.0.0 <1.1.0}>".to_string(),
3215
+ ),
3216
+ (
3217
+ "test:wit/i".to_string(),
3218
+ "locked-dep=<foo:bar/i@1.2.3>".to_string(),
3219
+ ),
3220
+ ]))
3221
+ .module(&module)
3222
+ .unwrap()
3223
+ .validate(true)
3224
+ .encode()
3225
+ .unwrap();
3226
+
3227
+ let wat = wasmprinter::print_bytes(encoded).unwrap();
3228
+ assert!(wat.contains("unlocked-dep=<foo:bar/foo@{>=1.0.0 <1.1.0}>"));
3229
+ assert!(wat.contains("locked-dep=<foo:bar/i@1.2.3>"));
3230
+ }
3231
+ }