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,3020 @@
1
+ use crate::bindgen::{FunctionBindgen, POINTER_SIZE_EXPRESSION};
2
+ use crate::{
3
+ ConstructorReturnType, FnSig, Identifier, InterfaceName, Ownership, RuntimeItem, RustFlagsRepr,
4
+ RustWasm, TypeGeneration, classify_constructor_return_type, full_wit_type_name, int_repr,
5
+ to_rust_ident, to_upper_camel_case, wasm_type,
6
+ };
7
+ use anyhow::Result;
8
+ use heck::*;
9
+ use std::collections::{BTreeMap, BTreeSet};
10
+ use std::fmt::Write as _;
11
+ use std::mem;
12
+ use wit_bindgen_core::abi::{self, AbiVariant, LiftLower};
13
+ use wit_bindgen_core::{
14
+ AnonymousTypeGenerator, Source, TypeInfo, dealias, uwrite, uwriteln, wit_parser::*,
15
+ };
16
+
17
+ pub struct InterfaceGenerator<'a> {
18
+ pub src: Source,
19
+ pub(super) identifier: Identifier<'a>,
20
+ pub in_import: bool,
21
+ pub sizes: SizeAlign,
22
+ pub(super) r#gen: &'a mut RustWasm,
23
+ pub wasm_import_module: &'a str,
24
+ pub resolve: &'a Resolve,
25
+ pub return_pointer_area_size: ArchitectureSize,
26
+ pub return_pointer_area_align: Alignment,
27
+ pub(super) needs_runtime_module: bool,
28
+ }
29
+
30
+ /// A description of the "mode" in which a type is printed.
31
+ ///
32
+ /// Rust types can either be "borrowed" or "owned". This primarily has to do
33
+ /// with lists and imports where arguments to imports can be borrowed lists in
34
+ /// theory as ownership is not taken from the caller. This structure is used to
35
+ /// help with this fact in addition to the various codegen options of this
36
+ /// generator. Namely types in WIT can be reflected into Rust as two separate
37
+ /// types, one "owned" and one "borrowed" (aka one with `Vec` and one with
38
+ /// `&[T]`).
39
+ ///
40
+ /// This structure is used in conjunction with `modes_of` and `type_mode_for*`
41
+ /// primarily. That enables creating a programmatic description of what a type
42
+ /// is rendered as along with various options.
43
+ ///
44
+ /// Note that a `TypeMode` is a description of a single "level" of a type. This
45
+ /// means that there's one mode for `Vec<T>` and one mode for `T` internally.
46
+ /// This is mostly used for things like records where some fields have lifetime
47
+ /// parameters, for example, and others don't.
48
+ ///
49
+ /// This type is intended to simplify generation of types and encapsulate all
50
+ /// the knowledge about whether lifetime parameters are used and how lists are
51
+ /// rendered.
52
+ ///
53
+ /// There are currently two users of lifetime parameters:
54
+ ///
55
+ /// * Lists - when borrowed these are rendered as either `&[T]` or `&str`.
56
+ /// * Borrowed resources - for resources owned by the current module they're
57
+ /// represented as `&T` and for borrows of imported resources they're
58
+ /// represented, more-or-less, as `&Resource<T>`.
59
+ ///
60
+ /// Lists have a choice of being rendered as borrowed or not but resources are
61
+ /// required to be borrowed.
62
+ #[derive(Debug, Copy, Clone, PartialEq)]
63
+ struct TypeMode {
64
+ /// The lifetime parameter, if any, for this type. If present this type is
65
+ /// required to have a lifetime parameter.
66
+ lifetime: Option<&'static str>,
67
+
68
+ /// Whether or not lists are borrowed in this type.
69
+ ///
70
+ /// If this field is `true` then lists are rendered as `&[T]` and `&str`
71
+ /// rather than their owned equivalent. If this field is `false` than the
72
+ /// owned equivalents are used instead.
73
+ lists_borrowed: bool,
74
+
75
+ /// The "style" of ownership that this mode was created with.
76
+ ///
77
+ /// This information is used to determine what mode the next layer deep int
78
+ /// he type tree is rendered with. For example if this layer is owned so is
79
+ /// the next layer. This is primarily used for the "OnlyTopBorrowed"
80
+ /// ownership style where all further layers beneath that are `Owned`.
81
+ style: TypeOwnershipStyle,
82
+ }
83
+
84
+ /// The style of ownership of a type, used to initially create a `TypeMode` and
85
+ /// stored internally within it as well.
86
+ #[derive(Debug, Copy, Clone, PartialEq)]
87
+ enum TypeOwnershipStyle {
88
+ /// This style means owned things are printed such as `Vec<T>` and `String`.
89
+ ///
90
+ /// Note that this primarily applies to lists.
91
+ Owned,
92
+
93
+ /// This style means that lists/strings are `&[T]` and `&str`.
94
+ ///
95
+ /// Note that this primarily applies to lists.
96
+ Borrowed,
97
+
98
+ /// This style means that the top-level of a type is borrowed but all other
99
+ /// layers are `Owned`.
100
+ ///
101
+ /// This is used for parameters in the "owning" mode of generation to
102
+ /// imports. It's easy enough to create a `&T` at the root layer but it's
103
+ /// more difficult to create `&T` stored within a `U`, for example.
104
+ OnlyTopBorrowed,
105
+ }
106
+
107
+ impl TypeMode {
108
+ /// Returns a mode where everything is indicated that it's supposed to be
109
+ /// rendered as an "owned" type.
110
+ fn owned() -> TypeMode {
111
+ TypeMode {
112
+ lifetime: None,
113
+ lists_borrowed: false,
114
+ style: TypeOwnershipStyle::Owned,
115
+ }
116
+ }
117
+ }
118
+
119
+ impl TypeOwnershipStyle {
120
+ /// Preserves this mode except for `OnlyTopBorrowed` where it switches it to
121
+ /// `Owned`.
122
+ fn next(&self) -> TypeOwnershipStyle {
123
+ match self {
124
+ TypeOwnershipStyle::Owned => TypeOwnershipStyle::Owned,
125
+ TypeOwnershipStyle::Borrowed => TypeOwnershipStyle::Borrowed,
126
+ TypeOwnershipStyle::OnlyTopBorrowed => TypeOwnershipStyle::Owned,
127
+ }
128
+ }
129
+ }
130
+
131
+ enum PayloadFor {
132
+ Future,
133
+ Stream,
134
+ }
135
+
136
+ impl<'i> InterfaceGenerator<'i> {
137
+ pub(super) fn generate_exports<'a>(
138
+ &mut self,
139
+ interface: Option<(InterfaceId, &WorldKey)>,
140
+ funcs: impl Iterator<Item = &'a Function> + Clone,
141
+ ) -> Result<String> {
142
+ let mut traits = BTreeMap::new();
143
+ let mut funcs_to_export = Vec::new();
144
+ let mut resources_to_drop = Vec::new();
145
+
146
+ traits.insert(None, ("Guest".to_string(), Vec::new()));
147
+
148
+ if let Some((id, _)) = interface {
149
+ for (name, id) in self.resolve.interfaces[id].types.iter() {
150
+ match self.resolve.types[*id].kind {
151
+ TypeDefKind::Resource => {}
152
+ _ => continue,
153
+ }
154
+ resources_to_drop.push(name);
155
+ let camel = name.to_upper_camel_case();
156
+ traits.insert(Some(*id), (format!("Guest{camel}"), Vec::new()));
157
+ }
158
+ }
159
+
160
+ for func in funcs {
161
+ if self.r#gen.skip.contains(&func.name) {
162
+ continue;
163
+ }
164
+
165
+ let async_ = self
166
+ .r#gen
167
+ .is_async(self.resolve, interface.map(|p| p.1), func, false);
168
+ let resource = func.kind.resource();
169
+
170
+ funcs_to_export.push((func, resource, async_));
171
+ let (trait_name, methods) = traits.get_mut(&resource).unwrap();
172
+ self.generate_guest_export(func, interface.map(|(_, k)| k), &trait_name, async_);
173
+
174
+ let prev = mem::take(&mut self.src);
175
+ let mut sig = FnSig {
176
+ async_,
177
+ use_item_name: true,
178
+ private: true,
179
+ ..Default::default()
180
+ };
181
+ sig.update_for_func(&func);
182
+ self.print_signature(func, true, &sig);
183
+ self.src.push_str(";\n");
184
+ let trait_method = mem::replace(&mut self.src, prev);
185
+ methods.push(trait_method);
186
+ }
187
+
188
+ let (name, methods) = traits.remove(&None).unwrap();
189
+ if !methods.is_empty() || !traits.is_empty() {
190
+ self.generate_interface_trait(
191
+ &name,
192
+ &methods,
193
+ traits
194
+ .iter()
195
+ .map(|(resource, (trait_name, ..))| (resource.unwrap(), trait_name.as_str())),
196
+ )
197
+ }
198
+
199
+ for (resource, (trait_name, methods)) in traits.iter() {
200
+ uwriteln!(self.src, "pub trait {trait_name}: 'static {{");
201
+ let resource = resource.unwrap();
202
+ let resource_name = self.resolve.types[resource].name.as_ref().unwrap();
203
+ let (_, interface_name) = interface.unwrap();
204
+ let module = self.resolve.name_world_key(interface_name);
205
+ let wasm_import_module = format!("[export]{module}");
206
+ let import_new = crate::declare_import(
207
+ &wasm_import_module,
208
+ &format!("[resource-new]{resource_name}"),
209
+ "new",
210
+ &[abi::WasmType::Pointer],
211
+ &[abi::WasmType::I32],
212
+ );
213
+ let import_rep = crate::declare_import(
214
+ &wasm_import_module,
215
+ &format!("[resource-rep]{resource_name}"),
216
+ "rep",
217
+ &[abi::WasmType::I32],
218
+ &[abi::WasmType::Pointer],
219
+ );
220
+ uwriteln!(
221
+ self.src,
222
+ r#"
223
+ #[doc(hidden)]
224
+ unsafe fn _resource_new(val: *mut u8) -> u32
225
+ where Self: Sized
226
+ {{
227
+ {import_new}
228
+ unsafe {{ new(val) as u32 }}
229
+ }}
230
+
231
+ #[doc(hidden)]
232
+ fn _resource_rep(handle: u32) -> *mut u8
233
+ where Self: Sized
234
+ {{
235
+ {import_rep}
236
+ unsafe {{ rep(handle as i32) }}
237
+ }}
238
+
239
+ "#
240
+ );
241
+ for method in methods {
242
+ self.src.push_str(method);
243
+ }
244
+ uwriteln!(self.src, "}}");
245
+ }
246
+
247
+ let macro_name = match interface {
248
+ None => {
249
+ let world = match self.identifier {
250
+ Identifier::World(w) => w,
251
+ Identifier::Interface(..) | Identifier::StreamOrFuturePayload => unreachable!(),
252
+ };
253
+ let world = self.resolve.worlds[world].name.to_snake_case();
254
+ format!("__export_world_{world}_cabi")
255
+ }
256
+ Some((_, name)) => {
257
+ format!(
258
+ "__export_{}_cabi",
259
+ self.resolve
260
+ .name_world_key(name)
261
+ .to_snake_case()
262
+ .chars()
263
+ .map(|c| if !c.is_alphanumeric() { '_' } else { c })
264
+ .collect::<String>()
265
+ )
266
+ }
267
+ };
268
+ let (macro_export, use_vis) = if self.r#gen.opts.pub_export_macro {
269
+ ("#[macro_export]", "pub")
270
+ } else {
271
+ ("", "pub(crate)")
272
+ };
273
+
274
+ uwriteln!(
275
+ self.src,
276
+ "\
277
+ #[doc(hidden)]
278
+ {macro_export}
279
+ macro_rules! {macro_name} {{
280
+ ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = {{
281
+ "
282
+ );
283
+
284
+ for (func, resource, async_) in funcs_to_export {
285
+ let ty = match resource {
286
+ None => "$ty".to_string(),
287
+ Some(id) => {
288
+ let name = self.resolve.types[id]
289
+ .name
290
+ .as_ref()
291
+ .unwrap()
292
+ .to_upper_camel_case();
293
+ format!("<$ty as $($path_to_types)*::Guest>::{name}")
294
+ }
295
+ };
296
+ self.generate_raw_cabi_export(func, &ty, "$($path_to_types)*", async_);
297
+ }
298
+ let export_prefix = self.r#gen.opts.export_prefix.as_deref().unwrap_or("");
299
+ for name in resources_to_drop {
300
+ let module = match self.identifier {
301
+ Identifier::Interface(_, key) => self.resolve.name_world_key(key),
302
+ Identifier::World(_) | Identifier::StreamOrFuturePayload => {
303
+ unreachable!()
304
+ }
305
+ };
306
+ let camel = name.to_upper_camel_case();
307
+ uwriteln!(
308
+ self.src,
309
+ r#"
310
+ const _: () = {{
311
+ #[doc(hidden)]
312
+ #[unsafe(export_name = "{export_prefix}{module}#[dtor]{name}")]
313
+ #[allow(non_snake_case)]
314
+ unsafe extern "C" fn dtor(rep: *mut u8) {{
315
+ unsafe {{
316
+ $($path_to_types)*::{camel}::dtor::<
317
+ <$ty as $($path_to_types)*::Guest>::{camel}
318
+ >(rep)
319
+ }}
320
+ }}
321
+ }};
322
+ "#
323
+ );
324
+ }
325
+ uwriteln!(self.src, "}};);");
326
+ uwriteln!(self.src, "}}");
327
+ uwriteln!(self.src, "#[doc(hidden)]");
328
+ uwriteln!(self.src, "{use_vis} use {macro_name};");
329
+ Ok(macro_name)
330
+ }
331
+
332
+ fn generate_interface_trait<'a>(
333
+ &mut self,
334
+ trait_name: &str,
335
+ methods: &[Source],
336
+ resource_traits: impl Iterator<Item = (TypeId, &'a str)>,
337
+ ) {
338
+ uwriteln!(self.src, "pub trait {trait_name} {{");
339
+ for (id, trait_name) in resource_traits {
340
+ let name = self.resolve.types[id]
341
+ .name
342
+ .as_ref()
343
+ .unwrap()
344
+ .to_upper_camel_case();
345
+ uwriteln!(self.src, "type {name}: {trait_name};");
346
+ }
347
+ for method in methods {
348
+ self.src.push_str(method);
349
+ }
350
+ uwriteln!(self.src, "}}");
351
+ }
352
+
353
+ pub fn generate_imports<'a>(
354
+ &mut self,
355
+ funcs: impl Iterator<Item = &'a Function>,
356
+ interface: Option<&WorldKey>,
357
+ ) {
358
+ for func in funcs {
359
+ self.generate_guest_import(func, interface);
360
+ }
361
+ }
362
+
363
+ pub fn align_area(&mut self, alignment: Alignment) {
364
+ match alignment {
365
+ Alignment::Pointer => uwriteln!(
366
+ self.src,
367
+ "#[cfg_attr(target_pointer_width=\"64\", repr(align(8)))]
368
+ #[cfg_attr(target_pointer_width=\"32\", repr(align(4)))]"
369
+ ),
370
+ Alignment::Bytes(bytes) => {
371
+ uwriteln!(self.src, "#[repr(align({align}))]", align = bytes.get())
372
+ }
373
+ }
374
+ }
375
+
376
+ pub fn finish(&mut self) -> String {
377
+ if !self.return_pointer_area_size.is_empty() {
378
+ uwriteln!(self.src,);
379
+ self.align_area(self.return_pointer_area_align);
380
+ uwrite!(
381
+ self.src,
382
+ "struct _RetArea([::core::mem::MaybeUninit::<u8>; {size}]);
383
+ static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); {size}]);
384
+ ",
385
+ size = self.return_pointer_area_size.format_term(POINTER_SIZE_EXPRESSION, true),
386
+ );
387
+ }
388
+
389
+ let src = mem::take(&mut self.src).into();
390
+
391
+ if self.needs_runtime_module {
392
+ let root = self.path_to_root();
393
+ if !root.is_empty() {
394
+ return format!("use {root}_rt;\n{src}");
395
+ }
396
+ }
397
+ src
398
+ }
399
+
400
+ pub(crate) fn path_to_root(&self) -> String {
401
+ let mut path_to_root = String::new();
402
+
403
+ match self.identifier {
404
+ Identifier::Interface(_, key) => {
405
+ // Escape the submodule for this interface
406
+ path_to_root.push_str("super::");
407
+
408
+ // Escape the `exports` top-level submodule
409
+ if !self.in_import {
410
+ path_to_root.push_str("super::");
411
+ }
412
+
413
+ // Escape the namespace/package submodules for interface-based ids
414
+ match key {
415
+ WorldKey::Name(_) => {}
416
+ WorldKey::Interface(_) => {
417
+ path_to_root.push_str("super::super::");
418
+ }
419
+ }
420
+ }
421
+ Identifier::StreamOrFuturePayload => path_to_root.push_str("super::super::"),
422
+ _ => {}
423
+ }
424
+ path_to_root
425
+ }
426
+
427
+ pub fn start_append_submodule(&mut self, name: &WorldKey) -> (String, Vec<String>) {
428
+ let snake = match name {
429
+ WorldKey::Name(name) => to_rust_ident(name),
430
+ WorldKey::Interface(id) => {
431
+ to_rust_ident(self.resolve.interfaces[*id].name.as_ref().unwrap())
432
+ }
433
+ };
434
+ let module_path = crate::compute_module_path(name, &self.resolve, !self.in_import);
435
+ (snake, module_path)
436
+ }
437
+
438
+ pub fn finish_append_submodule(mut self, snake: &str, module_path: Vec<String>, docs: &Docs) {
439
+ let module = self.finish();
440
+
441
+ self.rustdoc(docs);
442
+ let docs = mem::take(&mut self.src).to_string();
443
+ let docs = docs.trim_end();
444
+
445
+ let path_to_root = self.path_to_root();
446
+ let used_static = if self.r#gen.opts.disable_custom_section_link_helpers {
447
+ String::new()
448
+ } else {
449
+ format!(
450
+ "\
451
+ #[used]
452
+ #[doc(hidden)]
453
+ static __FORCE_SECTION_REF: fn() =
454
+ {path_to_root}__link_custom_section_describing_imports;
455
+ "
456
+ )
457
+ };
458
+ let module = format!(
459
+ "\
460
+ {docs}
461
+ #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
462
+ pub mod {snake} {{
463
+ {used_static}
464
+ {module}
465
+ }}
466
+ ",
467
+ );
468
+ let map = if self.in_import {
469
+ &mut self.r#gen.import_modules
470
+ } else {
471
+ &mut self.r#gen.export_modules
472
+ };
473
+ map.push((module, module_path))
474
+ }
475
+
476
+ fn generate_payloads(&mut self, prefix: &str, func: &Function, interface: Option<&WorldKey>) {
477
+ let old_identifier = mem::replace(&mut self.identifier, Identifier::StreamOrFuturePayload);
478
+
479
+ for (index, ty) in func
480
+ .find_futures_and_streams(self.resolve)
481
+ .into_iter()
482
+ .enumerate()
483
+ {
484
+ let module = format!(
485
+ "{prefix}{}",
486
+ interface
487
+ .map(|name| self.resolve.name_world_key(name))
488
+ .unwrap_or_else(|| "$root".into())
489
+ );
490
+ let func_name = &func.name;
491
+
492
+ match &self.resolve.types[ty].kind {
493
+ TypeDefKind::Future(payload_type) => {
494
+ self.generate_payload(
495
+ PayloadFor::Future,
496
+ &module,
497
+ index,
498
+ func_name,
499
+ payload_type.as_ref(),
500
+ );
501
+ }
502
+ TypeDefKind::Stream(payload_type) => {
503
+ self.generate_payload(
504
+ PayloadFor::Stream,
505
+ &module,
506
+ index,
507
+ func_name,
508
+ payload_type.as_ref(),
509
+ );
510
+ }
511
+ _ => unreachable!(),
512
+ }
513
+ }
514
+
515
+ self.identifier = old_identifier;
516
+ }
517
+
518
+ fn generate_payload(
519
+ &mut self,
520
+ payload_for: PayloadFor,
521
+ module: &str,
522
+ index: usize,
523
+ func_name: &str,
524
+ payload_type: Option<&Type>,
525
+ ) {
526
+ let name = if let Some(payload_type) = payload_type {
527
+ self.type_name_owned(payload_type)
528
+ } else {
529
+ "()".into()
530
+ };
531
+ let map = match payload_for {
532
+ PayloadFor::Future => &mut self.r#gen.future_payloads,
533
+ PayloadFor::Stream => &mut self.r#gen.stream_payloads,
534
+ };
535
+
536
+ if map.contains_key(&name) {
537
+ return;
538
+ }
539
+ let ordinal = map.len();
540
+ let async_support = self.r#gen.async_support_path();
541
+ let (size, align) = if let Some(payload_type) = payload_type {
542
+ (
543
+ self.sizes.size(payload_type),
544
+ self.sizes.align(payload_type),
545
+ )
546
+ } else {
547
+ (
548
+ ArchitectureSize {
549
+ bytes: 0,
550
+ pointers: 0,
551
+ },
552
+ Alignment::default(),
553
+ )
554
+ };
555
+ let size = size.size_wasm32();
556
+ let align = align.align_wasm32();
557
+ let lift;
558
+ let lower;
559
+ let dealloc_lists;
560
+ if let Some(payload_type) = payload_type {
561
+ lift = self.lift_from_memory("ptr", &payload_type, &module);
562
+ dealloc_lists = self.deallocate_lists(
563
+ std::slice::from_ref(payload_type),
564
+ &["ptr".to_string()],
565
+ true,
566
+ &module,
567
+ );
568
+ lower = self.lower_to_memory("ptr", "value", &payload_type, &module);
569
+ } else {
570
+ lift = format!("let _ = ptr;");
571
+ lower = format!("let _ = (ptr, value);");
572
+ dealloc_lists = format!("let _ = ptr;");
573
+ }
574
+ let import_prefix = match payload_for {
575
+ PayloadFor::Future => "future",
576
+ PayloadFor::Stream => "stream",
577
+ };
578
+ let camel = match payload_for {
579
+ PayloadFor::Future => "Future",
580
+ PayloadFor::Stream => "Stream",
581
+ };
582
+ let start_extra = match payload_for {
583
+ PayloadFor::Future => "",
584
+ PayloadFor::Stream => ", _: usize",
585
+ };
586
+ let mut lift_fn = format!("unsafe fn lift(ptr: *mut u8) -> {name} {{ {lift} }}");
587
+ let mut lower_fn = format!("unsafe fn lower(value: {name}, ptr: *mut u8) {{ {lower} }}");
588
+ let mut dealloc_lists_fn =
589
+ format!("unsafe fn dealloc_lists(ptr: *mut u8) {{ {dealloc_lists} }}");
590
+ let mut lift_arg = "lift";
591
+ let mut lower_arg = "lower";
592
+ let mut dealloc_lists_arg = "dealloc_lists";
593
+
594
+ if let PayloadFor::Stream = payload_for {
595
+ lift_arg = "lift: Some(lift)";
596
+ lower_arg = "lower: Some(lower)";
597
+ dealloc_lists_arg = "dealloc_lists: Some(dealloc_lists)";
598
+
599
+ let is_list_canonical = match payload_type {
600
+ Some(ty) => self.is_list_canonical(ty),
601
+ None => true,
602
+ };
603
+
604
+ if is_list_canonical {
605
+ lift_arg = "lift: None";
606
+ lower_arg = "lower: None";
607
+ dealloc_lists_arg = "dealloc_lists: None";
608
+ lift_fn = String::new();
609
+ lower_fn = String::new();
610
+ dealloc_lists_fn = String::new();
611
+ }
612
+ }
613
+
614
+ let code = format!(
615
+ r#"
616
+ #[doc(hidden)]
617
+ #[allow(unused_unsafe)]
618
+ pub mod vtable{ordinal} {{
619
+
620
+ #[cfg(not(target_arch = "wasm32"))]
621
+ unsafe extern "C" fn cancel_write(_: u32) -> u32 {{ unreachable!() }}
622
+ #[cfg(not(target_arch = "wasm32"))]
623
+ unsafe extern "C" fn cancel_read(_: u32) -> u32 {{ unreachable!() }}
624
+ #[cfg(not(target_arch = "wasm32"))]
625
+ unsafe extern "C" fn drop_writable(_: u32) {{ unreachable!() }}
626
+ #[cfg(not(target_arch = "wasm32"))]
627
+ unsafe extern "C" fn drop_readable(_: u32) {{ unreachable!() }}
628
+ #[cfg(not(target_arch = "wasm32"))]
629
+ unsafe extern "C" fn new() -> u64 {{ unreachable!() }}
630
+ #[cfg(not(target_arch = "wasm32"))]
631
+ unsafe extern "C" fn start_read(_: u32, _: *mut u8{start_extra}) -> u32 {{ unreachable!() }}
632
+ #[cfg(not(target_arch = "wasm32"))]
633
+ unsafe extern "C" fn start_write(_: u32, _: *const u8{start_extra}) -> u32 {{ unreachable!() }}
634
+
635
+ #[cfg(target_arch = "wasm32")]
636
+ #[link(wasm_import_module = "{module}")]
637
+ unsafe extern "C" {{
638
+ #[link_name = "[{import_prefix}-new-{index}]{func_name}"]
639
+ fn new() -> u64;
640
+ #[link_name = "[{import_prefix}-cancel-write-{index}]{func_name}"]
641
+ fn cancel_write(_: u32) -> u32;
642
+ #[link_name = "[{import_prefix}-cancel-read-{index}]{func_name}"]
643
+ fn cancel_read(_: u32) -> u32;
644
+ #[link_name = "[{import_prefix}-drop-writable-{index}]{func_name}"]
645
+ fn drop_writable(_: u32);
646
+ #[link_name = "[{import_prefix}-drop-readable-{index}]{func_name}"]
647
+ fn drop_readable(_: u32);
648
+ #[link_name = "[async-lower][{import_prefix}-read-{index}]{func_name}"]
649
+ fn start_read(_: u32, _: *mut u8{start_extra}) -> u32;
650
+ #[link_name = "[async-lower][{import_prefix}-write-{index}]{func_name}"]
651
+ fn start_write(_: u32, _: *const u8{start_extra}) -> u32;
652
+ }}
653
+
654
+ {lift_fn}
655
+ {lower_fn}
656
+ {dealloc_lists_fn}
657
+
658
+ pub static VTABLE: {async_support}::{camel}Vtable<{name}> = {async_support}::{camel}Vtable::<{name}> {{
659
+ cancel_write,
660
+ cancel_read,
661
+ drop_writable,
662
+ drop_readable,
663
+ {dealloc_lists_arg},
664
+ layout: unsafe {{
665
+ ::std::alloc::Layout::from_size_align_unchecked({size}, {align})
666
+ }},
667
+ {lift_arg},
668
+ {lower_arg},
669
+ new,
670
+ start_read,
671
+ start_write,
672
+ }};
673
+
674
+ impl super::{camel}Payload for {name} {{
675
+ const VTABLE: &'static {async_support}::{camel}Vtable<Self> = &VTABLE;
676
+ }}
677
+ }}
678
+ "#,
679
+ );
680
+
681
+ let map = match payload_for {
682
+ PayloadFor::Future => &mut self.r#gen.future_payloads,
683
+ PayloadFor::Stream => &mut self.r#gen.stream_payloads,
684
+ };
685
+ map.insert(name, code);
686
+ }
687
+
688
+ fn generate_guest_import(&mut self, func: &Function, interface: Option<&WorldKey>) {
689
+ if self.r#gen.skip.contains(&func.name) {
690
+ return;
691
+ }
692
+
693
+ self.generate_payloads("", func, interface);
694
+
695
+ let async_ = self.r#gen.is_async(self.resolve, interface, func, true);
696
+ let mut sig = FnSig {
697
+ async_,
698
+ ..Default::default()
699
+ };
700
+ if let Some(id) = func.kind.resource() {
701
+ let name = self.resolve.types[id].name.as_ref().unwrap();
702
+ let name = to_upper_camel_case(name);
703
+ uwriteln!(self.src, "impl {name} {{");
704
+ sig.use_item_name = true;
705
+ sig.update_for_func(&func);
706
+ }
707
+ self.src.push_str("#[allow(unused_unsafe, clippy::all)]\n");
708
+ let params = self.print_signature(func, async_, &sig);
709
+ self.src.push_str("{\n");
710
+ self.src.push_str("unsafe {\n");
711
+
712
+ if async_ {
713
+ self.generate_guest_import_body_async(&self.wasm_import_module, func, params);
714
+ } else {
715
+ self.generate_guest_import_body_sync(&self.wasm_import_module, func, params);
716
+ }
717
+
718
+ self.src.push_str("}\n");
719
+ self.src.push_str("}\n");
720
+
721
+ if func.kind.resource().is_some() {
722
+ self.src.push_str("}\n");
723
+ }
724
+ }
725
+
726
+ fn lower_to_memory(&mut self, address: &str, value: &str, ty: &Type, module: &str) -> String {
727
+ let mut f = FunctionBindgen::new(self, Vec::new(), module, true);
728
+ abi::lower_to_memory(f.r#gen.resolve, &mut f, address.into(), value.into(), ty);
729
+ format!("unsafe {{ {} }}", String::from(f.src))
730
+ }
731
+
732
+ fn deallocate_lists(
733
+ &mut self,
734
+ types: &[Type],
735
+ operands: &[String],
736
+ indirect: bool,
737
+ module: &str,
738
+ ) -> String {
739
+ let mut f = FunctionBindgen::new(self, Vec::new(), module, true);
740
+ abi::deallocate_lists_in_types(f.r#gen.resolve, types, operands, indirect, &mut f);
741
+ format!("unsafe {{ {} }}", String::from(f.src))
742
+ }
743
+
744
+ fn deallocate_lists_and_own(
745
+ &mut self,
746
+ types: &[Type],
747
+ operands: &[String],
748
+ indirect: bool,
749
+ module: &str,
750
+ ) -> String {
751
+ let mut f = FunctionBindgen::new(self, Vec::new(), module, true);
752
+ abi::deallocate_lists_and_own_in_types(f.r#gen.resolve, types, operands, indirect, &mut f);
753
+ format!("unsafe {{ {} }}", String::from(f.src))
754
+ }
755
+
756
+ fn lift_from_memory(&mut self, address: &str, ty: &Type, module: &str) -> String {
757
+ let mut f = FunctionBindgen::new(self, Vec::new(), module, true);
758
+ let result = abi::lift_from_memory(f.r#gen.resolve, &mut f, address.into(), ty);
759
+ format!("unsafe {{ {}\n{result} }}", String::from(f.src))
760
+ }
761
+
762
+ fn generate_guest_import_body_sync(
763
+ &mut self,
764
+ module: &str,
765
+ func: &Function,
766
+ params: Vec<String>,
767
+ ) {
768
+ let mut f = FunctionBindgen::new(self, params, module, false);
769
+ abi::call(
770
+ f.r#gen.resolve,
771
+ AbiVariant::GuestImport,
772
+ LiftLower::LowerArgsLiftResults,
773
+ func,
774
+ &mut f,
775
+ false,
776
+ );
777
+ let FunctionBindgen {
778
+ needs_cleanup_list,
779
+ src,
780
+ import_return_pointer_area_size,
781
+ import_return_pointer_area_align,
782
+ handle_decls,
783
+ ..
784
+ } = f;
785
+
786
+ if needs_cleanup_list {
787
+ let vec = self.path_to_vec();
788
+ uwriteln!(self.src, "let mut cleanup_list = {vec}::new();");
789
+ }
790
+ assert!(handle_decls.is_empty());
791
+ if !import_return_pointer_area_size.is_empty() {
792
+ uwriteln!(self.src,);
793
+ self.align_area(import_return_pointer_area_align);
794
+ uwrite!(
795
+ self.src,
796
+ "struct RetArea([::core::mem::MaybeUninit::<u8>; {import_return_pointer_area_size}]);
797
+ let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); {import_return_pointer_area_size}]);
798
+ ", import_return_pointer_area_size = import_return_pointer_area_size.format_term(POINTER_SIZE_EXPRESSION, true)
799
+ );
800
+ }
801
+ self.src.push_str(&String::from(src));
802
+ }
803
+
804
+ fn generate_guest_import_body_async(
805
+ &mut self,
806
+ module: &str,
807
+ func: &Function,
808
+ mut params: Vec<String>,
809
+ ) {
810
+ let param_tys = func.params.iter().map(|(_, ty)| *ty).collect::<Vec<_>>();
811
+ let async_support = self.r#gen.async_support_path();
812
+ let sig = self
813
+ .resolve
814
+ .wasm_signature(AbiVariant::GuestImportAsync, func);
815
+
816
+ // Generate `type ParamsLower`
817
+ //
818
+ uwrite!(
819
+ self.src,
820
+ "
821
+ #[derive(Copy, Clone)]
822
+ struct ParamsLower(
823
+ "
824
+ );
825
+ let mut params_lower = sig.params.as_slice();
826
+ if sig.retptr {
827
+ params_lower = &params_lower[..params_lower.len() - 1];
828
+ }
829
+ for ty in params_lower {
830
+ self.src.push_str(wasm_type(*ty));
831
+ self.src.push_str(", ");
832
+ }
833
+ uwriteln!(
834
+ self.src,
835
+ "
836
+ );
837
+ unsafe impl Send for ParamsLower {{}}
838
+ "
839
+ );
840
+
841
+ uwriteln!(
842
+ self.src,
843
+ "
844
+ use {async_support}::Subtask as _Subtask;
845
+ struct _MySubtask<'a> {{ _unused: core::marker::PhantomData<&'a ()> }}
846
+ #[allow(unused_parens)]
847
+ unsafe impl<'a> _Subtask for _MySubtask<'a> {{
848
+ "
849
+ );
850
+
851
+ // Generate `type Params`
852
+ uwrite!(self.src, "type Params = (");
853
+ for (_, ty) in func.params.iter() {
854
+ let mode = self.type_mode_for(ty, TypeOwnershipStyle::Owned, "'a");
855
+ self.print_ty(ty, mode);
856
+ self.src.push_str(", ");
857
+ }
858
+ uwriteln!(self.src, ");");
859
+
860
+ // Generate `type Results`
861
+ match func.result {
862
+ Some(ty) => {
863
+ uwrite!(self.src, "type Results = ");
864
+ self.print_ty(&ty, TypeMode::owned());
865
+ uwriteln!(self.src, ";");
866
+ }
867
+ None => {
868
+ uwriteln!(self.src, "type Results = ();");
869
+ }
870
+ }
871
+
872
+ // Generate `type ParamsLower`
873
+ uwrite!(self.src, "type ParamsLower = ParamsLower;");
874
+
875
+ // Generate `const ABI_LAYOUT`
876
+ let mut heap_types = Vec::new();
877
+ if sig.indirect_params {
878
+ heap_types.extend(param_tys.iter().cloned());
879
+ }
880
+ heap_types.extend(func.result);
881
+
882
+ let layout = self.sizes.record(&heap_types);
883
+ uwriteln!(
884
+ self.src,
885
+ r#"
886
+ fn abi_layout(&mut self) -> ::core::alloc::Layout {{
887
+ unsafe {{
888
+ ::core::alloc::Layout::from_size_align_unchecked({}, {})
889
+ }}
890
+ }}
891
+ "#,
892
+ layout.size.format(POINTER_SIZE_EXPRESSION),
893
+ layout.align.format(POINTER_SIZE_EXPRESSION),
894
+ );
895
+
896
+ // Generate `const RESULTS_OFFSET`
897
+ let offset = match func.result {
898
+ Some(_) => {
899
+ let offsets = self.sizes.field_offsets(&heap_types);
900
+ offsets.last().unwrap().0.format(POINTER_SIZE_EXPRESSION)
901
+ }
902
+ None => "0".to_string(),
903
+ };
904
+ uwriteln!(
905
+ self.src,
906
+ "fn results_offset(&mut self) -> usize {{ {offset} }}"
907
+ );
908
+
909
+ // Generate `fn call_import`
910
+ let import_name = &func.name;
911
+ let intrinsic = crate::declare_import(
912
+ &module,
913
+ &format!("[async-lower]{import_name}"),
914
+ "call",
915
+ &sig.params,
916
+ &sig.results,
917
+ );
918
+ let mut args = String::new();
919
+ for i in 0..params_lower.len() {
920
+ args.push_str(&format!("_params.{i},"));
921
+ }
922
+ if func.result.is_some() {
923
+ args.push_str("_results");
924
+ }
925
+ uwriteln!(
926
+ self.src,
927
+ r#"
928
+ unsafe fn call_import(&mut self, _params: Self::ParamsLower, _results: *mut u8) -> u32 {{
929
+ {intrinsic}
930
+ unsafe {{ call({args}) as u32 }}
931
+ }}
932
+ "#
933
+ );
934
+
935
+ // Generate `fn params_dealloc_lists`
936
+ let mut dealloc_lists_params = Vec::new();
937
+ for i in 0..params_lower.len() {
938
+ dealloc_lists_params.push(format!("_params.{i}"));
939
+ }
940
+ let dealloc_lists = self.deallocate_lists(
941
+ &param_tys,
942
+ &dealloc_lists_params,
943
+ sig.indirect_params,
944
+ module,
945
+ );
946
+ uwriteln!(
947
+ self.src,
948
+ "unsafe fn params_dealloc_lists(&mut self, _params: Self::ParamsLower) {{"
949
+ );
950
+ uwriteln!(self.src, "{dealloc_lists}");
951
+ uwriteln!(self.src, "}}");
952
+
953
+ // Generate `fn params_dealloc_lists_and_own`
954
+ let dealloc_lists_and_own = self.deallocate_lists_and_own(
955
+ &param_tys,
956
+ &dealloc_lists_params,
957
+ sig.indirect_params,
958
+ module,
959
+ );
960
+ uwriteln!(
961
+ self.src,
962
+ "unsafe fn params_dealloc_lists_and_own(&mut self, _params: Self::ParamsLower) {{"
963
+ );
964
+ uwriteln!(self.src, "{dealloc_lists_and_own}");
965
+ uwriteln!(self.src, "}}");
966
+
967
+ // Generate `fn params_lower`
968
+ let mut lowers = Vec::new();
969
+ let mut param_lowers = Vec::new();
970
+ if sig.indirect_params {
971
+ let offsets = self
972
+ .sizes
973
+ .field_offsets(func.params.iter().map(|(_, ty)| ty));
974
+ for (i, (offset, ty)) in offsets.into_iter().enumerate() {
975
+ let name = format!("_lower{i}");
976
+ let mut start = format!(
977
+ "let _param_ptr = unsafe {{ _ptr.add({}) }};\n",
978
+ offset.format(POINTER_SIZE_EXPRESSION)
979
+ );
980
+ let lower = self.lower_to_memory("_param_ptr", &name, ty, module);
981
+ start.push_str(&lower);
982
+ lowers.push(start);
983
+ param_lowers.push(name);
984
+ }
985
+ lowers.push("ParamsLower(_ptr,)".to_string());
986
+ } else {
987
+ let mut f = FunctionBindgen::new(self, Vec::new(), module, true);
988
+ let mut results = Vec::new();
989
+ for (i, (_, ty)) in func.params.iter().enumerate() {
990
+ let name = format!("_lower{i}");
991
+ results.extend(abi::lower_flat(f.r#gen.resolve, &mut f, name.clone(), ty));
992
+ param_lowers.push(name);
993
+ }
994
+ for result in results.iter_mut() {
995
+ result.push_str(",");
996
+ }
997
+ let result = format!("ParamsLower({})", results.join(" "));
998
+ lowers.push(format!("unsafe {{ {} {result} }}", String::from(f.src)));
999
+ }
1000
+
1001
+ for param in param_lowers.iter_mut() {
1002
+ param.push_str(",");
1003
+ }
1004
+ uwriteln!(
1005
+ self.src,
1006
+ "unsafe fn params_lower(&mut self, ({}): Self::Params, _ptr: *mut u8) -> Self::ParamsLower {{",
1007
+ param_lowers.join(" "),
1008
+ );
1009
+ for lower in lowers.iter() {
1010
+ uwriteln!(self.src, "{lower}");
1011
+ }
1012
+ uwriteln!(self.src, "}}");
1013
+
1014
+ // Generate `fn results_lift`
1015
+ let lift = match func.result {
1016
+ Some(result) => self.lift_from_memory("_ptr", &result, module),
1017
+ None => String::new(),
1018
+ };
1019
+ uwriteln!(
1020
+ self.src,
1021
+ "unsafe fn results_lift(&mut self, _ptr: *mut u8) -> Self::Results {{"
1022
+ );
1023
+ uwriteln!(self.src, "{lift}");
1024
+ uwriteln!(self.src, "}}");
1025
+
1026
+ uwriteln!(self.src, "}}");
1027
+
1028
+ for param in params.iter_mut() {
1029
+ param.push_str(",");
1030
+ }
1031
+ uwriteln!(
1032
+ self.src,
1033
+ "_MySubtask {{ _unused: core::marker::PhantomData }}.call(({})).await",
1034
+ params.join(" ")
1035
+ );
1036
+ }
1037
+
1038
+ fn generate_guest_export(
1039
+ &mut self,
1040
+ func: &Function,
1041
+ interface: Option<&WorldKey>,
1042
+ trait_name: &str,
1043
+ async_: bool,
1044
+ ) {
1045
+ let name_snake = func.name.to_snake_case().replace('.', "_");
1046
+
1047
+ self.generate_payloads("[export]", func, interface);
1048
+
1049
+ uwrite!(
1050
+ self.src,
1051
+ "\
1052
+ #[doc(hidden)]
1053
+ #[allow(non_snake_case, unused_unsafe)]
1054
+ pub unsafe fn _export_{name_snake}_cabi<T: {trait_name}>\
1055
+ ",
1056
+ );
1057
+ let params = self.print_export_sig(func, async_);
1058
+ self.push_str(" { unsafe {");
1059
+
1060
+ if !self.r#gen.opts.disable_run_ctors_once_workaround {
1061
+ let run_ctors_once = self.path_to_run_ctors_once();
1062
+ // Before executing any other code, use this function to run all
1063
+ // static constructors, if they have not yet been run. This is a
1064
+ // hack required to work around wasi-libc ctors calling import
1065
+ // functions to initialize the environment.
1066
+ //
1067
+ // See
1068
+ // https://github.com/bytecodealliance/preview2-prototyping/issues/99
1069
+ // for more details.
1070
+ uwrite!(
1071
+ self.src,
1072
+ "#[cfg(target_arch=\"wasm32\")]\n{run_ctors_once}();",
1073
+ );
1074
+ }
1075
+
1076
+ let mut f = FunctionBindgen::new(self, params, self.wasm_import_module, false);
1077
+ let variant = if async_ {
1078
+ AbiVariant::GuestExportAsync
1079
+ } else {
1080
+ AbiVariant::GuestExport
1081
+ };
1082
+ abi::call(
1083
+ f.r#gen.resolve,
1084
+ variant,
1085
+ LiftLower::LiftArgsLowerResults,
1086
+ func,
1087
+ &mut f,
1088
+ async_,
1089
+ );
1090
+ let FunctionBindgen {
1091
+ needs_cleanup_list,
1092
+ src,
1093
+ handle_decls,
1094
+ ..
1095
+ } = f;
1096
+ if async_ {
1097
+ let async_support = self.r#gen.async_support_path();
1098
+ uwriteln!(self.src, "{async_support}::start_task(async move {{");
1099
+ uwriteln!(
1100
+ self.src,
1101
+ "let _task_cancel = {async_support}::TaskCancelOnDrop::new();"
1102
+ );
1103
+ if needs_cleanup_list {
1104
+ let vec = self.path_to_vec();
1105
+ uwriteln!(self.src, "let mut cleanup_list = {vec}::new();");
1106
+ }
1107
+ } else {
1108
+ assert!(!needs_cleanup_list);
1109
+ }
1110
+ for decl in handle_decls {
1111
+ self.src.push_str(&decl);
1112
+ self.src.push_str("\n");
1113
+ }
1114
+ self.src.push_str(&String::from(src));
1115
+ if async_ {
1116
+ uwriteln!(self.src, "}})")
1117
+ }
1118
+ self.src.push_str("} }\n");
1119
+
1120
+ if async_ {
1121
+ let async_support = self.r#gen.async_support_path();
1122
+ uwrite!(
1123
+ self.src,
1124
+ "\
1125
+ #[doc(hidden)]
1126
+ #[allow(non_snake_case)]
1127
+ pub unsafe fn __callback_{name_snake}(event0: u32, event1: u32, event2: u32) -> u32 {{
1128
+ unsafe {{
1129
+ {async_support}::callback(event0, event1, event2)
1130
+ }}
1131
+ }}
1132
+ "
1133
+ );
1134
+ } else if abi::guest_export_needs_post_return(self.resolve, func) {
1135
+ uwrite!(
1136
+ self.src,
1137
+ "\
1138
+ #[doc(hidden)]
1139
+ #[allow(non_snake_case)]
1140
+ pub unsafe fn __post_return_{name_snake}<T: {trait_name}>\
1141
+ "
1142
+ );
1143
+ let params = self.print_post_return_sig(func);
1144
+ self.src.push_str("{ unsafe {\n");
1145
+
1146
+ let mut f = FunctionBindgen::new(self, params, self.wasm_import_module, false);
1147
+ abi::post_return(f.r#gen.resolve, func, &mut f);
1148
+ let FunctionBindgen {
1149
+ needs_cleanup_list,
1150
+ src,
1151
+ handle_decls,
1152
+ ..
1153
+ } = f;
1154
+ assert!(!needs_cleanup_list);
1155
+ assert!(handle_decls.is_empty());
1156
+ self.src.push_str(&String::from(src));
1157
+ self.src.push_str("} }\n");
1158
+ }
1159
+ }
1160
+
1161
+ fn generate_raw_cabi_export(
1162
+ &mut self,
1163
+ func: &Function,
1164
+ ty: &str,
1165
+ path_to_self: &str,
1166
+ async_: bool,
1167
+ ) {
1168
+ let name_snake = func.name.to_snake_case().replace('.', "_");
1169
+ let wasm_module_export_name = match self.identifier {
1170
+ Identifier::Interface(_, key) => Some(self.resolve.name_world_key(key)),
1171
+ Identifier::World(_) => None,
1172
+ Identifier::StreamOrFuturePayload => unreachable!(),
1173
+ };
1174
+ let export_prefix = self.r#gen.opts.export_prefix.as_deref().unwrap_or("");
1175
+ let export_name = func.legacy_core_export_name(wasm_module_export_name.as_deref());
1176
+ let export_name = if async_ {
1177
+ format!("[async-lift]{export_name}")
1178
+ } else {
1179
+ export_name.to_string()
1180
+ };
1181
+ uwrite!(
1182
+ self.src,
1183
+ "\
1184
+ #[unsafe(export_name = \"{export_prefix}{export_name}\")]
1185
+ unsafe extern \"C\" fn export_{name_snake}\
1186
+ ",
1187
+ );
1188
+
1189
+ let params = self.print_export_sig(func, async_);
1190
+ self.push_str(" {\n");
1191
+ uwriteln!(
1192
+ self.src,
1193
+ "unsafe {{ {path_to_self}::_export_{name_snake}_cabi::<{ty}>({}) }}",
1194
+ params.join(", ")
1195
+ );
1196
+ self.push_str("}\n");
1197
+
1198
+ let export_prefix = self.r#gen.opts.export_prefix.as_deref().unwrap_or("");
1199
+ if async_ {
1200
+ uwrite!(
1201
+ self.src,
1202
+ "\
1203
+ #[unsafe(export_name = \"{export_prefix}[callback]{export_name}\")]
1204
+ unsafe extern \"C\" fn _callback_{name_snake}(event0: u32, event1: u32, event2: u32) -> u32 {{
1205
+ unsafe {{
1206
+ {path_to_self}::__callback_{name_snake}(event0, event1, event2)
1207
+ }}
1208
+ }}
1209
+ "
1210
+ );
1211
+ } else if abi::guest_export_needs_post_return(self.resolve, func) {
1212
+ uwrite!(
1213
+ self.src,
1214
+ "\
1215
+ #[unsafe(export_name = \"{export_prefix}cabi_post_{export_name}\")]
1216
+ unsafe extern \"C\" fn _post_return_{name_snake}\
1217
+ "
1218
+ );
1219
+ let params = self.print_post_return_sig(func);
1220
+ self.src.push_str("{\n");
1221
+ uwriteln!(
1222
+ self.src,
1223
+ "unsafe {{ {path_to_self}::__post_return_{name_snake}::<{ty}>({}) }}",
1224
+ params.join(", ")
1225
+ );
1226
+ self.src.push_str("}\n");
1227
+ }
1228
+ }
1229
+
1230
+ fn print_export_sig(&mut self, func: &Function, async_: bool) -> Vec<String> {
1231
+ self.src.push_str("(");
1232
+ let variant = if async_ {
1233
+ AbiVariant::GuestExportAsync
1234
+ } else {
1235
+ AbiVariant::GuestExport
1236
+ };
1237
+ let sig = self.resolve.wasm_signature(variant, func);
1238
+ let mut params = Vec::new();
1239
+ for (i, param) in sig.params.iter().enumerate() {
1240
+ let name = format!("arg{i}");
1241
+ uwrite!(self.src, "{name}: {},", wasm_type(*param));
1242
+ params.push(name);
1243
+ }
1244
+ self.src.push_str(")");
1245
+
1246
+ match sig.results.len() {
1247
+ 0 => {}
1248
+ 1 => {
1249
+ uwrite!(self.src, " -> {}", wasm_type(sig.results[0]));
1250
+ }
1251
+ _ => unimplemented!(),
1252
+ }
1253
+
1254
+ params
1255
+ }
1256
+
1257
+ fn print_post_return_sig(&mut self, func: &Function) -> Vec<String> {
1258
+ self.src.push_str("(");
1259
+ let mut params = Vec::new();
1260
+ let sig = self.resolve.wasm_signature(AbiVariant::GuestExport, func);
1261
+ for (i, result) in sig.results.iter().enumerate() {
1262
+ let name = format!("arg{i}");
1263
+ uwrite!(self.src, "{name}: {},", wasm_type(*result));
1264
+ params.push(name);
1265
+ }
1266
+ self.src.push_str(") ");
1267
+ params
1268
+ }
1269
+
1270
+ pub fn generate_stub<'a>(
1271
+ &mut self,
1272
+ interface: Option<(InterfaceId, &WorldKey)>,
1273
+ funcs: impl Iterator<Item = &'a Function> + Clone,
1274
+ ) {
1275
+ let mut funcs = super::group_by_resource(funcs.clone());
1276
+
1277
+ let root_methods = funcs.remove(&None).unwrap_or(Vec::new());
1278
+
1279
+ let mut extra_trait_items = String::new();
1280
+ let guest_trait = match interface {
1281
+ Some((id, _)) => {
1282
+ let path = self.path_to_interface(id).unwrap();
1283
+ for (name, id) in self.resolve.interfaces[id].types.iter() {
1284
+ match self.resolve.types[*id].kind {
1285
+ TypeDefKind::Resource => {}
1286
+ _ => continue,
1287
+ }
1288
+ let camel = name.to_upper_camel_case();
1289
+ uwriteln!(extra_trait_items, "type {camel} = Stub;");
1290
+
1291
+ let resource_methods = funcs.remove(&Some(*id)).unwrap_or(Vec::new());
1292
+ let trait_name = format!("{path}::Guest{camel}");
1293
+ self.generate_stub_impl(&trait_name, "", &resource_methods, interface);
1294
+ }
1295
+ format!("{path}::Guest")
1296
+ }
1297
+ None => {
1298
+ assert!(funcs.is_empty());
1299
+ "Guest".to_string()
1300
+ }
1301
+ };
1302
+
1303
+ if !root_methods.is_empty() || !extra_trait_items.is_empty() {
1304
+ self.generate_stub_impl(&guest_trait, &extra_trait_items, &root_methods, interface);
1305
+ }
1306
+ }
1307
+
1308
+ fn generate_stub_impl(
1309
+ &mut self,
1310
+ trait_name: &str,
1311
+ extra_trait_items: &str,
1312
+ funcs: &[&Function],
1313
+ interface: Option<(InterfaceId, &WorldKey)>,
1314
+ ) {
1315
+ uwriteln!(self.src, "impl {trait_name} for Stub {{");
1316
+ self.src.push_str(extra_trait_items);
1317
+
1318
+ for func in funcs {
1319
+ if self.r#gen.skip.contains(&func.name) {
1320
+ continue;
1321
+ }
1322
+ let async_ = self
1323
+ .r#gen
1324
+ .is_async(self.resolve, interface.map(|p| p.1), func, false);
1325
+ let mut sig = FnSig {
1326
+ async_,
1327
+ use_item_name: true,
1328
+ private: true,
1329
+ ..Default::default()
1330
+ };
1331
+ sig.update_for_func(&func);
1332
+ self.src.push_str("#[allow(unused_variables)]\n");
1333
+ self.print_signature(func, true, &sig);
1334
+ self.src.push_str("{ unreachable!() }\n");
1335
+ }
1336
+
1337
+ self.src.push_str("}\n");
1338
+ }
1339
+
1340
+ fn rustdoc(&mut self, docs: &Docs) {
1341
+ let docs = match &docs.contents {
1342
+ Some(docs) => docs,
1343
+ None => return,
1344
+ };
1345
+ for line in docs.trim().lines() {
1346
+ self.push_str("///");
1347
+ if !line.is_empty() {
1348
+ self.push_str(" ");
1349
+ self.push_str(line);
1350
+ }
1351
+ self.push_str("\n");
1352
+ }
1353
+ }
1354
+
1355
+ fn rustdoc_params(&mut self, docs: &[(String, Type)], header: &str) {
1356
+ let _ = (docs, header);
1357
+ // let docs = docs
1358
+ // .iter()
1359
+ // .filter(|param| param.docs.trim().len() > 0)
1360
+ // .collect::<Vec<_>>();
1361
+ // if docs.len() == 0 {
1362
+ // return;
1363
+ // }
1364
+
1365
+ // self.push_str("///\n");
1366
+ // self.push_str("/// ## ");
1367
+ // self.push_str(header);
1368
+ // self.push_str("\n");
1369
+ // self.push_str("///\n");
1370
+
1371
+ // for param in docs {
1372
+ // for (i, line) in param.docs.lines().enumerate() {
1373
+ // self.push_str("/// ");
1374
+ // // Currently wasi only has at most one return value, so there's no
1375
+ // // need to indent it or name it.
1376
+ // if header != "Return" {
1377
+ // if i == 0 {
1378
+ // self.push_str("* `");
1379
+ // self.push_str(to_rust_ident(param.name.as_str()));
1380
+ // self.push_str("` - ");
1381
+ // } else {
1382
+ // self.push_str(" ");
1383
+ // }
1384
+ // }
1385
+ // self.push_str(line);
1386
+ // self.push_str("\n");
1387
+ // }
1388
+ // }
1389
+ }
1390
+
1391
+ fn print_signature(&mut self, func: &Function, params_owned: bool, sig: &FnSig) -> Vec<String> {
1392
+ let params = self.print_docs_and_params(func, params_owned, sig);
1393
+ self.push_str(" -> ");
1394
+ if let FunctionKind::Constructor(resource_id) = &func.kind {
1395
+ match classify_constructor_return_type(&self.resolve, *resource_id, &func.result) {
1396
+ ConstructorReturnType::Self_ => {
1397
+ self.push_str("Self");
1398
+ }
1399
+ ConstructorReturnType::Result { err } => {
1400
+ self.push_str("Result<Self, ");
1401
+ self.print_result_type(&err);
1402
+ self.push_str("> where Self: Sized");
1403
+ }
1404
+ }
1405
+ } else {
1406
+ self.print_result_type(&func.result);
1407
+ }
1408
+ params
1409
+ }
1410
+
1411
+ fn print_docs_and_params(
1412
+ &mut self,
1413
+ func: &Function,
1414
+ params_owned: bool,
1415
+ sig: &FnSig,
1416
+ ) -> Vec<String> {
1417
+ self.rustdoc(&func.docs);
1418
+ self.rustdoc_params(&func.params, "Parameters");
1419
+ // TODO: re-add this when docs are back
1420
+ // self.rustdoc_params(&func.results, "Return");
1421
+
1422
+ // TODO: should probably return `impl Future` in traits instead of
1423
+ // having an `async fn` but that'll require more plumbing here.
1424
+ self.push_str("#[allow(async_fn_in_trait)]\n");
1425
+
1426
+ if !sig.private {
1427
+ self.push_str("pub ");
1428
+ }
1429
+ if sig.unsafe_ {
1430
+ self.push_str("unsafe ");
1431
+ }
1432
+ if sig.async_ {
1433
+ self.push_str("async ");
1434
+ }
1435
+ self.push_str("fn ");
1436
+ let func_name = if sig.use_item_name {
1437
+ if let FunctionKind::Constructor(_) = &func.kind {
1438
+ "new"
1439
+ } else {
1440
+ func.item_name()
1441
+ }
1442
+ } else {
1443
+ func.item_name()
1444
+ };
1445
+ self.push_str(&to_rust_ident(func_name));
1446
+ if let Some(generics) = &sig.generics {
1447
+ self.push_str(generics);
1448
+ }
1449
+ self.push_str("(");
1450
+ if let Some(arg) = &sig.self_arg {
1451
+ self.push_str(arg);
1452
+ self.push_str(",");
1453
+ }
1454
+ let mut params = Vec::new();
1455
+ for (i, (name, param)) in func.params.iter().enumerate() {
1456
+ if i == 0 && sig.self_is_first_param {
1457
+ params.push("self".to_string());
1458
+ continue;
1459
+ }
1460
+ let name = to_rust_ident(name);
1461
+ self.push_str(&name);
1462
+ self.push_str(": ");
1463
+
1464
+ // Select the "style" of mode that the parameter's type will be
1465
+ // rendered as. Owned parameters are always owned, that's the easy
1466
+ // case. Otherwise it means that we're rendering the arguments to an
1467
+ // imported function which technically don't need ownership. In this
1468
+ // case the `ownership` configuration is consulted.
1469
+ //
1470
+ // If `Owning` is specified then that means that the top-level
1471
+ // argument will be `&T` but everything under that will be `T`. For
1472
+ // example a record-of-lists would be passed as `&RecordOfLists` as
1473
+ // opposed to `RecordOfLists<'a>`.
1474
+ //
1475
+ // In the `Borrowing` mode however a different tradeoff is made. The
1476
+ // types are generated differently meaning that a borrowed version
1477
+ // is used.
1478
+ let style = if params_owned {
1479
+ TypeOwnershipStyle::Owned
1480
+ } else {
1481
+ match self.r#gen.opts.ownership {
1482
+ Ownership::Owning => TypeOwnershipStyle::OnlyTopBorrowed,
1483
+ Ownership::Borrowing { .. } => TypeOwnershipStyle::Borrowed,
1484
+ }
1485
+ };
1486
+ let mode = self.type_mode_for(param, style, "'_");
1487
+ self.print_ty(param, mode);
1488
+ self.push_str(",");
1489
+
1490
+ // Depending on the style of this request vs what we got perhaps
1491
+ // change how this argument is used.
1492
+ //
1493
+ // If the `mode` that was selected matches the requested style, then
1494
+ // everything is as expected and the argument should be used as-is.
1495
+ // If it differs though then that means that we requested a borrowed
1496
+ // mode but a different mode ended up being selected. This situation
1497
+ // indicates for example that an argument to an import should be
1498
+ // borrowed but the argument's type means that it can't be borrowed.
1499
+ // For example all arguments to imports are borrowed by default but
1500
+ // owned resources cannot ever be borrowed, so they pop out here as
1501
+ // owned instead.
1502
+ //
1503
+ // In such a situation the lower code still expects to be operating
1504
+ // over borrows. For example raw pointers from lists are passed to
1505
+ // the canonical ABI layer assuming that the lists are "rooted" by
1506
+ // the caller. To uphold this invariant a borrow of the argument is
1507
+ // recorded as the name of this parameter. That ensures that all
1508
+ // access to the parameter is done indirectly which pretends, at
1509
+ // least internally, that the argument was borrowed. The original
1510
+ // motivation for this was #817.
1511
+ if mode.style == style {
1512
+ params.push(name);
1513
+ } else {
1514
+ assert!(style != TypeOwnershipStyle::Owned);
1515
+ params.push(format!("&{name}"));
1516
+ }
1517
+ }
1518
+ self.push_str(")");
1519
+ params
1520
+ }
1521
+
1522
+ fn print_result_type(&mut self, result: &Option<Type>) {
1523
+ match result {
1524
+ None => {
1525
+ self.push_str("()");
1526
+ }
1527
+ Some(ty) => {
1528
+ let mode = self.type_mode_for(ty, TypeOwnershipStyle::Owned, "'INVALID");
1529
+ assert!(mode.lifetime.is_none());
1530
+ self.print_ty(ty, mode);
1531
+ }
1532
+ }
1533
+ }
1534
+
1535
+ /// Calculates the `TypeMode` to be used for the `ty` specified.
1536
+ ///
1537
+ /// This takes a `style` argument which is the requested style of ownership
1538
+ /// for this type. Note that the returned `TypeMode` may have a different
1539
+ /// `style`.
1540
+ ///
1541
+ /// This additionally takes a `lt` parameter which, if needed, is what will
1542
+ /// be used to render lifetimes.
1543
+ fn type_mode_for(&self, ty: &Type, style: TypeOwnershipStyle, lt: &'static str) -> TypeMode {
1544
+ match ty {
1545
+ Type::Id(id) => self.type_mode_for_id(*id, style, lt),
1546
+
1547
+ // Borrowed strings are handled specially here since they're the
1548
+ // only list-like primitive.
1549
+ Type::String if style != TypeOwnershipStyle::Owned => TypeMode {
1550
+ lifetime: Some(lt),
1551
+ lists_borrowed: true,
1552
+ style,
1553
+ },
1554
+
1555
+ _ => TypeMode::owned(),
1556
+ }
1557
+ }
1558
+
1559
+ /// Same as `type_mode_for`, but specifically for `TypeId` which refers to a
1560
+ /// type.
1561
+ fn type_mode_for_id(
1562
+ &self,
1563
+ ty: TypeId,
1564
+ style: TypeOwnershipStyle,
1565
+ lt: &'static str,
1566
+ ) -> TypeMode {
1567
+ // NB: This method is the heart of determining how to render types.
1568
+ // There's a lot of permutations and corner cases to handle, especially
1569
+ // with being able to configure at the generator level how types are
1570
+ // generated. Long story short this is a subtle and complicated method.
1571
+ //
1572
+ // The hope is that most of the complexity around type generation in
1573
+ // Rust is largely centered here where everything else can lean on this.
1574
+ // This has gone through so many refactors I've lost count at this
1575
+ // point, but maybe this one is the one that'll stick!
1576
+ //
1577
+ // The general idea is that there's some clear-and-fast rules for how
1578
+ // `TypeMode` must be returned here. For example borrowed handles are
1579
+ // required to have a lifetime parameter. Everything else though is here
1580
+ // to handle the various levels of configuration and semantics for each
1581
+ // level of types.
1582
+ //
1583
+ // As a reminder a `TypeMode` is generated for each "level" of a type
1584
+ // hierarchy, for example there's one mode for `Vec<T>` and another mode
1585
+ // for `T`. This enables, for example, rendering the outer layer as
1586
+ // either `Vec<T>` or `&[T]` but the inner `T` may or may not have a
1587
+ // type parameter.
1588
+
1589
+ let info = self.info(ty);
1590
+ let lifetime = if info.has_borrow_handle {
1591
+ // Borrowed handles always have a lifetime associated with them so
1592
+ // thread it through.
1593
+ Some(lt)
1594
+ } else if style == TypeOwnershipStyle::Owned {
1595
+ // If this type is being rendered as an "owned" type, and it
1596
+ // doesn't have any borrowed handles, then no lifetimes are needed
1597
+ // since any internal lists will be their owned version.
1598
+ None
1599
+ } else if info.has_own_handle || !info.has_list {
1600
+ // At this point there are no borrowed handles and a borrowed style
1601
+ // of type is requested. In this situation there's two cases where a
1602
+ // lifetime is never used:
1603
+ //
1604
+ // * Owned handles are present - in this situation ownership is used
1605
+ // to statically reflect how a value is lost when passed to an
1606
+ // import. This means that no lifetime is used for internal lists
1607
+ // since they must be rendered in an owned mode.
1608
+ //
1609
+ // * There are no lists present - here the lifetime parameter won't
1610
+ // be used for anything because there's no borrows or lists, so
1611
+ // it's skipped.
1612
+ None
1613
+ } else if !info.owned || self.uses_two_names(&info) {
1614
+ // This next layer things get a little more interesting. To recap,
1615
+ // so far we know that there's no borrowed handles, a borrowed mode
1616
+ // is requested, there's no own handles, and there's a list. In that
1617
+ // situation if `info` shows that this type is never used in an
1618
+ // owned position, or if two types are explicitly requested for
1619
+ // owned/borrowed values, then a lifetime is used.
1620
+ Some(lt)
1621
+ } else {
1622
+ // ... and finally, here at the end we know:
1623
+ //
1624
+ // * No borrowed handles
1625
+ // * Borrowing mode is requested
1626
+ // * No owned handles
1627
+ // * A list is somewhere
1628
+ // * This type is used somewhere in an owned position
1629
+ // * This type does not used "two names" meaning that we must use
1630
+ // the owned version of the type.
1631
+ //
1632
+ // If the configured ownership mode for generating types of this
1633
+ // generator is "owning" then that's the only type that can be used.
1634
+ // If borrowing is requested then this means that `&T` is going to
1635
+ // be rendered, so thread it through.
1636
+ //
1637
+ // If the configured ownership mode uses borrowing by default, then
1638
+ // things get a little weird. This means that a lifetime is going to
1639
+ // be used an any lists should be borrowed, but we specifically
1640
+ // switch to only borrowing the top layer of the type rather than
1641
+ // the entire hierarchy. This situation can happen in
1642
+ // `duplicate_if_necessary: false` mode for example where we're
1643
+ // borrowing a type which is used in an owned position elsewhere.
1644
+ // The only possibility at that point is to borrow it at the root
1645
+ // but everything else internally is required to be owned from then
1646
+ // on.
1647
+ match self.r#gen.opts.ownership {
1648
+ Ownership::Owning => Some(lt),
1649
+ Ownership::Borrowing { .. } => {
1650
+ return TypeMode {
1651
+ lifetime: Some(lt),
1652
+ lists_borrowed: true,
1653
+ style: TypeOwnershipStyle::OnlyTopBorrowed,
1654
+ };
1655
+ }
1656
+ }
1657
+ };
1658
+ TypeMode {
1659
+ lifetime,
1660
+
1661
+ // If a lifetime is present and ownership isn't requested, then make
1662
+ // sure any lists show up as `&str` or `&[T]`.
1663
+ lists_borrowed: lifetime.is_some() && style != TypeOwnershipStyle::Owned,
1664
+
1665
+ // Switch the style to `Owned` if an `own<T>` handle is present
1666
+ // because there's no option but to take interior types by ownership
1667
+ // as that statically shows that the ownership of the value is being
1668
+ // lost.
1669
+ style: if info.has_own_handle {
1670
+ TypeOwnershipStyle::Owned
1671
+ } else {
1672
+ style
1673
+ },
1674
+ }
1675
+ }
1676
+
1677
+ /// Generates the "next" mode for a type.
1678
+ ///
1679
+ /// The `ty` specified is the type that a mode is being generated for, and
1680
+ /// the `mode` argument is the "parent" mode that the previous outer layer
1681
+ /// of type was rendered with. The returned mode should be used to render
1682
+ /// `ty`.
1683
+ fn filter_mode(&self, ty: &Type, mode: TypeMode) -> TypeMode {
1684
+ match mode.lifetime {
1685
+ Some(lt) => self.type_mode_for(ty, mode.style.next(), lt),
1686
+ None => TypeMode::owned(),
1687
+ }
1688
+ }
1689
+
1690
+ /// Same as `filder_mode` except if `mode` has the type `OnlyTopBorrowed`
1691
+ /// the `mode` is specifically preserved as-is.
1692
+ ///
1693
+ /// This is used for types like `Option<T>` to render as `Option<&T>`
1694
+ /// instead of `&Option<T>` for example.
1695
+ fn filter_mode_preserve_top(&self, ty: &Type, mode: TypeMode) -> TypeMode {
1696
+ if mode.style == TypeOwnershipStyle::OnlyTopBorrowed {
1697
+ mode
1698
+ } else {
1699
+ self.filter_mode(ty, mode)
1700
+ }
1701
+ }
1702
+
1703
+ pub(crate) fn type_name_owned_with_id(&mut self, ty: &Type, id: Identifier<'i>) -> String {
1704
+ let old_identifier = mem::replace(&mut self.identifier, id);
1705
+ let name = self.type_name_owned(ty);
1706
+ self.identifier = old_identifier;
1707
+ name
1708
+ }
1709
+
1710
+ fn type_name_owned(&mut self, ty: &Type) -> String {
1711
+ self.type_name(
1712
+ ty,
1713
+ TypeMode {
1714
+ lifetime: None,
1715
+ lists_borrowed: false,
1716
+ style: TypeOwnershipStyle::Owned,
1717
+ },
1718
+ )
1719
+ }
1720
+
1721
+ fn type_name(&mut self, ty: &Type, mode: TypeMode) -> String {
1722
+ let old = mem::take(&mut self.src);
1723
+ self.print_ty(ty, mode);
1724
+ String::from(mem::replace(&mut self.src, old))
1725
+ }
1726
+
1727
+ fn print_ty(&mut self, ty: &Type, mode: TypeMode) {
1728
+ // If we have a typedef of a string or a list, the typedef is an alias
1729
+ // for `String` or `Vec<T>`. If this is a borrow, instead of borrowing
1730
+ // them as `&String` or `&Vec<T>`, use `&str` or `&[T]` so that callers
1731
+ // don't need to create owned copies.
1732
+ if let Type::Id(id) = ty {
1733
+ let id = dealias(self.resolve, *id);
1734
+ let typedef = &self.resolve.types[id];
1735
+ match &typedef.kind {
1736
+ TypeDefKind::Type(Type::String) => {
1737
+ if let Some(lt) = mode.lifetime {
1738
+ self.print_borrowed_str(lt);
1739
+ return;
1740
+ }
1741
+ }
1742
+ TypeDefKind::List(element) => {
1743
+ if mode.lifetime.is_some() {
1744
+ self.print_list(element, mode);
1745
+ return;
1746
+ }
1747
+ }
1748
+ _ => {}
1749
+ }
1750
+ }
1751
+
1752
+ match ty {
1753
+ Type::Id(t) => self.print_tyid(*t, mode),
1754
+ Type::Bool => self.push_str("bool"),
1755
+ Type::U8 => self.push_str("u8"),
1756
+ Type::U16 => self.push_str("u16"),
1757
+ Type::U32 => self.push_str("u32"),
1758
+ Type::U64 => self.push_str("u64"),
1759
+ Type::S8 => self.push_str("i8"),
1760
+ Type::S16 => self.push_str("i16"),
1761
+ Type::S32 => self.push_str("i32"),
1762
+ Type::S64 => self.push_str("i64"),
1763
+ Type::F32 => self.push_str("f32"),
1764
+ Type::F64 => self.push_str("f64"),
1765
+ Type::Char => self.push_str("char"),
1766
+ Type::String => {
1767
+ assert_eq!(mode.lists_borrowed, mode.lifetime.is_some());
1768
+ match mode.lifetime {
1769
+ Some(lt) => self.print_borrowed_str(lt),
1770
+ None => {
1771
+ if self.r#gen.opts.raw_strings {
1772
+ self.push_vec_name();
1773
+ self.push_str("::<u8>");
1774
+ } else {
1775
+ self.push_string_name();
1776
+ }
1777
+ }
1778
+ }
1779
+ }
1780
+
1781
+ Type::ErrorContext => {
1782
+ let async_support = self.r#gen.async_support_path();
1783
+ self.push_str(&format!("{async_support}::ErrorContext"));
1784
+ }
1785
+ }
1786
+ }
1787
+
1788
+ fn print_optional_ty(&mut self, ty: Option<&Type>, mode: TypeMode) {
1789
+ match ty {
1790
+ Some(ty) => {
1791
+ let mode = self.filter_mode_preserve_top(ty, mode);
1792
+ self.print_ty(ty, mode)
1793
+ }
1794
+ None => self.push_str("()"),
1795
+ }
1796
+ }
1797
+
1798
+ pub fn type_path(&self, id: TypeId, owned: bool) -> String {
1799
+ let full_wit_type_name = full_wit_type_name(self.resolve, id);
1800
+ if let Some(TypeGeneration::Remap(remapped_path)) = self.r#gen.with.get(&full_wit_type_name)
1801
+ {
1802
+ remapped_path.clone()
1803
+ } else {
1804
+ self.type_path_with_name(
1805
+ id,
1806
+ if owned {
1807
+ self.result_name(id)
1808
+ } else {
1809
+ self.param_name(id)
1810
+ },
1811
+ )
1812
+ }
1813
+ }
1814
+
1815
+ fn type_path_with_name(&self, id: TypeId, name: String) -> String {
1816
+ if let TypeOwner::Interface(id) = self.resolve.types[id].owner {
1817
+ if let Some(path) = self.path_to_interface(id) {
1818
+ return format!("{path}::{name}");
1819
+ }
1820
+ }
1821
+ name
1822
+ }
1823
+
1824
+ fn print_tyid(&mut self, id: TypeId, mode: TypeMode) {
1825
+ let ty = &self.resolve.types[id];
1826
+ if ty.name.is_some() {
1827
+ // NB: Most of the heavy lifting of `TypeMode` and what to do here
1828
+ // has already happened in `type_mode_for*`. Here though a little
1829
+ // more happens because this is where `OnlyTopBorrowed` is
1830
+ // processed.
1831
+ //
1832
+ // Specifically what should happen is that in the case of an
1833
+ // argument to an imported function if only the top value is
1834
+ // borrowed then we want to render it as `&T`. If this all is
1835
+ // applicable then the lifetime is rendered here before the type.
1836
+ // The `mode` is then switched to `Owned` and recalculated for the
1837
+ // type we're rendering here to avoid accidentally giving it a
1838
+ // lifetime type parameter when it otherwise doesn't have it.
1839
+ let mode = if mode.style == TypeOwnershipStyle::OnlyTopBorrowed {
1840
+ if let Some(lt) = mode.lifetime {
1841
+ self.push_str("&");
1842
+ if lt != "'_" {
1843
+ self.push_str(lt);
1844
+ self.push_str(" ");
1845
+ }
1846
+ self.type_mode_for_id(id, TypeOwnershipStyle::Owned, lt)
1847
+ } else {
1848
+ mode
1849
+ }
1850
+ } else {
1851
+ mode
1852
+ };
1853
+ let name = self.type_path(
1854
+ id,
1855
+ match mode.style {
1856
+ TypeOwnershipStyle::Owned => true,
1857
+ TypeOwnershipStyle::OnlyTopBorrowed | TypeOwnershipStyle::Borrowed => false,
1858
+ },
1859
+ );
1860
+ self.push_str(&name);
1861
+ self.print_generics(mode.lifetime);
1862
+ return;
1863
+ }
1864
+
1865
+ let mut anonymous_type_gen = AnonTypeGenerator {
1866
+ mode,
1867
+ resolve: self.resolve,
1868
+ interface: self,
1869
+ };
1870
+ anonymous_type_gen.define_anonymous_type(id);
1871
+ }
1872
+
1873
+ fn print_list(&mut self, ty: &Type, mode: TypeMode) {
1874
+ let next_mode = self.filter_mode(ty, mode);
1875
+ if mode.lists_borrowed {
1876
+ let lifetime = mode.lifetime.unwrap();
1877
+ self.push_str("&");
1878
+ if lifetime != "'_" {
1879
+ self.push_str(lifetime);
1880
+ self.push_str(" ");
1881
+ }
1882
+ self.push_str("[");
1883
+ self.print_ty(ty, next_mode);
1884
+ self.push_str("]");
1885
+ } else {
1886
+ self.push_vec_name();
1887
+ self.push_str("::<");
1888
+ self.print_ty(ty, next_mode);
1889
+ self.push_str(">");
1890
+ }
1891
+ }
1892
+
1893
+ fn print_generics(&mut self, lifetime: Option<&str>) {
1894
+ if lifetime.is_none() {
1895
+ return;
1896
+ }
1897
+ self.push_str("<");
1898
+ if let Some(lt) = lifetime {
1899
+ self.push_str(lt);
1900
+ self.push_str(",");
1901
+ }
1902
+ self.push_str(">");
1903
+ }
1904
+
1905
+ fn int_repr(&mut self, repr: Int) {
1906
+ self.push_str(int_repr(repr));
1907
+ }
1908
+
1909
+ fn modes_of(&self, ty: TypeId) -> Vec<(String, TypeMode)> {
1910
+ let info = self.info(ty);
1911
+ let mut result = Vec::new();
1912
+ if !self.r#gen.opts.generate_unused_types {
1913
+ // If this type isn't actually used, no need to generate it.
1914
+ if !info.owned && !info.borrowed {
1915
+ return result;
1916
+ }
1917
+ }
1918
+ // Generate one mode for when the type is owned and another for when
1919
+ // it's borrowed.
1920
+ let a = self.type_mode_for_id(ty, TypeOwnershipStyle::Owned, "'a");
1921
+ let b = self.type_mode_for_id(ty, TypeOwnershipStyle::Borrowed, "'a");
1922
+
1923
+ if self.uses_two_names(&info) {
1924
+ // If this type uses two names then, well, it uses two names. In
1925
+ // this situation both modes are returned.
1926
+ assert!(a != b);
1927
+ result.push((self.result_name(ty), a));
1928
+ result.push((self.param_name(ty), b));
1929
+ } else if a == b {
1930
+ // If the modes are the same then there's only one result.
1931
+ result.push((self.result_name(ty), a));
1932
+ } else if info.owned || matches!(self.r#gen.opts.ownership, Ownership::Owning) {
1933
+ // If this type is owned or if ownership is preferred then the owned
1934
+ // variant is used as a priority. This is where the generator's
1935
+ // configuration comes into play.
1936
+ result.push((self.result_name(ty), a));
1937
+ } else {
1938
+ // And finally, failing all that, the borrowed variant is used.
1939
+ assert!(!info.owned);
1940
+ result.push((self.param_name(ty), b));
1941
+ }
1942
+ result
1943
+ }
1944
+
1945
+ fn print_typedef_record(&mut self, id: TypeId, record: &Record, docs: &Docs) {
1946
+ let info = self.info(id);
1947
+ // We use a BTree set to make sure we don't have any duplicates and we have a stable order
1948
+ let additional_derives: BTreeSet<String> = self
1949
+ .r#gen
1950
+ .opts
1951
+ .additional_derive_attributes
1952
+ .iter()
1953
+ .cloned()
1954
+ .collect();
1955
+ for (name, mode) in self.modes_of(id) {
1956
+ self.rustdoc(docs);
1957
+ let mut derives = BTreeSet::new();
1958
+ if !self
1959
+ .r#gen
1960
+ .opts
1961
+ .additional_derive_ignore
1962
+ .contains(&name.to_kebab_case())
1963
+ {
1964
+ derives.extend(additional_derives.clone());
1965
+ }
1966
+ if info.is_copy() {
1967
+ self.push_str("#[repr(C)]\n");
1968
+ derives.extend(["Copy", "Clone"].into_iter().map(|s| s.to_string()));
1969
+ } else if info.is_clone() {
1970
+ derives.insert("Clone".to_string());
1971
+ }
1972
+ if !derives.is_empty() {
1973
+ self.push_str("#[derive(");
1974
+ self.push_str(&derives.into_iter().collect::<Vec<_>>().join(", "));
1975
+ self.push_str(")]\n")
1976
+ }
1977
+ self.push_str(&format!("pub struct {name}"));
1978
+ self.print_generics(mode.lifetime);
1979
+ self.push_str(" {\n");
1980
+ for field in record.fields.iter() {
1981
+ self.rustdoc(&field.docs);
1982
+ self.push_str("pub ");
1983
+ self.push_str(&to_rust_ident(&field.name));
1984
+ self.push_str(": ");
1985
+ let mode = self.filter_mode(&field.ty, mode);
1986
+ self.print_ty(&field.ty, mode);
1987
+ self.push_str(",\n");
1988
+ }
1989
+ self.push_str("}\n");
1990
+
1991
+ self.push_str("impl");
1992
+ self.print_generics(mode.lifetime);
1993
+ self.push_str(" ::core::fmt::Debug for ");
1994
+ self.push_str(&name);
1995
+ self.print_generics(mode.lifetime);
1996
+ self.push_str(" {\n");
1997
+ self.push_str(
1998
+ "fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {\n",
1999
+ );
2000
+ self.push_str(&format!("f.debug_struct(\"{name}\")"));
2001
+ for field in record.fields.iter() {
2002
+ self.push_str(&format!(
2003
+ ".field(\"{}\", &self.{})",
2004
+ field.name,
2005
+ to_rust_ident(&field.name)
2006
+ ));
2007
+ }
2008
+ self.push_str(".finish()\n");
2009
+ self.push_str("}\n");
2010
+ self.push_str("}\n");
2011
+
2012
+ if info.error {
2013
+ self.push_str("impl");
2014
+ self.print_generics(mode.lifetime);
2015
+ self.push_str(" ::core::fmt::Display for ");
2016
+ self.push_str(&name);
2017
+ self.print_generics(mode.lifetime);
2018
+ self.push_str(" {\n");
2019
+ self.push_str(
2020
+ "fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {\n",
2021
+ );
2022
+ self.push_str("write!(f, \"{:?}\", self)\n");
2023
+ self.push_str("}\n");
2024
+ self.push_str("}\n");
2025
+ if self.r#gen.opts.std_feature {
2026
+ self.push_str("#[cfg(feature = \"std\")]\n");
2027
+ }
2028
+ self.push_str("impl ::core::error::Error for ");
2029
+ self.push_str(&name);
2030
+ self.push_str(" {}\n");
2031
+ }
2032
+ }
2033
+ }
2034
+
2035
+ fn print_typedef_variant(&mut self, id: TypeId, variant: &Variant, docs: &Docs)
2036
+ where
2037
+ Self: Sized,
2038
+ {
2039
+ self.print_rust_enum(
2040
+ id,
2041
+ variant
2042
+ .cases
2043
+ .iter()
2044
+ .map(|c| (c.name.to_upper_camel_case(), &c.docs, c.ty.as_ref())),
2045
+ docs,
2046
+ );
2047
+ }
2048
+
2049
+ fn print_rust_enum<'b>(
2050
+ &mut self,
2051
+ id: TypeId,
2052
+ cases: impl IntoIterator<Item = (String, &'b Docs, Option<&'b Type>)> + Clone,
2053
+ docs: &Docs,
2054
+ ) where
2055
+ Self: Sized,
2056
+ {
2057
+ let info = self.info(id);
2058
+ // We use a BTree set to make sure we don't have any duplicates and have a stable order
2059
+ let additional_derives: BTreeSet<String> = self
2060
+ .r#gen
2061
+ .opts
2062
+ .additional_derive_attributes
2063
+ .iter()
2064
+ .cloned()
2065
+ .collect();
2066
+ for (name, mode) in self.modes_of(id) {
2067
+ self.rustdoc(docs);
2068
+ let mut derives = BTreeSet::new();
2069
+ if !self
2070
+ .r#gen
2071
+ .opts
2072
+ .additional_derive_ignore
2073
+ .contains(&name.to_kebab_case())
2074
+ {
2075
+ derives.extend(additional_derives.clone());
2076
+ }
2077
+ if info.is_copy() {
2078
+ derives.extend(["Copy", "Clone"].into_iter().map(|s| s.to_string()));
2079
+ } else if info.is_clone() {
2080
+ derives.insert("Clone".to_string());
2081
+ }
2082
+ if !derives.is_empty() {
2083
+ self.push_str("#[derive(");
2084
+ self.push_str(&derives.into_iter().collect::<Vec<_>>().join(", "));
2085
+ self.push_str(")]\n")
2086
+ }
2087
+ self.push_str(&format!("pub enum {name}"));
2088
+ self.print_generics(mode.lifetime);
2089
+ self.push_str(" {\n");
2090
+ for (case_name, docs, payload) in cases.clone() {
2091
+ self.rustdoc(docs);
2092
+ self.push_str(&case_name);
2093
+ if let Some(ty) = payload {
2094
+ self.push_str("(");
2095
+ let mode = self.filter_mode(ty, mode);
2096
+ self.print_ty(ty, mode);
2097
+ self.push_str(")")
2098
+ }
2099
+ self.push_str(",\n");
2100
+ }
2101
+ self.push_str("}\n");
2102
+
2103
+ self.print_rust_enum_debug(
2104
+ mode,
2105
+ &name,
2106
+ cases
2107
+ .clone()
2108
+ .into_iter()
2109
+ .map(|(name, _docs, ty)| (name, ty)),
2110
+ );
2111
+
2112
+ if info.error {
2113
+ self.push_str("impl");
2114
+ self.print_generics(mode.lifetime);
2115
+ self.push_str(" ::core::fmt::Display for ");
2116
+ self.push_str(&name);
2117
+ self.print_generics(mode.lifetime);
2118
+ self.push_str(" {\n");
2119
+ self.push_str(
2120
+ "fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {\n",
2121
+ );
2122
+ self.push_str("write!(f, \"{:?}\", self)\n");
2123
+ self.push_str("}\n");
2124
+ self.push_str("}\n");
2125
+ self.push_str("\n");
2126
+
2127
+ if self.r#gen.opts.std_feature {
2128
+ self.push_str("#[cfg(feature = \"std\")]\n");
2129
+ }
2130
+ self.push_str("impl");
2131
+ self.print_generics(mode.lifetime);
2132
+ self.push_str(" ::core::error::Error for ");
2133
+ self.push_str(&name);
2134
+ self.print_generics(mode.lifetime);
2135
+ self.push_str(" {}\n");
2136
+ }
2137
+ }
2138
+ }
2139
+
2140
+ fn print_rust_enum_debug<'b>(
2141
+ &mut self,
2142
+ mode: TypeMode,
2143
+ name: &str,
2144
+ cases: impl IntoIterator<Item = (String, Option<&'b Type>)>,
2145
+ ) where
2146
+ Self: Sized,
2147
+ {
2148
+ self.push_str("impl");
2149
+ self.print_generics(mode.lifetime);
2150
+ self.push_str(" ::core::fmt::Debug for ");
2151
+ self.push_str(name);
2152
+ self.print_generics(mode.lifetime);
2153
+ self.push_str(" {\n");
2154
+ self.push_str(
2155
+ "fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {\n",
2156
+ );
2157
+ self.push_str("match self {\n");
2158
+ for (case_name, payload) in cases {
2159
+ self.push_str(name);
2160
+ self.push_str("::");
2161
+ self.push_str(&case_name);
2162
+ if payload.is_some() {
2163
+ self.push_str("(e)");
2164
+ }
2165
+ self.push_str(" => {\n");
2166
+ self.push_str(&format!("f.debug_tuple(\"{name}::{case_name}\")"));
2167
+ if payload.is_some() {
2168
+ self.push_str(".field(e)");
2169
+ }
2170
+ self.push_str(".finish()\n");
2171
+ self.push_str("}\n");
2172
+ }
2173
+ self.push_str("}\n");
2174
+ self.push_str("}\n");
2175
+ self.push_str("}\n");
2176
+ }
2177
+
2178
+ fn print_typedef_option(&mut self, id: TypeId, payload: &Type, docs: &Docs) {
2179
+ for (name, mode) in self.modes_of(id) {
2180
+ self.rustdoc(docs);
2181
+ self.push_str(&format!("pub type {name}"));
2182
+ self.print_generics(mode.lifetime);
2183
+ self.push_str("= Option<");
2184
+ self.print_ty(payload, mode);
2185
+ self.push_str(">;\n");
2186
+ }
2187
+ }
2188
+
2189
+ fn print_typedef_result(&mut self, id: TypeId, result: &Result_, docs: &Docs) {
2190
+ for (name, mode) in self.modes_of(id) {
2191
+ self.rustdoc(docs);
2192
+ self.push_str(&format!("pub type {name}"));
2193
+ self.print_generics(mode.lifetime);
2194
+ self.push_str("= Result<");
2195
+ self.print_optional_ty(result.ok.as_ref(), mode);
2196
+ self.push_str(",");
2197
+ self.print_optional_ty(result.err.as_ref(), mode);
2198
+ self.push_str(">;\n");
2199
+ }
2200
+ }
2201
+
2202
+ fn print_typedef_enum(
2203
+ &mut self,
2204
+ id: TypeId,
2205
+ name: &str,
2206
+ enum_: &Enum,
2207
+ docs: &Docs,
2208
+ attrs: &[String],
2209
+ case_attr: Box<dyn Fn(&EnumCase) -> String>,
2210
+ ) where
2211
+ Self: Sized,
2212
+ {
2213
+ let info = self.info(id);
2214
+
2215
+ let name = to_upper_camel_case(name);
2216
+ self.rustdoc(docs);
2217
+ for attr in attrs {
2218
+ self.push_str(&format!("{attr}\n"));
2219
+ }
2220
+ self.push_str("#[repr(");
2221
+ self.int_repr(enum_.tag());
2222
+ self.push_str(")]\n");
2223
+ // We use a BTree set to make sure we don't have any duplicates and a stable order
2224
+ let mut derives: BTreeSet<String> = BTreeSet::new();
2225
+ if !self
2226
+ .r#gen
2227
+ .opts
2228
+ .additional_derive_ignore
2229
+ .contains(&name.to_kebab_case())
2230
+ {
2231
+ derives.extend(self.r#gen.opts.additional_derive_attributes.to_vec());
2232
+ }
2233
+ derives.extend(
2234
+ ["Clone", "Copy", "PartialEq", "Eq", "PartialOrd", "Ord"]
2235
+ .into_iter()
2236
+ .map(|s| s.to_string()),
2237
+ );
2238
+ self.push_str("#[derive(");
2239
+ self.push_str(&derives.into_iter().collect::<Vec<_>>().join(", "));
2240
+ self.push_str(")]\n");
2241
+ self.push_str(&format!("pub enum {name} {{\n"));
2242
+ for case in enum_.cases.iter() {
2243
+ self.rustdoc(&case.docs);
2244
+ self.push_str(&case_attr(case));
2245
+ self.push_str(&case.name.to_upper_camel_case());
2246
+ self.push_str(",\n");
2247
+ }
2248
+ self.push_str("}\n");
2249
+
2250
+ // Auto-synthesize an implementation of the standard `Error` trait for
2251
+ // error-looking types based on their name.
2252
+ if info.error {
2253
+ self.push_str("impl ");
2254
+ self.push_str(&name);
2255
+ self.push_str("{\n");
2256
+
2257
+ self.push_str("pub fn name(&self) -> &'static str {\n");
2258
+ self.push_str("match self {\n");
2259
+ for case in enum_.cases.iter() {
2260
+ self.push_str(&name);
2261
+ self.push_str("::");
2262
+ self.push_str(&case.name.to_upper_camel_case());
2263
+ self.push_str(" => \"");
2264
+ self.push_str(case.name.as_str());
2265
+ self.push_str("\",\n");
2266
+ }
2267
+ self.push_str("}\n");
2268
+ self.push_str("}\n");
2269
+
2270
+ self.push_str("pub fn message(&self) -> &'static str {\n");
2271
+ self.push_str("match self {\n");
2272
+ for case in enum_.cases.iter() {
2273
+ self.push_str(&name);
2274
+ self.push_str("::");
2275
+ self.push_str(&case.name.to_upper_camel_case());
2276
+ self.push_str(" => \"");
2277
+ if let Some(contents) = &case.docs.contents {
2278
+ self.push_str(contents.trim());
2279
+ }
2280
+ self.push_str("\",\n");
2281
+ }
2282
+ self.push_str("}\n");
2283
+ self.push_str("}\n");
2284
+
2285
+ self.push_str("}\n");
2286
+
2287
+ self.push_str("impl ::core::fmt::Debug for ");
2288
+ self.push_str(&name);
2289
+ self.push_str(
2290
+ "{\nfn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {\n",
2291
+ );
2292
+ self.push_str("f.debug_struct(\"");
2293
+ self.push_str(&name);
2294
+ self.push_str("\")\n");
2295
+ self.push_str(".field(\"code\", &(*self as i32))\n");
2296
+ self.push_str(".field(\"name\", &self.name())\n");
2297
+ self.push_str(".field(\"message\", &self.message())\n");
2298
+ self.push_str(".finish()\n");
2299
+ self.push_str("}\n");
2300
+ self.push_str("}\n");
2301
+
2302
+ self.push_str("impl ::core::fmt::Display for ");
2303
+ self.push_str(&name);
2304
+ self.push_str(
2305
+ "{\nfn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {\n",
2306
+ );
2307
+ self.push_str("write!(f, \"{} (error {})\", self.name(), *self as i32)\n");
2308
+ self.push_str("}\n");
2309
+ self.push_str("}\n");
2310
+ self.push_str("\n");
2311
+ if self.r#gen.opts.std_feature {
2312
+ self.push_str("#[cfg(feature = \"std\")]\n");
2313
+ }
2314
+ self.push_str("impl ::core::error::Error for ");
2315
+ self.push_str(&name);
2316
+ self.push_str(" {}\n");
2317
+ } else {
2318
+ self.print_rust_enum_debug(
2319
+ TypeMode::owned(),
2320
+ &name,
2321
+ enum_
2322
+ .cases
2323
+ .iter()
2324
+ .map(|c| (c.name.to_upper_camel_case(), None)),
2325
+ )
2326
+ }
2327
+ }
2328
+
2329
+ fn print_typedef_alias(&mut self, id: TypeId, ty: &Type, docs: &Docs) {
2330
+ for (name, mode) in self.modes_of(id) {
2331
+ self.rustdoc(docs);
2332
+ self.push_str(&format!("pub type {name}"));
2333
+ self.print_generics(mode.lifetime);
2334
+ self.push_str(" = ");
2335
+ self.print_ty(ty, mode);
2336
+ self.push_str(";\n");
2337
+ }
2338
+
2339
+ if self.is_exported_resource(id) {
2340
+ self.rustdoc(docs);
2341
+ let name = self.resolve.types[id].name.as_ref().unwrap();
2342
+ let name = name.to_upper_camel_case();
2343
+ self.push_str(&format!("pub type {name}Borrow<'a>"));
2344
+ self.push_str(" = ");
2345
+ self.print_ty(ty, TypeMode::owned());
2346
+ self.push_str("Borrow<'a>");
2347
+ self.push_str(";\n");
2348
+ }
2349
+ }
2350
+
2351
+ fn param_name(&self, ty: TypeId) -> String {
2352
+ let info = self.info(ty);
2353
+ let name = to_upper_camel_case(self.resolve.types[ty].name.as_ref().unwrap());
2354
+ if self.uses_two_names(&info) {
2355
+ format!("{name}Param")
2356
+ } else {
2357
+ name
2358
+ }
2359
+ }
2360
+
2361
+ fn result_name(&self, ty: TypeId) -> String {
2362
+ let info = self.info(ty);
2363
+ let name = to_upper_camel_case(self.resolve.types[ty].name.as_ref().unwrap());
2364
+ if self.uses_two_names(&info) {
2365
+ format!("{name}Result")
2366
+ } else {
2367
+ name
2368
+ }
2369
+ }
2370
+
2371
+ fn uses_two_names(&self, info: &TypeInfo) -> bool {
2372
+ // Types are only duplicated if explicitly requested ...
2373
+ matches!(
2374
+ self.r#gen.opts.ownership,
2375
+ Ownership::Borrowing {
2376
+ duplicate_if_necessary: true
2377
+ }
2378
+ )
2379
+ // ... and if they're both used in a borrowed/owned context
2380
+ && info.borrowed
2381
+ && info.owned
2382
+ // ... and they have a list ...
2383
+ && info.has_list
2384
+ // ... and if there's NOT an `own` handle since those are always
2385
+ // done by ownership.
2386
+ && !info.has_own_handle
2387
+ }
2388
+
2389
+ fn path_to_interface(&self, interface: InterfaceId) -> Option<String> {
2390
+ let InterfaceName { path, remapped } = &self.r#gen.interface_names[&interface];
2391
+ if *remapped {
2392
+ let mut path_to_root = self.path_to_root();
2393
+ path_to_root.push_str(path);
2394
+ return Some(path_to_root);
2395
+ } else {
2396
+ let mut full_path = String::new();
2397
+ match self.identifier {
2398
+ Identifier::Interface(cur, name) => {
2399
+ if cur == interface {
2400
+ return None;
2401
+ }
2402
+ if !self.in_import {
2403
+ full_path.push_str("super::");
2404
+ }
2405
+ match name {
2406
+ WorldKey::Name(_) => {
2407
+ full_path.push_str("super::");
2408
+ }
2409
+ WorldKey::Interface(_) => {
2410
+ full_path.push_str("super::super::super::");
2411
+ }
2412
+ }
2413
+ }
2414
+ Identifier::StreamOrFuturePayload => {
2415
+ full_path.push_str("super::super::");
2416
+ }
2417
+ _ => {}
2418
+ }
2419
+ full_path.push_str(&path);
2420
+ Some(full_path)
2421
+ }
2422
+ }
2423
+
2424
+ fn push_vec_name(&mut self) {
2425
+ let path = self.path_to_vec();
2426
+ self.push_str(&path);
2427
+ }
2428
+
2429
+ pub fn is_exported_resource(&self, ty: TypeId) -> bool {
2430
+ let ty = dealias(self.resolve, ty);
2431
+ let ty = &self.resolve.types[ty];
2432
+ match &ty.kind {
2433
+ TypeDefKind::Resource => {}
2434
+ _ => return false,
2435
+ }
2436
+
2437
+ match ty.owner {
2438
+ // Worlds cannot export types of any kind as of this writing.
2439
+ TypeOwner::World(_) => false,
2440
+
2441
+ // Interfaces are "stateful" currently where whatever we last saw
2442
+ // them as dictates whether it's exported or not.
2443
+ TypeOwner::Interface(i) => !self.r#gen.interface_last_seen_as_import[&i],
2444
+
2445
+ // Shouldn't be the case for resources
2446
+ TypeOwner::None => unreachable!(),
2447
+ }
2448
+ }
2449
+
2450
+ fn push_string_name(&mut self) {
2451
+ let path = self.path_to_string();
2452
+ self.push_str(&path);
2453
+ }
2454
+
2455
+ fn push_str(&mut self, s: &str) {
2456
+ self.src.push_str(s);
2457
+ }
2458
+
2459
+ fn info(&self, ty: TypeId) -> TypeInfo {
2460
+ self.r#gen.types.get(ty)
2461
+ }
2462
+
2463
+ fn print_borrowed_str(&mut self, lifetime: &'static str) {
2464
+ self.push_str("&");
2465
+ if lifetime != "'_" {
2466
+ self.push_str(lifetime);
2467
+ self.push_str(" ");
2468
+ }
2469
+ if self.r#gen.opts.raw_strings {
2470
+ self.push_str("[u8]");
2471
+ } else {
2472
+ self.push_str("str");
2473
+ }
2474
+ }
2475
+
2476
+ pub fn path_to_resource(&mut self) -> String {
2477
+ self.path_from_runtime_module(RuntimeItem::ResourceType, "Resource")
2478
+ }
2479
+
2480
+ fn path_to_wasm_resource(&mut self) -> String {
2481
+ self.path_from_runtime_module(RuntimeItem::ResourceType, "WasmResource")
2482
+ }
2483
+
2484
+ pub fn path_to_invalid_enum_discriminant(&mut self) -> String {
2485
+ self.path_from_runtime_module(
2486
+ RuntimeItem::InvalidEnumDiscriminant,
2487
+ "invalid_enum_discriminant",
2488
+ )
2489
+ }
2490
+
2491
+ pub fn path_to_string_lift(&mut self) -> String {
2492
+ self.path_from_runtime_module(RuntimeItem::StringLift, "string_lift")
2493
+ }
2494
+
2495
+ pub fn path_to_cabi_dealloc(&mut self) -> String {
2496
+ self.path_from_runtime_module(RuntimeItem::CabiDealloc, "cabi_dealloc")
2497
+ }
2498
+
2499
+ pub fn path_to_as_i32(&mut self) -> String {
2500
+ self.path_from_runtime_module(RuntimeItem::AsI32, "as_i32")
2501
+ }
2502
+
2503
+ pub fn path_to_as_i64(&mut self) -> String {
2504
+ self.path_from_runtime_module(RuntimeItem::AsI64, "as_i64")
2505
+ }
2506
+
2507
+ pub fn path_to_as_f32(&mut self) -> String {
2508
+ self.path_from_runtime_module(RuntimeItem::AsF32, "as_f32")
2509
+ }
2510
+
2511
+ pub fn path_to_as_f64(&mut self) -> String {
2512
+ self.path_from_runtime_module(RuntimeItem::AsF64, "as_f64")
2513
+ }
2514
+
2515
+ pub fn path_to_char_lift(&mut self) -> String {
2516
+ self.path_from_runtime_module(RuntimeItem::CharLift, "char_lift")
2517
+ }
2518
+
2519
+ pub fn path_to_bool_lift(&mut self) -> String {
2520
+ self.path_from_runtime_module(RuntimeItem::BoolLift, "bool_lift")
2521
+ }
2522
+
2523
+ fn path_to_run_ctors_once(&mut self) -> String {
2524
+ self.path_from_runtime_module(RuntimeItem::RunCtorsOnce, "run_ctors_once")
2525
+ }
2526
+
2527
+ pub fn path_to_vec(&mut self) -> String {
2528
+ self.path_from_runtime_module(RuntimeItem::VecType, "Vec")
2529
+ }
2530
+
2531
+ pub fn path_to_string(&mut self) -> String {
2532
+ self.path_from_runtime_module(RuntimeItem::StringType, "String")
2533
+ }
2534
+
2535
+ pub fn path_to_box(&mut self) -> String {
2536
+ self.path_from_runtime_module(RuntimeItem::BoxType, "Box")
2537
+ }
2538
+
2539
+ pub fn path_to_std_alloc_module(&mut self) -> String {
2540
+ self.path_from_runtime_module(RuntimeItem::StdAllocModule, "alloc")
2541
+ }
2542
+
2543
+ fn path_from_runtime_module(
2544
+ &mut self,
2545
+ item: RuntimeItem,
2546
+ name_in_runtime_module: &str,
2547
+ ) -> String {
2548
+ self.needs_runtime_module = true;
2549
+ self.r#gen.rt_module.insert(item);
2550
+ let prefix = if let Identifier::StreamOrFuturePayload = &self.identifier {
2551
+ "super::super::"
2552
+ } else {
2553
+ ""
2554
+ };
2555
+ format!("{prefix}_rt::{name_in_runtime_module}")
2556
+ }
2557
+
2558
+ pub fn is_list_canonical(&self, ty: &Type) -> bool {
2559
+ if !self.resolve.all_bits_valid(ty) {
2560
+ return false;
2561
+ }
2562
+ match ty {
2563
+ // Note that tuples in Rust are not ABI-compatible with component
2564
+ // model tuples, so those are exempted here from canonical lists.
2565
+ Type::Id(id) => {
2566
+ let info = self.r#gen.types.get(*id);
2567
+ !info.has_resource && !info.has_tuple
2568
+ }
2569
+ _ => true,
2570
+ }
2571
+ }
2572
+ }
2573
+
2574
+ impl<'a> wit_bindgen_core::InterfaceGenerator<'a> for InterfaceGenerator<'a> {
2575
+ fn resolve(&self) -> &'a Resolve {
2576
+ self.resolve
2577
+ }
2578
+
2579
+ fn type_record(&mut self, id: TypeId, _name: &str, record: &Record, docs: &Docs) {
2580
+ self.print_typedef_record(id, record, docs);
2581
+ }
2582
+
2583
+ fn type_resource(&mut self, _id: TypeId, name: &str, docs: &Docs) {
2584
+ self.rustdoc(docs);
2585
+ let camel = to_upper_camel_case(name);
2586
+ let resource = self.path_to_resource();
2587
+
2588
+ let wasm_import_module = if self.in_import {
2589
+ // Imported resources are a simple wrapper around `Resource<T>` in
2590
+ // the `wit-bindgen` crate.
2591
+ uwriteln!(
2592
+ self.src,
2593
+ r#"
2594
+ #[derive(Debug)]
2595
+ #[repr(transparent)]
2596
+ pub struct {camel} {{
2597
+ handle: {resource}<{camel}>,
2598
+ }}
2599
+
2600
+ impl {camel} {{
2601
+ #[doc(hidden)]
2602
+ pub unsafe fn from_handle(handle: u32) -> Self {{
2603
+ Self {{
2604
+ handle: unsafe {{ {resource}::from_handle(handle) }},
2605
+ }}
2606
+ }}
2607
+
2608
+ #[doc(hidden)]
2609
+ pub fn take_handle(&self) -> u32 {{
2610
+ {resource}::take_handle(&self.handle)
2611
+ }}
2612
+
2613
+ #[doc(hidden)]
2614
+ pub fn handle(&self) -> u32 {{
2615
+ {resource}::handle(&self.handle)
2616
+ }}
2617
+ }}
2618
+ "#
2619
+ );
2620
+ self.wasm_import_module.to_string()
2621
+ } else {
2622
+ let module = match self.identifier {
2623
+ Identifier::Interface(_, key) => self.resolve.name_world_key(key),
2624
+ Identifier::World(_) => unimplemented!("resource exports from worlds"),
2625
+ Identifier::StreamOrFuturePayload => unreachable!(),
2626
+ };
2627
+ let box_path = self.path_to_box();
2628
+ uwriteln!(
2629
+ self.src,
2630
+ r#"
2631
+ #[derive(Debug)]
2632
+ #[repr(transparent)]
2633
+ pub struct {camel} {{
2634
+ handle: {resource}<{camel}>,
2635
+ }}
2636
+
2637
+ type _{camel}Rep<T> = Option<T>;
2638
+
2639
+ impl {camel} {{
2640
+ /// Creates a new resource from the specified representation.
2641
+ ///
2642
+ /// This function will create a new resource handle by moving `val` onto
2643
+ /// the heap and then passing that heap pointer to the component model to
2644
+ /// create a handle. The owned handle is then returned as `{camel}`.
2645
+ pub fn new<T: Guest{camel}>(val: T) -> Self {{
2646
+ Self::type_guard::<T>();
2647
+ let val: _{camel}Rep<T> = Some(val);
2648
+ let ptr: *mut _{camel}Rep<T> =
2649
+ {box_path}::into_raw({box_path}::new(val));
2650
+ unsafe {{
2651
+ Self::from_handle(T::_resource_new(ptr.cast()))
2652
+ }}
2653
+ }}
2654
+
2655
+ /// Gets access to the underlying `T` which represents this resource.
2656
+ pub fn get<T: Guest{camel}>(&self) -> &T {{
2657
+ let ptr = unsafe {{ &*self.as_ptr::<T>() }};
2658
+ ptr.as_ref().unwrap()
2659
+ }}
2660
+
2661
+ /// Gets mutable access to the underlying `T` which represents this
2662
+ /// resource.
2663
+ pub fn get_mut<T: Guest{camel}>(&mut self) -> &mut T {{
2664
+ let ptr = unsafe {{ &mut *self.as_ptr::<T>() }};
2665
+ ptr.as_mut().unwrap()
2666
+ }}
2667
+
2668
+ /// Consumes this resource and returns the underlying `T`.
2669
+ pub fn into_inner<T: Guest{camel}>(self) -> T {{
2670
+ let ptr = unsafe {{ &mut *self.as_ptr::<T>() }};
2671
+ ptr.take().unwrap()
2672
+ }}
2673
+
2674
+ #[doc(hidden)]
2675
+ pub unsafe fn from_handle(handle: u32) -> Self {{
2676
+ Self {{
2677
+ handle: unsafe {{ {resource}::from_handle(handle) }},
2678
+ }}
2679
+ }}
2680
+
2681
+ #[doc(hidden)]
2682
+ pub fn take_handle(&self) -> u32 {{
2683
+ {resource}::take_handle(&self.handle)
2684
+ }}
2685
+
2686
+ #[doc(hidden)]
2687
+ pub fn handle(&self) -> u32 {{
2688
+ {resource}::handle(&self.handle)
2689
+ }}
2690
+
2691
+ // It's theoretically possible to implement the `Guest{camel}` trait twice
2692
+ // so guard against using it with two different types here.
2693
+ #[doc(hidden)]
2694
+ fn type_guard<T: 'static>() {{
2695
+ use core::any::TypeId;
2696
+ static mut LAST_TYPE: Option<TypeId> = None;
2697
+ unsafe {{
2698
+ assert!(!cfg!(target_feature = "atomics"));
2699
+ let id = TypeId::of::<T>();
2700
+ match LAST_TYPE {{
2701
+ Some(ty) => assert!(ty == id, "cannot use two types with this resource type"),
2702
+ None => LAST_TYPE = Some(id),
2703
+ }}
2704
+ }}
2705
+ }}
2706
+
2707
+ #[doc(hidden)]
2708
+ pub unsafe fn dtor<T: 'static>(handle: *mut u8) {{
2709
+ Self::type_guard::<T>();
2710
+ let _ = unsafe {{ {box_path}::from_raw(handle as *mut _{camel}Rep<T>) }};
2711
+ }}
2712
+
2713
+ fn as_ptr<T: Guest{camel}>(&self) -> *mut _{camel}Rep<T> {{
2714
+ {camel}::type_guard::<T>();
2715
+ T::_resource_rep(self.handle()).cast()
2716
+ }}
2717
+ }}
2718
+
2719
+ /// A borrowed version of [`{camel}`] which represents a borrowed value
2720
+ /// with the lifetime `'a`.
2721
+ #[derive(Debug)]
2722
+ #[repr(transparent)]
2723
+ pub struct {camel}Borrow<'a> {{
2724
+ rep: *mut u8,
2725
+ _marker: core::marker::PhantomData<&'a {camel}>,
2726
+ }}
2727
+
2728
+ impl<'a> {camel}Borrow<'a>{{
2729
+ #[doc(hidden)]
2730
+ pub unsafe fn lift(rep: usize) -> Self {{
2731
+ Self {{
2732
+ rep: rep as *mut u8,
2733
+ _marker: core::marker::PhantomData,
2734
+ }}
2735
+ }}
2736
+
2737
+ /// Gets access to the underlying `T` in this resource.
2738
+ pub fn get<T: Guest{camel}>(&self) -> &'a T {{
2739
+ let ptr = unsafe {{ &mut *self.as_ptr::<T>() }};
2740
+ ptr.as_ref().unwrap()
2741
+ }}
2742
+
2743
+ // NB: mutable access is not allowed due to the component model allowing
2744
+ // multiple borrows of the same resource.
2745
+
2746
+ fn as_ptr<T: 'static>(&self) -> *mut _{camel}Rep<T> {{
2747
+ {camel}::type_guard::<T>();
2748
+ self.rep.cast()
2749
+ }}
2750
+ }}
2751
+ "#
2752
+ );
2753
+ format!("[export]{module}")
2754
+ };
2755
+
2756
+ let wasm_resource = self.path_to_wasm_resource();
2757
+ let intrinsic = crate::declare_import(
2758
+ &wasm_import_module,
2759
+ &format!("[resource-drop]{name}"),
2760
+ "drop",
2761
+ &[abi::WasmType::I32],
2762
+ &[],
2763
+ );
2764
+ uwriteln!(
2765
+ self.src,
2766
+ r#"
2767
+ unsafe impl {wasm_resource} for {camel} {{
2768
+ #[inline]
2769
+ unsafe fn drop(_handle: u32) {{
2770
+ {intrinsic}
2771
+ unsafe {{ drop(_handle as i32); }}
2772
+ }}
2773
+ }}
2774
+ "#
2775
+ );
2776
+ }
2777
+
2778
+ fn type_tuple(&mut self, id: TypeId, _name: &str, tuple: &Tuple, docs: &Docs) {
2779
+ for (name, mode) in self.modes_of(id) {
2780
+ self.rustdoc(docs);
2781
+ self.push_str(&format!("pub type {name}"));
2782
+ self.print_generics(mode.lifetime);
2783
+ self.push_str(" = (");
2784
+ for ty in tuple.types.iter() {
2785
+ let mode = self.filter_mode(ty, mode);
2786
+ self.print_ty(ty, mode);
2787
+ self.push_str(",");
2788
+ }
2789
+ self.push_str(");\n");
2790
+ }
2791
+ }
2792
+
2793
+ fn type_flags(&mut self, _id: TypeId, name: &str, flags: &Flags, docs: &Docs) {
2794
+ self.src.push_str(&format!(
2795
+ "{bitflags}::bitflags! {{\n",
2796
+ bitflags = self.r#gen.bitflags_path()
2797
+ ));
2798
+ self.rustdoc(docs);
2799
+ let repr = RustFlagsRepr::new(flags);
2800
+ self.src.push_str(&format!(
2801
+ "#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]\npub struct {}: {repr} {{\n",
2802
+ name.to_upper_camel_case(),
2803
+ ));
2804
+ for (i, flag) in flags.flags.iter().enumerate() {
2805
+ self.rustdoc(&flag.docs);
2806
+ self.src.push_str(&format!(
2807
+ "const {} = 1 << {};\n",
2808
+ flag.name.to_shouty_snake_case(),
2809
+ i,
2810
+ ));
2811
+ }
2812
+ self.src.push_str("}\n");
2813
+ self.src.push_str("}\n");
2814
+ }
2815
+
2816
+ fn type_variant(&mut self, id: TypeId, _name: &str, variant: &Variant, docs: &Docs) {
2817
+ self.print_typedef_variant(id, variant, docs);
2818
+ }
2819
+
2820
+ fn type_option(&mut self, id: TypeId, _name: &str, payload: &Type, docs: &Docs) {
2821
+ self.print_typedef_option(id, payload, docs);
2822
+ }
2823
+
2824
+ fn type_result(&mut self, id: TypeId, _name: &str, result: &Result_, docs: &Docs) {
2825
+ self.print_typedef_result(id, result, docs);
2826
+ }
2827
+
2828
+ fn type_enum(&mut self, id: TypeId, name: &str, enum_: &Enum, docs: &Docs) {
2829
+ self.print_typedef_enum(id, name, enum_, docs, &[], Box::new(|_| String::new()));
2830
+
2831
+ let name = to_upper_camel_case(name);
2832
+ let mut cases = String::new();
2833
+ let repr = int_repr(enum_.tag());
2834
+ for (i, case) in enum_.cases.iter().enumerate() {
2835
+ let case = case.name.to_upper_camel_case();
2836
+ cases.push_str(&format!("{i} => {name}::{case},\n"));
2837
+ }
2838
+ uwriteln!(
2839
+ self.src,
2840
+ r#"
2841
+ impl {name} {{
2842
+ #[doc(hidden)]
2843
+ pub unsafe fn _lift(val: {repr}) -> {name} {{
2844
+ if !cfg!(debug_assertions) {{
2845
+ return unsafe {{ ::core::mem::transmute(val) }};
2846
+ }}
2847
+
2848
+ match val {{
2849
+ {cases}
2850
+ _ => panic!("invalid enum discriminant"),
2851
+ }}
2852
+ }}
2853
+ }}
2854
+ "#
2855
+ );
2856
+ }
2857
+
2858
+ fn type_alias(&mut self, id: TypeId, _name: &str, ty: &Type, docs: &Docs) {
2859
+ self.print_typedef_alias(id, ty, docs);
2860
+ }
2861
+
2862
+ fn type_list(&mut self, id: TypeId, _name: &str, ty: &Type, docs: &Docs) {
2863
+ for (name, mode) in self.modes_of(id) {
2864
+ self.rustdoc(docs);
2865
+ self.push_str(&format!("pub type {name}"));
2866
+ self.print_generics(mode.lifetime);
2867
+ self.push_str(" = ");
2868
+ self.print_list(ty, mode);
2869
+ self.push_str(";\n");
2870
+ }
2871
+ }
2872
+
2873
+ fn type_future(&mut self, _id: TypeId, name: &str, ty: &Option<Type>, docs: &Docs) {
2874
+ let async_support = self.r#gen.async_support_path();
2875
+ let mode = TypeMode {
2876
+ style: TypeOwnershipStyle::Owned,
2877
+ lists_borrowed: false,
2878
+ lifetime: None,
2879
+ };
2880
+ self.rustdoc(docs);
2881
+ self.push_str(&format!("pub type {}", name.to_upper_camel_case()));
2882
+ self.print_generics(mode.lifetime);
2883
+ self.push_str(" = ");
2884
+ self.push_str(&format!("{async_support}::FutureReader<"));
2885
+ self.print_optional_ty(ty.as_ref(), mode);
2886
+ self.push_str(">");
2887
+ self.push_str(";\n");
2888
+ }
2889
+
2890
+ fn type_stream(&mut self, _id: TypeId, name: &str, ty: &Option<Type>, docs: &Docs) {
2891
+ let async_support = self.r#gen.async_support_path();
2892
+ let mode = TypeMode {
2893
+ style: TypeOwnershipStyle::Owned,
2894
+ lists_borrowed: false,
2895
+ lifetime: None,
2896
+ };
2897
+ self.rustdoc(docs);
2898
+ self.push_str(&format!("pub type {}", name.to_upper_camel_case()));
2899
+ self.print_generics(mode.lifetime);
2900
+ self.push_str(" = ");
2901
+ self.push_str(&format!("{async_support}::StreamReader<"));
2902
+ self.print_optional_ty(ty.as_ref(), mode);
2903
+ self.push_str(">");
2904
+ self.push_str(";\n");
2905
+ }
2906
+
2907
+ fn type_builtin(&mut self, _id: TypeId, name: &str, ty: &Type, docs: &Docs) {
2908
+ self.rustdoc(docs);
2909
+ self.src
2910
+ .push_str(&format!("pub type {}", name.to_upper_camel_case()));
2911
+ self.src.push_str(" = ");
2912
+ self.print_ty(ty, TypeMode::owned());
2913
+ self.src.push_str(";\n");
2914
+ }
2915
+ }
2916
+
2917
+ struct AnonTypeGenerator<'a, 'b> {
2918
+ mode: TypeMode,
2919
+ resolve: &'a Resolve,
2920
+ interface: &'a mut InterfaceGenerator<'b>,
2921
+ }
2922
+
2923
+ impl<'a, 'b> wit_bindgen_core::AnonymousTypeGenerator<'a> for AnonTypeGenerator<'a, 'b> {
2924
+ fn resolve(&self) -> &'a Resolve {
2925
+ self.resolve
2926
+ }
2927
+
2928
+ fn anonymous_type_type(&mut self, _id: TypeId, ty: &Type, _docs: &Docs) {
2929
+ self.interface.print_ty(ty, self.mode);
2930
+ }
2931
+
2932
+ fn anonymous_type_handle(&mut self, _id: TypeId, handle: &Handle, _docs: &Docs) {
2933
+ match handle {
2934
+ Handle::Own(ty) => {
2935
+ self.interface.print_ty(&Type::Id(*ty), self.mode);
2936
+ }
2937
+ Handle::Borrow(ty) => {
2938
+ assert!(self.mode.lifetime.is_some());
2939
+ let lt = self.mode.lifetime.unwrap();
2940
+ if self.interface.is_exported_resource(*ty) {
2941
+ let camel = self.resolve.types[*ty]
2942
+ .name
2943
+ .as_deref()
2944
+ .unwrap()
2945
+ .to_upper_camel_case();
2946
+ let name = format!("{camel}Borrow");
2947
+ self.interface
2948
+ .push_str(&self.interface.type_path_with_name(*ty, name));
2949
+ self.interface.push_str("<");
2950
+ self.interface.push_str(lt);
2951
+ self.interface.push_str(">");
2952
+ } else {
2953
+ self.interface.push_str("&");
2954
+ if lt != "'_" {
2955
+ self.interface.push_str(lt);
2956
+ self.interface.push_str(" ");
2957
+ }
2958
+ let ty = &Type::Id(*ty);
2959
+ let mode = self.interface.filter_mode(ty, self.mode);
2960
+ self.interface.print_ty(ty, mode);
2961
+ }
2962
+ }
2963
+ }
2964
+ }
2965
+
2966
+ fn anonymous_type_tuple(&mut self, _id: TypeId, ty: &Tuple, _docs: &Docs) {
2967
+ self.interface.push_str("(");
2968
+ for ty in ty.types.iter() {
2969
+ let mode = self.interface.filter_mode_preserve_top(ty, self.mode);
2970
+ self.interface.print_ty(ty, mode);
2971
+ self.interface.push_str(",");
2972
+ }
2973
+ self.interface.push_str(")");
2974
+ }
2975
+
2976
+ fn anonymous_type_option(&mut self, _id: TypeId, t: &Type, _docs: &Docs) {
2977
+ self.interface.push_str("Option<");
2978
+ let mode = self.interface.filter_mode_preserve_top(t, self.mode);
2979
+ self.interface.print_ty(t, mode);
2980
+ self.interface.push_str(">");
2981
+ }
2982
+
2983
+ fn anonymous_type_result(&mut self, _id: TypeId, r: &Result_, _docs: &Docs) {
2984
+ self.interface.push_str("Result<");
2985
+ self.interface.print_optional_ty(r.ok.as_ref(), self.mode);
2986
+ self.interface.push_str(",");
2987
+ self.interface.print_optional_ty(r.err.as_ref(), self.mode);
2988
+ self.interface.push_str(">");
2989
+ }
2990
+
2991
+ fn anonymous_type_list(&mut self, _id: TypeId, ty: &Type, _docs: &Docs) {
2992
+ self.interface.print_list(ty, self.mode)
2993
+ }
2994
+
2995
+ fn anonymous_type_future(&mut self, _id: TypeId, ty: &Option<Type>, _docs: &Docs) {
2996
+ let async_support = self.interface.r#gen.async_support_path();
2997
+ let mode = TypeMode {
2998
+ style: TypeOwnershipStyle::Owned,
2999
+ lists_borrowed: false,
3000
+ lifetime: None,
3001
+ };
3002
+ self.interface
3003
+ .push_str(&format!("{async_support}::FutureReader<"));
3004
+ self.interface.print_optional_ty(ty.as_ref(), mode);
3005
+ self.interface.push_str(">");
3006
+ }
3007
+
3008
+ fn anonymous_type_stream(&mut self, _id: TypeId, ty: &Option<Type>, _docs: &Docs) {
3009
+ let async_support = self.interface.r#gen.async_support_path();
3010
+ let mode = TypeMode {
3011
+ style: TypeOwnershipStyle::Owned,
3012
+ lists_borrowed: false,
3013
+ lifetime: None,
3014
+ };
3015
+ self.interface
3016
+ .push_str(&format!("{async_support}::StreamReader<"));
3017
+ self.interface.print_optional_ty(ty.as_ref(), mode);
3018
+ self.interface.push_str(">");
3019
+ }
3020
+ }