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.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/README.md +1 -1
- data/ext/html-to-markdown-rb/native/Cargo.lock +254 -47
- data/ext/html-to-markdown-rb/native/Cargo.toml +1 -1
- data/lib/html_to_markdown/version.rb +1 -1
- data/rust-vendor/anyhow/.cargo-checksum.json +1 -0
- data/rust-vendor/anyhow/.cargo_vcs_info.json +6 -0
- data/rust-vendor/anyhow/.github/FUNDING.yml +1 -0
- data/rust-vendor/anyhow/.github/workflows/ci.yml +147 -0
- data/rust-vendor/anyhow/Cargo.lock +424 -0
- data/rust-vendor/anyhow/Cargo.toml +132 -0
- data/rust-vendor/anyhow/Cargo.toml.orig +40 -0
- data/rust-vendor/anyhow/LICENSE-APACHE +176 -0
- data/rust-vendor/anyhow/LICENSE-MIT +23 -0
- data/rust-vendor/anyhow/README.md +179 -0
- data/rust-vendor/anyhow/build.rs +207 -0
- data/rust-vendor/anyhow/rust-toolchain.toml +2 -0
- data/rust-vendor/anyhow/src/backtrace.rs +410 -0
- data/rust-vendor/anyhow/src/chain.rs +102 -0
- data/rust-vendor/anyhow/src/context.rs +193 -0
- data/rust-vendor/anyhow/src/ensure.rs +935 -0
- data/rust-vendor/anyhow/src/error.rs +1086 -0
- data/rust-vendor/anyhow/src/fmt.rs +158 -0
- data/rust-vendor/anyhow/src/kind.rs +121 -0
- data/rust-vendor/anyhow/src/lib.rs +728 -0
- data/rust-vendor/anyhow/src/macros.rs +245 -0
- data/rust-vendor/anyhow/src/nightly.rs +58 -0
- data/rust-vendor/anyhow/src/ptr.rs +187 -0
- data/rust-vendor/anyhow/src/wrapper.rs +84 -0
- data/rust-vendor/anyhow/tests/common/mod.rs +14 -0
- data/rust-vendor/anyhow/tests/compiletest.rs +7 -0
- data/rust-vendor/anyhow/tests/drop/mod.rs +53 -0
- data/rust-vendor/anyhow/tests/test_autotrait.rs +34 -0
- data/rust-vendor/anyhow/tests/test_backtrace.rs +15 -0
- data/rust-vendor/anyhow/tests/test_boxed.rs +45 -0
- data/rust-vendor/anyhow/tests/test_chain.rs +69 -0
- data/rust-vendor/anyhow/tests/test_context.rs +172 -0
- data/rust-vendor/anyhow/tests/test_convert.rs +46 -0
- data/rust-vendor/anyhow/tests/test_downcast.rs +123 -0
- data/rust-vendor/anyhow/tests/test_ensure.rs +756 -0
- data/rust-vendor/anyhow/tests/test_ffi.rs +19 -0
- data/rust-vendor/anyhow/tests/test_fmt.rs +93 -0
- data/rust-vendor/anyhow/tests/test_macros.rs +97 -0
- data/rust-vendor/anyhow/tests/test_repr.rs +30 -0
- data/rust-vendor/anyhow/tests/test_source.rs +62 -0
- data/rust-vendor/anyhow/tests/ui/chained-comparison.rs +8 -0
- data/rust-vendor/anyhow/tests/ui/chained-comparison.stderr +10 -0
- data/rust-vendor/anyhow/tests/ui/empty-ensure.rs +6 -0
- data/rust-vendor/anyhow/tests/ui/empty-ensure.stderr +12 -0
- data/rust-vendor/anyhow/tests/ui/ensure-nonbool.rs +40 -0
- data/rust-vendor/anyhow/tests/ui/ensure-nonbool.stderr +113 -0
- data/rust-vendor/anyhow/tests/ui/must-use.rs +11 -0
- data/rust-vendor/anyhow/tests/ui/must-use.stderr +15 -0
- data/rust-vendor/anyhow/tests/ui/no-impl.rs +8 -0
- data/rust-vendor/anyhow/tests/ui/no-impl.stderr +32 -0
- data/rust-vendor/anyhow/tests/ui/temporary-value.rs +5 -0
- data/rust-vendor/anyhow/tests/ui/temporary-value.stderr +15 -0
- data/rust-vendor/anyhow/tests/ui/wrong-interpolation.rs +5 -0
- data/rust-vendor/anyhow/tests/ui/wrong-interpolation.stderr +5 -0
- data/rust-vendor/bitflags/.cargo-checksum.json +1 -1
- data/rust-vendor/bitflags/.cargo_vcs_info.json +1 -1
- data/rust-vendor/bitflags/CHANGELOG.md +12 -0
- data/rust-vendor/bitflags/Cargo.lock +48 -48
- data/rust-vendor/bitflags/Cargo.toml +1 -1
- data/rust-vendor/bitflags/Cargo.toml.orig +1 -1
- data/rust-vendor/bitflags/README.md +1 -1
- data/rust-vendor/bitflags/src/external.rs +1 -1
- data/rust-vendor/bitflags/src/lib.rs +1 -1
- data/rust-vendor/bitflags/src/tests/known_bits.rs +47 -0
- data/rust-vendor/bitflags/src/tests/unknown_bits.rs +53 -0
- data/rust-vendor/bitflags/src/tests.rs +2 -0
- data/rust-vendor/bitflags/src/traits.rs +11 -1
- data/rust-vendor/cc/.cargo-checksum.json +1 -1
- data/rust-vendor/cc/.cargo_vcs_info.json +1 -1
- data/rust-vendor/cc/CHANGELOG.md +7 -0
- data/rust-vendor/cc/Cargo.lock +331 -7
- data/rust-vendor/cc/Cargo.toml +1 -1
- data/rust-vendor/cc/Cargo.toml.orig +1 -1
- data/rust-vendor/cc/src/lib.rs +10 -13
- data/rust-vendor/cc/src/target/generated.rs +1 -0
- data/rust-vendor/cpp_demangle/.cargo-checksum.json +1 -1
- data/rust-vendor/cpp_demangle/.cargo_vcs_info.json +1 -1
- data/rust-vendor/cpp_demangle/CHANGELOG.md +55 -0
- data/rust-vendor/cpp_demangle/Cargo.lock +5 -5
- data/rust-vendor/cpp_demangle/Cargo.toml +2 -2
- data/rust-vendor/cpp_demangle/Cargo.toml.orig +2 -2
- data/rust-vendor/cpp_demangle/README.md +9 -9
- data/rust-vendor/cpp_demangle/build.rs +10 -9
- data/rust-vendor/cpp_demangle/examples/cppfilt.rs +1 -1
- data/rust-vendor/cpp_demangle/examples/simple.rs +1 -1
- data/rust-vendor/cpp_demangle/src/ast.rs +238 -36
- data/rust-vendor/cpp_demangle/src/lib.rs +31 -46
- data/rust-vendor/cpp_demangle/src/subs.rs +1 -1
- data/rust-vendor/flate2/.cargo-checksum.json +1 -1
- data/rust-vendor/flate2/.cargo_vcs_info.json +1 -1
- data/rust-vendor/flate2/Cargo.lock +3 -3
- data/rust-vendor/flate2/Cargo.toml +13 -2
- data/rust-vendor/flate2/Cargo.toml.orig +16 -13
- data/rust-vendor/flate2/LICENSE-MIT +1 -1
- data/rust-vendor/flate2/src/crc.rs +177 -42
- data/rust-vendor/flate2/src/gz/mod.rs +159 -0
- data/rust-vendor/foldhash-0.1.5/.cargo-checksum.json +1 -0
- data/rust-vendor/foldhash-0.1.5/.cargo_vcs_info.json +6 -0
- data/rust-vendor/foldhash-0.1.5/Cargo.lock +852 -0
- data/rust-vendor/foldhash-0.1.5/Cargo.toml +76 -0
- data/rust-vendor/foldhash-0.1.5/Cargo.toml.orig +44 -0
- data/rust-vendor/foldhash-0.1.5/LICENSE +19 -0
- data/rust-vendor/foldhash-0.1.5/README.md +277 -0
- data/rust-vendor/foldhash-0.1.5/src/convenience.rs +73 -0
- data/rust-vendor/foldhash-0.1.5/src/fast.rs +270 -0
- data/rust-vendor/foldhash-0.1.5/src/lib.rs +284 -0
- data/rust-vendor/foldhash-0.1.5/src/quality.rs +174 -0
- data/rust-vendor/foldhash-0.1.5/src/seed.rs +267 -0
- data/rust-vendor/getrandom/.cargo-checksum.json +1 -1
- data/rust-vendor/getrandom/.cargo_vcs_info.json +1 -1
- data/rust-vendor/getrandom/CHANGELOG.md +39 -1
- data/rust-vendor/getrandom/Cargo.lock +451 -60
- data/rust-vendor/getrandom/Cargo.toml +44 -5
- data/rust-vendor/getrandom/Cargo.toml.orig +45 -10
- data/rust-vendor/getrandom/LICENSE-MIT +1 -1
- data/rust-vendor/getrandom/README.md +72 -40
- data/rust-vendor/getrandom/benches/buffer.rs +10 -8
- data/rust-vendor/getrandom/build.rs +1 -47
- data/rust-vendor/getrandom/src/backends/custom.rs +1 -1
- data/rust-vendor/getrandom/src/backends/efi_rng.rs +1 -1
- data/rust-vendor/getrandom/src/backends/esp_idf.rs +1 -1
- data/rust-vendor/getrandom/src/backends/extern_impl.rs +19 -0
- data/rust-vendor/getrandom/src/backends/fuchsia.rs +1 -1
- data/rust-vendor/getrandom/src/backends/getentropy.rs +4 -3
- data/rust-vendor/getrandom/src/backends/getrandom.rs +4 -12
- data/rust-vendor/getrandom/src/backends/hermit.rs +1 -1
- data/rust-vendor/getrandom/src/backends/linux_android_with_fallback.rs +8 -10
- data/rust-vendor/getrandom/src/backends/linux_raw.rs +101 -75
- data/rust-vendor/getrandom/src/backends/netbsd.rs +3 -3
- data/rust-vendor/getrandom/src/backends/rdrand.rs +26 -13
- data/rust-vendor/getrandom/src/backends/rndr.rs +13 -11
- data/rust-vendor/getrandom/src/backends/solaris.rs +5 -4
- data/rust-vendor/getrandom/src/backends/solid.rs +1 -1
- data/rust-vendor/getrandom/src/backends/use_file.rs +17 -28
- data/rust-vendor/getrandom/src/backends/vxworks.rs +2 -4
- data/rust-vendor/getrandom/src/backends/wasi_p1.rs +1 -1
- data/rust-vendor/getrandom/src/backends/wasi_p2_3.rs +61 -0
- data/rust-vendor/getrandom/src/backends/wasm_js.rs +1 -1
- data/rust-vendor/getrandom/src/backends/windows.rs +7 -11
- data/rust-vendor/getrandom/src/backends/windows_legacy.rs +1 -1
- data/rust-vendor/getrandom/src/backends.rs +9 -28
- data/rust-vendor/getrandom/src/error.rs +39 -6
- data/rust-vendor/getrandom/src/error_std_impls.rs +1 -3
- data/rust-vendor/getrandom/src/lib.rs +39 -18
- data/rust-vendor/getrandom/src/sys_rng.rs +55 -0
- data/rust-vendor/getrandom/src/util.rs +3 -15
- data/rust-vendor/getrandom/src/utils/get_errno.rs +29 -0
- data/rust-vendor/getrandom/src/utils/lazy.rs +64 -0
- data/rust-vendor/getrandom/src/utils/sanitizer.rs +28 -0
- data/rust-vendor/getrandom/src/utils/sys_fill_exact.rs +41 -0
- data/rust-vendor/getrandom/tests/mod.rs +6 -94
- data/rust-vendor/getrandom/tests/sys_rng.rs +18 -0
- data/rust-vendor/getrandom-0.3.4/.cargo-checksum.json +1 -0
- data/rust-vendor/getrandom-0.3.4/.cargo_vcs_info.json +6 -0
- data/rust-vendor/getrandom-0.3.4/CHANGELOG.md +673 -0
- data/rust-vendor/getrandom-0.3.4/Cargo.lock +292 -0
- data/rust-vendor/getrandom-0.3.4/Cargo.toml +133 -0
- data/rust-vendor/getrandom-0.3.4/Cargo.toml.orig +100 -0
- data/rust-vendor/getrandom-0.3.4/LICENSE-APACHE +201 -0
- data/rust-vendor/getrandom-0.3.4/LICENSE-MIT +26 -0
- data/rust-vendor/getrandom-0.3.4/README.md +386 -0
- data/rust-vendor/getrandom-0.3.4/SECURITY.md +13 -0
- data/rust-vendor/getrandom-0.3.4/benches/buffer.rs +121 -0
- data/rust-vendor/getrandom-0.3.4/build.rs +57 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/apple_other.rs +21 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/custom.rs +13 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/efi_rng.rs +124 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/esp_idf.rs +21 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/fuchsia.rs +16 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/getentropy.rs +27 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/getrandom.rs +39 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/hermit.rs +53 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/linux_android_with_fallback.rs +103 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/linux_raw.rs +143 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/netbsd.rs +78 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/rdrand.rs +182 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/rndr.rs +145 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/solaris.rs +42 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/solid.rs +19 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/unsupported.rs +9 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/use_file.rs +234 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/vxworks.rs +54 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/wasi_p1.rs +32 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/wasm_js.rs +72 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/windows.rs +61 -0
- data/rust-vendor/getrandom-0.3.4/src/backends/windows_legacy.rs +48 -0
- data/rust-vendor/getrandom-0.3.4/src/backends.rs +209 -0
- data/rust-vendor/getrandom-0.3.4/src/error.rs +212 -0
- data/rust-vendor/getrandom-0.3.4/src/error_std_impls.rs +15 -0
- data/rust-vendor/getrandom-0.3.4/src/lib.rs +138 -0
- data/rust-vendor/getrandom-0.3.4/src/util.rs +84 -0
- data/rust-vendor/getrandom-0.3.4/tests/mod.rs +297 -0
- data/rust-vendor/hashbrown-0.15.5/.cargo-checksum.json +1 -0
- data/rust-vendor/hashbrown-0.15.5/.cargo_vcs_info.json +6 -0
- data/rust-vendor/hashbrown-0.15.5/CHANGELOG.md +619 -0
- data/rust-vendor/hashbrown-0.15.5/Cargo.lock +306 -0
- data/rust-vendor/hashbrown-0.15.5/Cargo.toml +164 -0
- data/rust-vendor/hashbrown-0.15.5/Cargo.toml.orig +77 -0
- data/rust-vendor/hashbrown-0.15.5/Cross.toml +3 -0
- data/rust-vendor/hashbrown-0.15.5/LICENSE-APACHE +201 -0
- data/rust-vendor/hashbrown-0.15.5/LICENSE-MIT +25 -0
- data/rust-vendor/hashbrown-0.15.5/README.md +80 -0
- data/rust-vendor/hashbrown-0.15.5/benches/bench.rs +329 -0
- data/rust-vendor/hashbrown-0.15.5/benches/insert_unique_unchecked.rs +34 -0
- data/rust-vendor/hashbrown-0.15.5/benches/set_ops.rs +148 -0
- data/rust-vendor/hashbrown-0.15.5/clippy.toml +1 -0
- data/rust-vendor/hashbrown-0.15.5/src/control/bitmask.rs +117 -0
- data/rust-vendor/hashbrown-0.15.5/src/control/group/generic.rs +154 -0
- data/rust-vendor/hashbrown-0.15.5/src/control/group/lsx.rs +137 -0
- data/rust-vendor/hashbrown-0.15.5/src/control/group/mod.rs +43 -0
- data/rust-vendor/hashbrown-0.15.5/src/control/group/neon.rs +121 -0
- data/rust-vendor/hashbrown-0.15.5/src/control/group/sse2.rs +146 -0
- data/rust-vendor/hashbrown-0.15.5/src/control/mod.rs +10 -0
- data/rust-vendor/hashbrown-0.15.5/src/control/tag.rs +83 -0
- data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/mod.rs +4 -0
- data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/helpers.rs +27 -0
- data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/map.rs +721 -0
- data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/mod.rs +5 -0
- data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/raw.rs +230 -0
- data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/set.rs +659 -0
- data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/rayon/table.rs +249 -0
- data/rust-vendor/hashbrown-0.15.5/src/external_trait_impls/serde.rs +220 -0
- data/rust-vendor/hashbrown-0.15.5/src/lib.rs +188 -0
- data/rust-vendor/hashbrown-0.15.5/src/macros.rs +70 -0
- data/rust-vendor/hashbrown-0.15.5/src/map.rs +6583 -0
- data/rust-vendor/hashbrown-0.15.5/src/raw/alloc.rs +92 -0
- data/rust-vendor/hashbrown-0.15.5/src/raw/mod.rs +4436 -0
- data/rust-vendor/hashbrown-0.15.5/src/raw_entry.rs +1740 -0
- data/rust-vendor/hashbrown-0.15.5/src/rustc_entry.rs +567 -0
- data/rust-vendor/hashbrown-0.15.5/src/scopeguard.rs +72 -0
- data/rust-vendor/hashbrown-0.15.5/src/set.rs +3121 -0
- data/rust-vendor/hashbrown-0.15.5/src/table.rs +2380 -0
- data/rust-vendor/hashbrown-0.15.5/src/util.rs +38 -0
- data/rust-vendor/hashbrown-0.15.5/tests/equivalent_trait.rs +53 -0
- data/rust-vendor/hashbrown-0.15.5/tests/hasher.rs +65 -0
- data/rust-vendor/hashbrown-0.15.5/tests/rayon.rs +535 -0
- data/rust-vendor/hashbrown-0.15.5/tests/serde.rs +65 -0
- data/rust-vendor/hashbrown-0.15.5/tests/set.rs +34 -0
- data/rust-vendor/heck/.cargo-checksum.json +1 -0
- data/rust-vendor/heck/.cargo_vcs_info.json +6 -0
- data/rust-vendor/heck/CHANGELOG.md +25 -0
- data/rust-vendor/heck/Cargo.toml +34 -0
- data/rust-vendor/heck/Cargo.toml.orig +11 -0
- data/rust-vendor/heck/LICENSE-APACHE +201 -0
- data/rust-vendor/heck/LICENSE-MIT +25 -0
- data/rust-vendor/heck/README.md +53 -0
- data/rust-vendor/heck/src/kebab.rs +75 -0
- data/rust-vendor/heck/src/lib.rs +192 -0
- data/rust-vendor/heck/src/lower_camel.rs +88 -0
- data/rust-vendor/heck/src/shouty_kebab.rs +73 -0
- data/rust-vendor/heck/src/shouty_snake.rs +86 -0
- data/rust-vendor/heck/src/snake.rs +100 -0
- data/rust-vendor/heck/src/title.rs +75 -0
- data/rust-vendor/heck/src/train.rs +87 -0
- data/rust-vendor/heck/src/upper_camel.rs +88 -0
- data/rust-vendor/html-to-markdown-rs/src/converter/inline/semantic/typography.rs +32 -22
- data/rust-vendor/html-to-markdown-rs/tests/integration_test.rs +44 -0
- data/rust-vendor/id-arena/.cargo-checksum.json +1 -0
- data/rust-vendor/id-arena/.cargo_vcs_info.json +6 -0
- data/rust-vendor/id-arena/.travis.yml +22 -0
- data/rust-vendor/id-arena/CHANGELOG.md +71 -0
- data/rust-vendor/id-arena/Cargo.lock +61 -0
- data/rust-vendor/id-arena/Cargo.toml +54 -0
- data/rust-vendor/id-arena/Cargo.toml.orig +21 -0
- data/rust-vendor/id-arena/LICENSE-APACHE +201 -0
- data/rust-vendor/id-arena/LICENSE-MIT +25 -0
- data/rust-vendor/id-arena/README.md +101 -0
- data/rust-vendor/id-arena/README.tpl +3 -0
- data/rust-vendor/id-arena/src/lib.rs +726 -0
- data/rust-vendor/id-arena/src/rayon.rs +282 -0
- data/rust-vendor/id-arena/tests/readme_up_to_date.rs +22 -0
- data/rust-vendor/leb128fmt/.cargo-checksum.json +1 -0
- data/rust-vendor/leb128fmt/.cargo_vcs_info.json +6 -0
- data/rust-vendor/leb128fmt/CHANGELOG.md +11 -0
- data/rust-vendor/leb128fmt/Cargo.toml +55 -0
- data/rust-vendor/leb128fmt/Cargo.toml.orig +32 -0
- data/rust-vendor/leb128fmt/LICENSE-APACHE +201 -0
- data/rust-vendor/leb128fmt/LICENSE-MIT +23 -0
- data/rust-vendor/leb128fmt/README.md +162 -0
- data/rust-vendor/leb128fmt/src/lib.rs +1650 -0
- data/rust-vendor/libc/.cargo-checksum.json +1 -1
- data/rust-vendor/libc/.cargo_vcs_info.json +1 -1
- data/rust-vendor/libc/CHANGELOG.md +42 -0
- data/rust-vendor/libc/Cargo.lock +1 -1
- data/rust-vendor/libc/Cargo.toml +75 -51
- data/rust-vendor/libc/Cargo.toml.orig +85 -53
- data/rust-vendor/libc/LICENSE-MIT +1 -1
- data/rust-vendor/libc/src/fuchsia/mod.rs +12 -10
- data/rust-vendor/libc/src/macros.rs +63 -71
- data/rust-vendor/libc/src/new/linux_uapi/linux/can/error.rs +73 -0
- data/rust-vendor/libc/src/new/linux_uapi/linux/can.rs +1 -0
- data/rust-vendor/libc/src/new/mod.rs +3 -2
- data/rust-vendor/libc/src/new/qurt/dlfcn.rs +26 -0
- data/rust-vendor/libc/src/new/qurt/fcntl.rs +4 -1
- data/rust-vendor/libc/src/new/qurt/mod.rs +224 -14
- data/rust-vendor/libc/src/new/qurt/pthread.rs +1 -22
- data/rust-vendor/libc/src/new/qurt/signal.rs +54 -4
- data/rust-vendor/libc/src/new/qurt/stdio.rs +0 -5
- data/rust-vendor/libc/src/new/qurt/sys/mman.rs +55 -0
- data/rust-vendor/libc/src/new/qurt/sys/mod.rs +2 -0
- data/rust-vendor/libc/src/new/qurt/sys/sched.rs +24 -0
- data/rust-vendor/libc/src/new/qurt/sys/stat.rs +0 -6
- data/rust-vendor/libc/src/new/qurt/time.rs +4 -22
- data/rust-vendor/libc/src/new/qurt/unistd.rs +210 -20
- data/rust-vendor/libc/src/qurt/mod.rs +9 -325
- data/rust-vendor/libc/src/types.rs +2 -2
- data/rust-vendor/libc/src/unix/aix/mod.rs +11 -20
- data/rust-vendor/libc/src/unix/aix/powerpc64.rs +6 -6
- data/rust-vendor/libc/src/unix/bsd/apple/mod.rs +15 -0
- data/rust-vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs +4 -4
- data/rust-vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +3 -3
- data/rust-vendor/libc/src/unix/bsd/freebsdlike/mod.rs +14 -0
- data/rust-vendor/libc/src/unix/bsd/mod.rs +0 -14
- data/rust-vendor/libc/src/unix/bsd/netbsdlike/mod.rs +6 -0
- data/rust-vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs +15 -7
- data/rust-vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs +41 -1
- data/rust-vendor/libc/src/unix/cygwin/mod.rs +2 -2
- data/rust-vendor/libc/src/unix/haiku/mod.rs +1 -1
- data/rust-vendor/libc/src/unix/haiku/x86_64.rs +2 -2
- data/rust-vendor/libc/src/unix/hurd/mod.rs +6 -6
- data/rust-vendor/libc/src/unix/linux_like/android/mod.rs +2 -0
- data/rust-vendor/libc/src/unix/linux_like/linux/gnu/mod.rs +3 -0
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs +16 -13
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs +12 -13
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs +25 -16
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs +16 -13
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +12 -15
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs +10 -13
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +0 -15
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs +0 -15
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs +0 -15
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs +0 -15
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +0 -15
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs +0 -15
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs +0 -15
- data/rust-vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +9 -15
- data/rust-vendor/libc/src/unix/mod.rs +87 -11
- data/rust-vendor/libc/src/unix/newlib/arm/mod.rs +1 -1
- data/rust-vendor/libc/src/unix/newlib/horizon/mod.rs +1 -1
- data/rust-vendor/libc/src/unix/newlib/vita/mod.rs +3 -3
- data/rust-vendor/libc/src/unix/nto/mod.rs +23 -6
- data/rust-vendor/libc/src/unix/redox/mod.rs +45 -3
- data/rust-vendor/libc/src/unix/solarish/illumos.rs +2 -0
- data/rust-vendor/libc/src/vxworks/mod.rs +7 -7
- data/rust-vendor/memchr/.cargo-checksum.json +1 -1
- data/rust-vendor/memchr/.cargo_vcs_info.json +1 -1
- data/rust-vendor/memchr/Cargo.lock +13 -13
- data/rust-vendor/memchr/Cargo.toml +1 -1
- data/rust-vendor/memchr/Cargo.toml.orig +1 -1
- data/rust-vendor/memchr/src/cow.rs +3 -1
- data/rust-vendor/memchr/src/memmem/mod.rs +42 -3
- data/rust-vendor/prettyplease/.cargo-checksum.json +1 -0
- data/rust-vendor/prettyplease/.cargo_vcs_info.json +6 -0
- data/rust-vendor/prettyplease/.github/FUNDING.yml +1 -0
- data/rust-vendor/prettyplease/.github/workflows/ci.yml +123 -0
- data/rust-vendor/prettyplease/Cargo.lock +54 -0
- data/rust-vendor/prettyplease/Cargo.toml +90 -0
- data/rust-vendor/prettyplease/Cargo.toml.orig +43 -0
- data/rust-vendor/prettyplease/LICENSE-APACHE +176 -0
- data/rust-vendor/prettyplease/LICENSE-MIT +23 -0
- data/rust-vendor/prettyplease/README.md +312 -0
- data/rust-vendor/prettyplease/build.rs +21 -0
- data/rust-vendor/prettyplease/examples/.tokeignore +1 -0
- data/rust-vendor/prettyplease/examples/input.rs +1 -0
- data/rust-vendor/prettyplease/examples/output.prettyplease.rs +593 -0
- data/rust-vendor/prettyplease/examples/output.rustc.rs +506 -0
- data/rust-vendor/prettyplease/examples/output.rustfmt.rs +552 -0
- data/rust-vendor/prettyplease/src/algorithm.rs +386 -0
- data/rust-vendor/prettyplease/src/attr.rs +288 -0
- data/rust-vendor/prettyplease/src/classify.rs +324 -0
- data/rust-vendor/prettyplease/src/convenience.rs +98 -0
- data/rust-vendor/prettyplease/src/data.rs +79 -0
- data/rust-vendor/prettyplease/src/expr.rs +1533 -0
- data/rust-vendor/prettyplease/src/file.rs +17 -0
- data/rust-vendor/prettyplease/src/fixup.rs +676 -0
- data/rust-vendor/prettyplease/src/generics.rs +426 -0
- data/rust-vendor/prettyplease/src/item.rs +1813 -0
- data/rust-vendor/prettyplease/src/iter.rs +46 -0
- data/rust-vendor/prettyplease/src/lib.rs +385 -0
- data/rust-vendor/prettyplease/src/lifetime.rs +9 -0
- data/rust-vendor/prettyplease/src/lit.rs +57 -0
- data/rust-vendor/prettyplease/src/mac.rs +706 -0
- data/rust-vendor/prettyplease/src/pat.rs +254 -0
- data/rust-vendor/prettyplease/src/path.rs +194 -0
- data/rust-vendor/prettyplease/src/precedence.rs +148 -0
- data/rust-vendor/prettyplease/src/ring.rs +81 -0
- data/rust-vendor/prettyplease/src/stmt.rs +221 -0
- data/rust-vendor/prettyplease/src/token.rs +80 -0
- data/rust-vendor/prettyplease/src/ty.rs +326 -0
- data/rust-vendor/prettyplease/tests/test.rs +51 -0
- data/rust-vendor/prettyplease/tests/test_precedence.rs +900 -0
- data/rust-vendor/regex/.cargo-checksum.json +1 -1
- data/rust-vendor/regex/.cargo_vcs_info.json +1 -1
- data/rust-vendor/regex/CHANGELOG.md +13 -0
- data/rust-vendor/regex/Cargo.lock +5 -5
- data/rust-vendor/regex/Cargo.toml +15 -7
- data/rust-vendor/regex/Cargo.toml.orig +19 -2
- data/rust-vendor/regex-automata/.cargo-checksum.json +1 -1
- data/rust-vendor/regex-automata/.cargo_vcs_info.json +1 -1
- data/rust-vendor/regex-automata/Cargo.lock +3 -3
- data/rust-vendor/regex-automata/Cargo.toml +16 -1
- data/rust-vendor/regex-automata/Cargo.toml.orig +2 -1
- data/rust-vendor/regex-automata/src/dfa/onepass.rs +21 -5
- data/rust-vendor/regex-automata/tests/dfa/onepass/mod.rs +1 -0
- data/rust-vendor/regex-automata/tests/dfa/onepass/regression.rs +61 -0
- data/rust-vendor/regex-automata/tests/nfa/thompson/backtrack/mod.rs +1 -0
- data/rust-vendor/regex-automata/tests/nfa/thompson/backtrack/regression.rs +20 -0
- data/rust-vendor/regex-automata/tests/nfa/thompson/pikevm/mod.rs +1 -0
- data/rust-vendor/regex-automata/tests/nfa/thompson/pikevm/regression.rs +20 -0
- data/rust-vendor/regex-syntax/.cargo-checksum.json +1 -1
- data/rust-vendor/regex-syntax/.cargo_vcs_info.json +1 -1
- data/rust-vendor/regex-syntax/Cargo.lock +1 -1
- data/rust-vendor/regex-syntax/Cargo.toml +16 -5
- data/rust-vendor/regex-syntax/Cargo.toml.orig +2 -1
- data/rust-vendor/semver/.cargo-checksum.json +1 -0
- data/rust-vendor/semver/.cargo_vcs_info.json +6 -0
- data/rust-vendor/semver/.github/FUNDING.yml +1 -0
- data/rust-vendor/semver/.github/workflows/ci.yml +140 -0
- data/rust-vendor/semver/Cargo.lock +75 -0
- data/rust-vendor/semver/Cargo.toml +86 -0
- data/rust-vendor/semver/Cargo.toml.orig +36 -0
- data/rust-vendor/semver/LICENSE-APACHE +176 -0
- data/rust-vendor/semver/LICENSE-MIT +23 -0
- data/rust-vendor/semver/README.md +84 -0
- data/rust-vendor/semver/benches/parse.rs +24 -0
- data/rust-vendor/semver/src/display.rs +163 -0
- data/rust-vendor/semver/src/error.rs +126 -0
- data/rust-vendor/semver/src/eval.rs +179 -0
- data/rust-vendor/semver/src/identifier.rs +412 -0
- data/rust-vendor/semver/src/impls.rs +163 -0
- data/rust-vendor/semver/src/lib.rs +570 -0
- data/rust-vendor/semver/src/parse.rs +404 -0
- data/rust-vendor/semver/src/serde.rs +109 -0
- data/rust-vendor/semver/tests/node/mod.rs +43 -0
- data/rust-vendor/semver/tests/test_autotrait.rs +14 -0
- data/rust-vendor/semver/tests/test_identifier.rs +51 -0
- data/rust-vendor/semver/tests/test_version.rs +251 -0
- data/rust-vendor/semver/tests/test_version_req.rs +480 -0
- data/rust-vendor/semver/tests/util/mod.rs +54 -0
- data/rust-vendor/symbolic-common/.cargo-checksum.json +1 -1
- data/rust-vendor/symbolic-common/Cargo.lock +74 -3
- data/rust-vendor/symbolic-common/Cargo.toml +2 -2
- data/rust-vendor/symbolic-common/Cargo.toml.orig +1 -1
- data/rust-vendor/symbolic-demangle/.cargo-checksum.json +1 -1
- data/rust-vendor/symbolic-demangle/Cargo.lock +87 -9
- data/rust-vendor/symbolic-demangle/Cargo.toml +5 -5
- data/rust-vendor/symbolic-demangle/Cargo.toml.orig +2 -2
- data/rust-vendor/syn/.cargo-checksum.json +1 -1
- data/rust-vendor/syn/.cargo_vcs_info.json +1 -1
- data/rust-vendor/syn/Cargo.lock +322 -109
- data/rust-vendor/syn/Cargo.toml +2 -2
- data/rust-vendor/syn/Cargo.toml.orig +2 -2
- data/rust-vendor/syn/benches/rust.rs +1 -2
- data/rust-vendor/syn/src/lib.rs +1 -1
- data/rust-vendor/syn/src/parse.rs +2 -2
- data/rust-vendor/syn/src/path.rs +1 -5
- data/rust-vendor/syn/tests/common/eq.rs +28 -17
- data/rust-vendor/syn/tests/common/parse.rs +1 -2
- data/rust-vendor/syn/tests/repo/progress.rs +1 -1
- data/rust-vendor/syn/tests/test_round_trip.rs +5 -36
- data/rust-vendor/tempfile/.cargo-checksum.json +1 -1
- data/rust-vendor/tempfile/.cargo_vcs_info.json +1 -1
- data/rust-vendor/tempfile/CHANGELOG.md +4 -0
- data/rust-vendor/tempfile/Cargo.lock +333 -21
- data/rust-vendor/tempfile/Cargo.toml +2 -2
- data/rust-vendor/tempfile/Cargo.toml.orig +2 -2
- data/rust-vendor/unicode-ident/.cargo-checksum.json +1 -1
- data/rust-vendor/unicode-ident/.cargo_vcs_info.json +1 -1
- data/rust-vendor/unicode-ident/.github/workflows/ci.yml +10 -10
- data/rust-vendor/unicode-ident/Cargo.lock +468 -186
- data/rust-vendor/unicode-ident/Cargo.toml +8 -8
- data/rust-vendor/unicode-ident/Cargo.toml.orig +7 -5
- data/rust-vendor/unicode-ident/src/lib.rs +1 -1
- data/rust-vendor/unicode-xid/.cargo-checksum.json +1 -0
- data/rust-vendor/unicode-xid/.cargo_vcs_info.json +6 -0
- data/rust-vendor/unicode-xid/COPYRIGHT +7 -0
- data/rust-vendor/unicode-xid/Cargo.toml +65 -0
- data/rust-vendor/unicode-xid/Cargo.toml.orig +34 -0
- data/rust-vendor/unicode-xid/LICENSE-APACHE +201 -0
- data/rust-vendor/unicode-xid/LICENSE-MIT +25 -0
- data/rust-vendor/unicode-xid/README.md +61 -0
- data/rust-vendor/unicode-xid/benches/xid.rs +60 -0
- data/rust-vendor/unicode-xid/src/lib.rs +90 -0
- data/rust-vendor/unicode-xid/src/tables.rs +1537 -0
- data/rust-vendor/unicode-xid/src/tests.rs +95 -0
- data/rust-vendor/unicode-xid/tests/exhaustive_tests.rs +25 -0
- data/rust-vendor/uuid/.cargo-checksum.json +1 -1
- data/rust-vendor/uuid/.cargo_vcs_info.json +1 -1
- data/rust-vendor/uuid/Cargo.lock +298 -44
- data/rust-vendor/uuid/Cargo.toml +5 -5
- data/rust-vendor/uuid/Cargo.toml.orig +5 -5
- data/rust-vendor/uuid/README.md +3 -3
- data/rust-vendor/uuid/src/error.rs +1 -7
- data/rust-vendor/uuid/src/lib.rs +4 -4
- data/rust-vendor/wasip3/.cargo-checksum.json +1 -0
- data/rust-vendor/wasip3/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wasip3/Cargo.lock +483 -0
- data/rust-vendor/wasip3/Cargo.toml +96 -0
- data/rust-vendor/wasip3/Cargo.toml.orig +49 -0
- data/rust-vendor/wasip3/README.md +56 -0
- data/rust-vendor/wasip3/examples/cli-command.rs +19 -0
- data/rust-vendor/wasip3/examples/http-proxy-compat.rs +20 -0
- data/rust-vendor/wasip3/examples/http-proxy.rs +22 -0
- data/rust-vendor/wasip3/src/command.rs +513 -0
- data/rust-vendor/wasip3/src/http_compat/body_writer.rs +145 -0
- data/rust-vendor/wasip3/src/http_compat/conversions.rs +307 -0
- data/rust-vendor/wasip3/src/http_compat/mod.rs +314 -0
- data/rust-vendor/wasip3/src/imports.rs +10543 -0
- data/rust-vendor/wasip3/src/lib.rs +280 -0
- data/rust-vendor/wasip3/src/service.rs +7274 -0
- data/rust-vendor/wasip3/wit/deps/cli.wit +256 -0
- data/rust-vendor/wasip3/wit/deps/clocks.wit +161 -0
- data/rust-vendor/wasip3/wit/deps/filesystem.wit +553 -0
- data/rust-vendor/wasip3/wit/deps/http.wit +457 -0
- data/rust-vendor/wasip3/wit/deps/random.wit +92 -0
- data/rust-vendor/wasip3/wit/deps/sockets.wit +752 -0
- data/rust-vendor/wasip3/wit/wasi-crate.wit +1 -0
- data/rust-vendor/wasm-encoder/.cargo-checksum.json +1 -0
- data/rust-vendor/wasm-encoder/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wasm-encoder/Cargo.lock +348 -0
- data/rust-vendor/wasm-encoder/Cargo.toml +104 -0
- data/rust-vendor/wasm-encoder/Cargo.toml.orig +43 -0
- data/rust-vendor/wasm-encoder/README.md +81 -0
- data/rust-vendor/wasm-encoder/src/component/aliases.rs +161 -0
- data/rust-vendor/wasm-encoder/src/component/builder.rs +826 -0
- data/rust-vendor/wasm-encoder/src/component/canonicals.rs +584 -0
- data/rust-vendor/wasm-encoder/src/component/components.rs +30 -0
- data/rust-vendor/wasm-encoder/src/component/exports.rs +130 -0
- data/rust-vendor/wasm-encoder/src/component/imports.rs +170 -0
- data/rust-vendor/wasm-encoder/src/component/instances.rs +200 -0
- data/rust-vendor/wasm-encoder/src/component/modules.rs +30 -0
- data/rust-vendor/wasm-encoder/src/component/names.rs +162 -0
- data/rust-vendor/wasm-encoder/src/component/start.rs +53 -0
- data/rust-vendor/wasm-encoder/src/component/types.rs +816 -0
- data/rust-vendor/wasm-encoder/src/component.rs +169 -0
- data/rust-vendor/wasm-encoder/src/core/branch_hints.rs +127 -0
- data/rust-vendor/wasm-encoder/src/core/code.rs +2464 -0
- data/rust-vendor/wasm-encoder/src/core/custom.rs +74 -0
- data/rust-vendor/wasm-encoder/src/core/data.rs +187 -0
- data/rust-vendor/wasm-encoder/src/core/dump.rs +629 -0
- data/rust-vendor/wasm-encoder/src/core/elements.rs +225 -0
- data/rust-vendor/wasm-encoder/src/core/exports.rs +86 -0
- data/rust-vendor/wasm-encoder/src/core/functions.rs +64 -0
- data/rust-vendor/wasm-encoder/src/core/globals.rs +101 -0
- data/rust-vendor/wasm-encoder/src/core/imports.rs +230 -0
- data/rust-vendor/wasm-encoder/src/core/instructions.rs +4686 -0
- data/rust-vendor/wasm-encoder/src/core/linking.rs +264 -0
- data/rust-vendor/wasm-encoder/src/core/memories.rs +116 -0
- data/rust-vendor/wasm-encoder/src/core/names.rs +305 -0
- data/rust-vendor/wasm-encoder/src/core/producers.rs +181 -0
- data/rust-vendor/wasm-encoder/src/core/start.rs +40 -0
- data/rust-vendor/wasm-encoder/src/core/tables.rs +130 -0
- data/rust-vendor/wasm-encoder/src/core/tags.rs +86 -0
- data/rust-vendor/wasm-encoder/src/core/types.rs +753 -0
- data/rust-vendor/wasm-encoder/src/core.rs +179 -0
- data/rust-vendor/wasm-encoder/src/lib.rs +224 -0
- data/rust-vendor/wasm-encoder/src/raw.rs +32 -0
- data/rust-vendor/wasm-encoder/src/reencode/component.rs +1548 -0
- data/rust-vendor/wasm-encoder/src/reencode.rs +2134 -0
- data/rust-vendor/wasm-metadata/.cargo-checksum.json +1 -0
- data/rust-vendor/wasm-metadata/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wasm-metadata/Cargo.lock +769 -0
- data/rust-vendor/wasm-metadata/Cargo.toml +152 -0
- data/rust-vendor/wasm-metadata/Cargo.toml.orig +38 -0
- data/rust-vendor/wasm-metadata/README.md +27 -0
- data/rust-vendor/wasm-metadata/src/add_metadata.rs +91 -0
- data/rust-vendor/wasm-metadata/src/clap.rs +169 -0
- data/rust-vendor/wasm-metadata/src/dependencies.rs +142 -0
- data/rust-vendor/wasm-metadata/src/lib.rs +83 -0
- data/rust-vendor/wasm-metadata/src/metadata.rs +34 -0
- data/rust-vendor/wasm-metadata/src/names/component.rs +107 -0
- data/rust-vendor/wasm-metadata/src/names/mod.rs +5 -0
- data/rust-vendor/wasm-metadata/src/names/module.rs +101 -0
- data/rust-vendor/wasm-metadata/src/oci_annotations/authors.rs +111 -0
- data/rust-vendor/wasm-metadata/src/oci_annotations/description.rs +110 -0
- data/rust-vendor/wasm-metadata/src/oci_annotations/homepage.rs +118 -0
- data/rust-vendor/wasm-metadata/src/oci_annotations/licenses.rs +122 -0
- data/rust-vendor/wasm-metadata/src/oci_annotations/mod.rs +32 -0
- data/rust-vendor/wasm-metadata/src/oci_annotations/revision.rs +113 -0
- data/rust-vendor/wasm-metadata/src/oci_annotations/source.rs +117 -0
- data/rust-vendor/wasm-metadata/src/oci_annotations/version.rs +110 -0
- data/rust-vendor/wasm-metadata/src/payload.rs +215 -0
- data/rust-vendor/wasm-metadata/src/producers.rs +254 -0
- data/rust-vendor/wasm-metadata/src/rewrite.rs +224 -0
- data/rust-vendor/wasm-metadata/src/utils.rs +21 -0
- data/rust-vendor/wasm-metadata/tests/component.rs +310 -0
- data/rust-vendor/wasm-metadata/tests/module.rs +86 -0
- data/rust-vendor/wasmparser/.cargo-checksum.json +1 -0
- data/rust-vendor/wasmparser/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wasmparser/Cargo.lock +687 -0
- data/rust-vendor/wasmparser/Cargo.toml +161 -0
- data/rust-vendor/wasmparser/Cargo.toml.orig +89 -0
- data/rust-vendor/wasmparser/README.md +28 -0
- data/rust-vendor/wasmparser/benches/.gitignore +1 -0
- data/rust-vendor/wasmparser/benches/benchmark.rs +395 -0
- data/rust-vendor/wasmparser/examples/simple.rs +37 -0
- data/rust-vendor/wasmparser/src/arity.rs +318 -0
- data/rust-vendor/wasmparser/src/binary_reader.rs +2109 -0
- data/rust-vendor/wasmparser/src/collections/hash.rs +120 -0
- data/rust-vendor/wasmparser/src/collections/index_map/detail.rs +1100 -0
- data/rust-vendor/wasmparser/src/collections/index_map/tests.rs +183 -0
- data/rust-vendor/wasmparser/src/collections/index_map.rs +653 -0
- data/rust-vendor/wasmparser/src/collections/index_set.rs +316 -0
- data/rust-vendor/wasmparser/src/collections/map.rs +852 -0
- data/rust-vendor/wasmparser/src/collections/mod.rs +34 -0
- data/rust-vendor/wasmparser/src/collections/set.rs +672 -0
- data/rust-vendor/wasmparser/src/features.rs +442 -0
- data/rust-vendor/wasmparser/src/lib.rs +1340 -0
- data/rust-vendor/wasmparser/src/limits.rs +90 -0
- data/rust-vendor/wasmparser/src/parser.rs +1925 -0
- data/rust-vendor/wasmparser/src/readers/component/aliases.rs +119 -0
- data/rust-vendor/wasmparser/src/readers/component/canonicals.rs +458 -0
- data/rust-vendor/wasmparser/src/readers/component/exports.rs +135 -0
- data/rust-vendor/wasmparser/src/readers/component/imports.rs +145 -0
- data/rust-vendor/wasmparser/src/readers/component/instances.rs +166 -0
- data/rust-vendor/wasmparser/src/readers/component/names.rs +101 -0
- data/rust-vendor/wasmparser/src/readers/component/start.rs +31 -0
- data/rust-vendor/wasmparser/src/readers/component/types.rs +537 -0
- data/rust-vendor/wasmparser/src/readers/component.rs +17 -0
- data/rust-vendor/wasmparser/src/readers/core/branch_hinting.rs +59 -0
- data/rust-vendor/wasmparser/src/readers/core/code.rs +177 -0
- data/rust-vendor/wasmparser/src/readers/core/coredumps.rs +274 -0
- data/rust-vendor/wasmparser/src/readers/core/custom.rs +134 -0
- data/rust-vendor/wasmparser/src/readers/core/data.rs +94 -0
- data/rust-vendor/wasmparser/src/readers/core/dylink0.rs +117 -0
- data/rust-vendor/wasmparser/src/readers/core/elements.rs +153 -0
- data/rust-vendor/wasmparser/src/readers/core/exports.rs +75 -0
- data/rust-vendor/wasmparser/src/readers/core/functions.rs +17 -0
- data/rust-vendor/wasmparser/src/readers/core/globals.rs +51 -0
- data/rust-vendor/wasmparser/src/readers/core/imports.rs +307 -0
- data/rust-vendor/wasmparser/src/readers/core/init.rs +70 -0
- data/rust-vendor/wasmparser/src/readers/core/linking.rs +457 -0
- data/rust-vendor/wasmparser/src/readers/core/memories.rs +61 -0
- data/rust-vendor/wasmparser/src/readers/core/names.rs +162 -0
- data/rust-vendor/wasmparser/src/readers/core/operators.rs +1105 -0
- data/rust-vendor/wasmparser/src/readers/core/producers.rs +84 -0
- data/rust-vendor/wasmparser/src/readers/core/reloc.rs +300 -0
- data/rust-vendor/wasmparser/src/readers/core/tables.rs +96 -0
- data/rust-vendor/wasmparser/src/readers/core/tags.rs +32 -0
- data/rust-vendor/wasmparser/src/readers/core/types/matches.rs +321 -0
- data/rust-vendor/wasmparser/src/readers/core/types.rs +2249 -0
- data/rust-vendor/wasmparser/src/readers/core.rs +43 -0
- data/rust-vendor/wasmparser/src/readers.rs +330 -0
- data/rust-vendor/wasmparser/src/resources.rs +265 -0
- data/rust-vendor/wasmparser/src/validator/component.rs +4765 -0
- data/rust-vendor/wasmparser/src/validator/component_types.rs +4036 -0
- data/rust-vendor/wasmparser/src/validator/core/canonical.rs +552 -0
- data/rust-vendor/wasmparser/src/validator/core.rs +1313 -0
- data/rust-vendor/wasmparser/src/validator/func.rs +613 -0
- data/rust-vendor/wasmparser/src/validator/names.rs +1017 -0
- data/rust-vendor/wasmparser/src/validator/operators/simd.rs +971 -0
- data/rust-vendor/wasmparser/src/validator/operators.rs +4696 -0
- data/rust-vendor/wasmparser/src/validator/types.rs +1327 -0
- data/rust-vendor/wasmparser/src/validator.rs +1645 -0
- data/rust-vendor/wasmparser/tests/big-module.rs +62 -0
- data/rust-vendor/wit-bindgen/.cargo-checksum.json +1 -1
- data/rust-vendor/wit-bindgen/.cargo_vcs_info.json +1 -1
- data/rust-vendor/wit-bindgen/Cargo.lock +76 -66
- data/rust-vendor/wit-bindgen/Cargo.toml +25 -11
- data/rust-vendor/wit-bindgen/Cargo.toml.orig +11 -3
- data/rust-vendor/wit-bindgen/src/lib.rs +21 -15
- data/rust-vendor/wit-bindgen/src/rt/async_support/abi_buffer.rs +35 -32
- data/rust-vendor/wit-bindgen/src/rt/async_support/cabi.rs +15 -20
- data/rust-vendor/wit-bindgen/src/rt/async_support/error_context.rs +11 -22
- data/rust-vendor/wit-bindgen/src/rt/async_support/future_support.rs +406 -146
- data/rust-vendor/wit-bindgen/src/rt/async_support/inter_task_wakeup.rs +98 -0
- data/rust-vendor/wit-bindgen/src/rt/async_support/inter_task_wakeup_disabled.rs +45 -0
- data/rust-vendor/wit-bindgen/src/rt/async_support/spawn.rs +82 -0
- data/rust-vendor/wit-bindgen/src/rt/async_support/spawn_disabled.rs +30 -0
- data/rust-vendor/wit-bindgen/src/rt/async_support/stream_support.rs +262 -122
- data/rust-vendor/wit-bindgen/src/rt/async_support/subtask.rs +49 -54
- data/rust-vendor/wit-bindgen/src/rt/async_support/unit_stream.rs +81 -0
- data/rust-vendor/wit-bindgen/src/rt/async_support/waitable.rs +47 -31
- data/rust-vendor/wit-bindgen/src/rt/async_support/waitable_set.rs +17 -35
- data/rust-vendor/wit-bindgen/src/rt/async_support.rs +262 -188
- data/rust-vendor/wit-bindgen/src/rt/mod.rs +14 -12
- data/rust-vendor/wit-bindgen/src/rt/wit_bindgen_cabi_realloc.c +2 -2
- data/rust-vendor/wit-bindgen/src/rt/wit_bindgen_cabi_realloc.o +0 -0
- data/rust-vendor/wit-bindgen/src/rt/wit_bindgen_cabi_realloc.rs +2 -2
- data/rust-vendor/wit-bindgen/src/rt/wit_bindgen_cabi_wasip3.o +0 -0
- data/rust-vendor/wit-bindgen-0.46.0/.cargo-checksum.json +1 -0
- data/rust-vendor/wit-bindgen-0.46.0/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wit-bindgen-0.46.0/Cargo.lock +428 -0
- data/rust-vendor/wit-bindgen-0.46.0/Cargo.toml +88 -0
- data/rust-vendor/wit-bindgen-0.46.0/Cargo.toml.orig +37 -0
- data/rust-vendor/wit-bindgen-0.46.0/LICENSE-APACHE +201 -0
- data/rust-vendor/wit-bindgen-0.46.0/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
- data/rust-vendor/wit-bindgen-0.46.0/LICENSE-MIT +23 -0
- data/rust-vendor/wit-bindgen-0.46.0/README.md +45 -0
- data/rust-vendor/wit-bindgen-0.46.0/build.rs +32 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/examples/_0_world_imports.rs +17 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/examples/_1_interface_imports.rs +32 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/examples/_2_imported_resources.rs +22 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/examples/_3_world_exports.rs +47 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/examples/_4_exported_resources.rs +26 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/examples.rs +55 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/lib.rs +881 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/abi_buffer.rs +417 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/cabi.rs +112 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/error_context.rs +94 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/future_support.rs +734 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/stream_support.rs +604 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/subtask.rs +289 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/waitable.rs +466 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support/waitable_set.rs +100 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/async_support.rs +634 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/mod.rs +230 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_realloc.c +10 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_realloc.o +0 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_realloc.rs +11 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_wasip3.c +12 -0
- data/rust-vendor/wit-bindgen-0.46.0/src/rt/wit_bindgen_cabi_wasip3.o +0 -0
- data/rust-vendor/wit-bindgen-0.46.0/wasi-cli@0.2.0.wasm +0 -0
- data/rust-vendor/wit-bindgen-core/.cargo-checksum.json +1 -0
- data/rust-vendor/wit-bindgen-core/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wit-bindgen-core/Cargo.lock +340 -0
- data/rust-vendor/wit-bindgen-core/Cargo.toml +75 -0
- data/rust-vendor/wit-bindgen-core/Cargo.toml.orig +30 -0
- data/rust-vendor/wit-bindgen-core/LICENSE-APACHE +201 -0
- data/rust-vendor/wit-bindgen-core/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
- data/rust-vendor/wit-bindgen-core/LICENSE-MIT +23 -0
- data/rust-vendor/wit-bindgen-core/src/abi.rs +2526 -0
- data/rust-vendor/wit-bindgen-core/src/async_.rs +200 -0
- data/rust-vendor/wit-bindgen-core/src/lib.rs +239 -0
- data/rust-vendor/wit-bindgen-core/src/ns.rs +27 -0
- data/rust-vendor/wit-bindgen-core/src/path.rs +47 -0
- data/rust-vendor/wit-bindgen-core/src/source.rs +222 -0
- data/rust-vendor/wit-bindgen-core/src/types.rs +232 -0
- data/rust-vendor/wit-bindgen-rust/.cargo-checksum.json +1 -0
- data/rust-vendor/wit-bindgen-rust/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wit-bindgen-rust/Cargo.lock +547 -0
- data/rust-vendor/wit-bindgen-rust/Cargo.toml +112 -0
- data/rust-vendor/wit-bindgen-rust/Cargo.toml.orig +44 -0
- data/rust-vendor/wit-bindgen-rust/LICENSE-APACHE +201 -0
- data/rust-vendor/wit-bindgen-rust/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
- data/rust-vendor/wit-bindgen-rust/LICENSE-MIT +23 -0
- data/rust-vendor/wit-bindgen-rust/build.rs +4 -0
- data/rust-vendor/wit-bindgen-rust/src/bindgen.rs +1215 -0
- data/rust-vendor/wit-bindgen-rust/src/interface.rs +3020 -0
- data/rust-vendor/wit-bindgen-rust/src/lib.rs +1880 -0
- data/rust-vendor/wit-bindgen-rust/tests/codegen.rs +174 -0
- data/rust-vendor/wit-bindgen-rust/tests/wit/path1/world.wit +3 -0
- data/rust-vendor/wit-bindgen-rust/tests/wit/path2/world.wit +3 -0
- data/rust-vendor/wit-bindgen-rust/tests/wit/path3/package.wit +3 -0
- data/rust-vendor/wit-bindgen-rust-macro/.cargo-checksum.json +1 -0
- data/rust-vendor/wit-bindgen-rust-macro/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wit-bindgen-rust-macro/Cargo.lock +306 -0
- data/rust-vendor/wit-bindgen-rust-macro/Cargo.toml +62 -0
- data/rust-vendor/wit-bindgen-rust-macro/Cargo.toml.orig +28 -0
- data/rust-vendor/wit-bindgen-rust-macro/LICENSE-APACHE +201 -0
- data/rust-vendor/wit-bindgen-rust-macro/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
- data/rust-vendor/wit-bindgen-rust-macro/LICENSE-MIT +23 -0
- data/rust-vendor/wit-bindgen-rust-macro/build.rs +5 -0
- data/rust-vendor/wit-bindgen-rust-macro/src/lib.rs +606 -0
- data/rust-vendor/wit-component/.cargo-checksum.json +1 -0
- data/rust-vendor/wit-component/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wit-component/Cargo.lock +1823 -0
- data/rust-vendor/wit-component/Cargo.toml +217 -0
- data/rust-vendor/wit-component/Cargo.toml.orig +61 -0
- data/rust-vendor/wit-component/README.md +251 -0
- data/rust-vendor/wit-component/src/dummy.rs +395 -0
- data/rust-vendor/wit-component/src/encoding/dedupe.rs +164 -0
- data/rust-vendor/wit-component/src/encoding/types.rs +510 -0
- data/rust-vendor/wit-component/src/encoding/wit.rs +393 -0
- data/rust-vendor/wit-component/src/encoding/world.rs +525 -0
- data/rust-vendor/wit-component/src/encoding.rs +3231 -0
- data/rust-vendor/wit-component/src/gc.rs +1134 -0
- data/rust-vendor/wit-component/src/lib.rs +178 -0
- data/rust-vendor/wit-component/src/linking/metadata.rs +515 -0
- data/rust-vendor/wit-component/src/linking.rs +1727 -0
- data/rust-vendor/wit-component/src/metadata.rs +447 -0
- data/rust-vendor/wit-component/src/printing.rs +1485 -0
- data/rust-vendor/wit-component/src/semver_check.rs +113 -0
- data/rust-vendor/wit-component/src/targets.rs +44 -0
- data/rust-vendor/wit-component/src/validation.rs +2679 -0
- data/rust-vendor/wit-component/tests/.gitignore +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-empty-interface/adapt-old.wat +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-empty-interface/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-empty-interface/component.wat +60 -0
- data/rust-vendor/wit-component/tests/components/adapt-empty-interface/component.wit.print +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-empty-interface/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-empty-interface/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-default/adapt-old.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-default/adapt-old.wit +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-default/component.wat +32 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-default/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-default/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-default/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/adapt-old.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/adapt-old.wit +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/component.wat +42 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-namespaced/module.wit +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/adapt-old.wat +47 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/adapt-old.wit +6 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/component.wat +131 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/module.wat +8 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-reallocs/module.wit +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-save-args/adapt-old.wat +13 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-save-args/adapt-old.wit +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-save-args/component.wat +86 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-save-args/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-save-args/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-save-args/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/adapt-old.wat +33 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/adapt-old.wit +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/component.wat +101 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/module.wat +9 -0
- data/rust-vendor/wit-component/tests/components/adapt-export-with-post-return/module.wit +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/adapt-unused.wat +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/adapt-unused.wit +9 -0
- data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/component.wat +115 -0
- data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/module.wat +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-import-only-used-in-adapter/module.wit +6 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack/adapt-old.wat +54 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack/component.wat +163 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/adapt-old.wat +76 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/component.wat +174 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/module.wat +12 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/adapt-old.wat +76 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/component.wat +199 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/module.wat +38 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc/module.wit +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/adapt-old.wat +68 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/component.wat +216 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/module.wat +38 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/module.wit +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/adapt-old.wat +62 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/component.wat +187 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/module.wat +38 -0
- data/rust-vendor/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-list-return/adapt-old.wat +14 -0
- data/rust-vendor/wit-component/tests/components/adapt-list-return/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-list-return/component.wat +104 -0
- data/rust-vendor/wit-component/tests/components/adapt-list-return/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-list-return/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-list-return/module.wit +3 -0
- data/rust-vendor/wit-component/tests/components/adapt-memory-simple/adapt-old.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-memory-simple/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-memory-simple/component.wat +92 -0
- data/rust-vendor/wit-component/tests/components/adapt-memory-simple/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-memory-simple/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-memory-simple/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-multiple/adapt-foo.wat +10 -0
- data/rust-vendor/wit-component/tests/components/adapt-multiple/adapt-foo.wit +8 -0
- data/rust-vendor/wit-component/tests/components/adapt-multiple/component.wat +107 -0
- data/rust-vendor/wit-component/tests/components/adapt-multiple/component.wit.print +10 -0
- data/rust-vendor/wit-component/tests/components/adapt-multiple/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-multiple/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/adapt-preview1/adapt-wasi-snapshot-preview1.wat +13 -0
- data/rust-vendor/wit-component/tests/components/adapt-preview1/adapt-wasi-snapshot-preview1.wit +12 -0
- data/rust-vendor/wit-component/tests/components/adapt-preview1/component.wat +119 -0
- data/rust-vendor/wit-component/tests/components/adapt-preview1/component.wit.print +8 -0
- data/rust-vendor/wit-component/tests/components/adapt-preview1/module.wat +11 -0
- data/rust-vendor/wit-component/tests/components/adapt-preview1/module.wit +7 -0
- data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/adapt-wasip2.wat +8 -0
- data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/adapt-wasip2.wit +1 -0
- data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/component.wat +74 -0
- data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/component.wit.print +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/deps/cli/environment.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/module.wat +11 -0
- data/rust-vendor/wit-component/tests/components/adapt-stub-wasip2/module.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-unused/adapt-old.wat +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-unused/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/adapt-unused/component.wat +12 -0
- data/rust-vendor/wit-component/tests/components/adapt-unused/component.wit.print +4 -0
- data/rust-vendor/wit-component/tests/components/adapt-unused/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/adapt-unused/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/async-builtins/component.wat +259 -0
- data/rust-vendor/wit-component/tests/components/async-builtins/component.wit.print +6 -0
- data/rust-vendor/wit-component/tests/components/async-builtins/module.wat +28 -0
- data/rust-vendor/wit-component/tests/components/async-builtins/module.wit +10 -0
- data/rust-vendor/wit-component/tests/components/async-export/component.wat +91 -0
- data/rust-vendor/wit-component/tests/components/async-export/component.wit.print +6 -0
- data/rust-vendor/wit-component/tests/components/async-export/module.wat +8 -0
- data/rust-vendor/wit-component/tests/components/async-export/module.wit +30 -0
- data/rust-vendor/wit-component/tests/components/async-export-with-callback/component.wat +59 -0
- data/rust-vendor/wit-component/tests/components/async-export-with-callback/component.wit.print +6 -0
- data/rust-vendor/wit-component/tests/components/async-export-with-callback/module.wat +8 -0
- data/rust-vendor/wit-component/tests/components/async-export-with-callback/module.wit +10 -0
- data/rust-vendor/wit-component/tests/components/async-import/component.wat +125 -0
- data/rust-vendor/wit-component/tests/components/async-import/component.wit.print +6 -0
- data/rust-vendor/wit-component/tests/components/async-import/module.wat +8 -0
- data/rust-vendor/wit-component/tests/components/async-import/module.wit +10 -0
- data/rust-vendor/wit-component/tests/components/async-import-only-intrinsic/component.wat +34 -0
- data/rust-vendor/wit-component/tests/components/async-import-only-intrinsic/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/async-import-only-intrinsic/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/async-import-only-intrinsic/module.wit +17 -0
- data/rust-vendor/wit-component/tests/components/async-import-tricky/component.wat +39 -0
- data/rust-vendor/wit-component/tests/components/async-import-tricky/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/async-import-tricky/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/async-import-tricky/module.wit +17 -0
- data/rust-vendor/wit-component/tests/components/async-streams-and-futures/component.wat +649 -0
- data/rust-vendor/wit-component/tests/components/async-streams-and-futures/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/async-streams-and-futures/module.wat +92 -0
- data/rust-vendor/wit-component/tests/components/async-streams-and-futures/module.wit +12 -0
- data/rust-vendor/wit-component/tests/components/async-unit-builtins/component.wat +138 -0
- data/rust-vendor/wit-component/tests/components/async-unit-builtins/component.wit.print +4 -0
- data/rust-vendor/wit-component/tests/components/async-unit-builtins/module.wat +18 -0
- data/rust-vendor/wit-component/tests/components/async-unit-builtins/module.wit +4 -0
- data/rust-vendor/wit-component/tests/components/bare-funcs/component.wat +93 -0
- data/rust-vendor/wit-component/tests/components/bare-funcs/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/bare-funcs/module.wat +13 -0
- data/rust-vendor/wit-component/tests/components/bare-funcs/module.wit +7 -0
- data/rust-vendor/wit-component/tests/components/cm32-names/component.wat +366 -0
- data/rust-vendor/wit-component/tests/components/cm32-names/component.wit.print +25 -0
- data/rust-vendor/wit-component/tests/components/cm32-names/module.wat +32 -0
- data/rust-vendor/wit-component/tests/components/cm32-names/module.wit +30 -0
- data/rust-vendor/wit-component/tests/components/custom-page-sizes/component.wat +23 -0
- data/rust-vendor/wit-component/tests/components/custom-page-sizes/component.wit.print +4 -0
- data/rust-vendor/wit-component/tests/components/custom-page-sizes/module.wat +12 -0
- data/rust-vendor/wit-component/tests/components/custom-page-sizes/module.wit +3 -0
- data/rust-vendor/wit-component/tests/components/deduplicate-imports/adapt-wasi-snapshot-preview1.wat +10 -0
- data/rust-vendor/wit-component/tests/components/deduplicate-imports/adapt-wasi-snapshot-preview1.wit +10 -0
- data/rust-vendor/wit-component/tests/components/deduplicate-imports/component.wat +132 -0
- data/rust-vendor/wit-component/tests/components/deduplicate-imports/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/deduplicate-imports/module.wat +40 -0
- data/rust-vendor/wit-component/tests/components/deduplicate-imports/module.wit +9 -0
- data/rust-vendor/wit-component/tests/components/empty/component.wat +12 -0
- data/rust-vendor/wit-component/tests/components/empty/component.wit.print +4 -0
- data/rust-vendor/wit-component/tests/components/empty/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/empty/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/ensure-default-type-exports/component.wat +50 -0
- data/rust-vendor/wit-component/tests/components/ensure-default-type-exports/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/ensure-default-type-exports/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/ensure-default-type-exports/module.wit +17 -0
- data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/adapt-old.wat +4 -0
- data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-adapt-missing-memory/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/error-async-export-missing-callback/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-async-export-missing-callback/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/error-async-export-missing-callback/module.wit +10 -0
- data/rust-vendor/wit-component/tests/components/error-default-export-sig-mismatch/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-default-export-sig-mismatch/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-default-export-sig-mismatch/module.wit +5 -0
- data/rust-vendor/wit-component/tests/components/error-empty-module-import/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-empty-module-import/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-empty-module-import/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/error-export-sig-mismatch/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-export-sig-mismatch/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-export-sig-mismatch/module.wit +7 -0
- data/rust-vendor/wit-component/tests/components/error-import-resource-rep/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-import-resource-rep/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-import-resource-rep/module.wit +5 -0
- data/rust-vendor/wit-component/tests/components/error-import-resource-wrong-signature/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-import-resource-wrong-signature/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-import-resource-wrong-signature/module.wit +5 -0
- data/rust-vendor/wit-component/tests/components/error-import-sig-mismatch/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-import-sig-mismatch/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-import-sig-mismatch/module.wit +7 -0
- data/rust-vendor/wit-component/tests/components/error-invalid-module-import/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-invalid-module-import/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-invalid-module-import/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/lib-bar.wat +12 -0
- data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/lib-bar.wit +3 -0
- data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/lib-foo.wat +21 -0
- data/rust-vendor/wit-component/tests/components/error-link-duplicate-initializers/lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/error-link-missing-needed/error.txt +2 -0
- data/rust-vendor/wit-component/tests/components/error-link-missing-needed/lib-foo.wat +15 -0
- data/rust-vendor/wit-component/tests/components/error-link-missing-needed/lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/error-link-missing-symbols/error.txt +3 -0
- data/rust-vendor/wit-component/tests/components/error-link-missing-symbols/lib-foo.wat +13 -0
- data/rust-vendor/wit-component/tests/components/error-link-missing-symbols/lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/error-missing-default-export/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-missing-default-export/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/error-missing-default-export/module.wit +4 -0
- data/rust-vendor/wit-component/tests/components/error-missing-export/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-missing-export/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/error-missing-export/module.wit +7 -0
- data/rust-vendor/wit-component/tests/components/error-missing-import/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-missing-import/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-missing-import/module.wit +2 -0
- data/rust-vendor/wit-component/tests/components/error-missing-import-func/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-missing-import-func/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/error-missing-import-func/module.wit +9 -0
- data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/adapt-old.wat +4 -0
- data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/adapt-old.wit +5 -0
- data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/error.txt +1 -0
- data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/error-missing-module-metadata/module.wit +4 -0
- data/rust-vendor/wit-component/tests/components/export-interface-using-import/component.wat +37 -0
- data/rust-vendor/wit-component/tests/components/export-interface-using-import/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/export-interface-using-import/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/export-interface-using-import/module.wit +17 -0
- data/rust-vendor/wit-component/tests/components/export-name-shuffling/component.wat +43 -0
- data/rust-vendor/wit-component/tests/components/export-name-shuffling/component.wit.print +10 -0
- data/rust-vendor/wit-component/tests/components/export-name-shuffling/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/export-name-shuffling/module.wit +17 -0
- data/rust-vendor/wit-component/tests/components/export-resource/component.wat +102 -0
- data/rust-vendor/wit-component/tests/components/export-resource/component.wit.print +10 -0
- data/rust-vendor/wit-component/tests/components/export-resource/module.wat +15 -0
- data/rust-vendor/wit-component/tests/components/export-resource/module.wit +11 -0
- data/rust-vendor/wit-component/tests/components/export-type-name-conflict/component.wat +46 -0
- data/rust-vendor/wit-component/tests/components/export-type-name-conflict/component.wit.print +11 -0
- data/rust-vendor/wit-component/tests/components/export-type-name-conflict/module.wat +5 -0
- data/rust-vendor/wit-component/tests/components/export-type-name-conflict/module.wit +15 -0
- data/rust-vendor/wit-component/tests/components/export-with-type-alias/component.wat +40 -0
- data/rust-vendor/wit-component/tests/components/export-with-type-alias/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/export-with-type-alias/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/export-with-type-alias/module.wit +11 -0
- data/rust-vendor/wit-component/tests/components/exports/component.wat +139 -0
- data/rust-vendor/wit-component/tests/components/exports/component.wit.print +29 -0
- data/rust-vendor/wit-component/tests/components/exports/module.wat +14 -0
- data/rust-vendor/wit-component/tests/components/exports/module.wit +29 -0
- data/rust-vendor/wit-component/tests/components/fallible-constructor/component.wat +73 -0
- data/rust-vendor/wit-component/tests/components/fallible-constructor/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/fallible-constructor/module.wat +5 -0
- data/rust-vendor/wit-component/tests/components/fallible-constructor/module.wit +9 -0
- data/rust-vendor/wit-component/tests/components/import-and-export-resource/component.wat +53 -0
- data/rust-vendor/wit-component/tests/components/import-and-export-resource/component.wit.print +8 -0
- data/rust-vendor/wit-component/tests/components/import-and-export-resource/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/import-and-export-resource/module.wit +12 -0
- data/rust-vendor/wit-component/tests/components/import-conflict/component.wat +118 -0
- data/rust-vendor/wit-component/tests/components/import-conflict/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/import-conflict/module.wat +7 -0
- data/rust-vendor/wit-component/tests/components/import-conflict/module.wit +19 -0
- data/rust-vendor/wit-component/tests/components/import-empty-interface/component.wat +12 -0
- data/rust-vendor/wit-component/tests/components/import-empty-interface/component.wit.print +4 -0
- data/rust-vendor/wit-component/tests/components/import-empty-interface/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/import-empty-interface/module.wit +5 -0
- data/rust-vendor/wit-component/tests/components/import-export/component.wat +124 -0
- data/rust-vendor/wit-component/tests/components/import-export/component.wit.print +14 -0
- data/rust-vendor/wit-component/tests/components/import-export/module.wat +10 -0
- data/rust-vendor/wit-component/tests/components/import-export/module.wit +14 -0
- data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/component.wat +59 -0
- data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/component.wit.print +8 -0
- data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/deps/dep/foo.wit +5 -0
- data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/module.wat +5 -0
- data/rust-vendor/wit-component/tests/components/import-export-same-iface-name/module.wit +11 -0
- data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/adapt-old.wat +23 -0
- data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/adapt-old.wit +9 -0
- data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/component.wat +220 -0
- data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/component.wit.print +16 -0
- data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/deps/shared-dependency/doc.wit +13 -0
- data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/deps/shared-dependency/types.wit +3 -0
- data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/module.wat +15 -0
- data/rust-vendor/wit-component/tests/components/import-in-adapter-and-main-module/module.wit +11 -0
- data/rust-vendor/wit-component/tests/components/import-only-resource-static-function/component.wat +30 -0
- data/rust-vendor/wit-component/tests/components/import-only-resource-static-function/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/import-only-resource-static-function/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/import-only-resource-static-function/module.wit +11 -0
- data/rust-vendor/wit-component/tests/components/import-partial-export-full/component.wat +34 -0
- data/rust-vendor/wit-component/tests/components/import-partial-export-full/component.wit.print +8 -0
- data/rust-vendor/wit-component/tests/components/import-partial-export-full/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/import-partial-export-full/module.wit +19 -0
- data/rust-vendor/wit-component/tests/components/import-resource-in-interface/component.wat +41 -0
- data/rust-vendor/wit-component/tests/components/import-resource-in-interface/component.wit.print +10 -0
- data/rust-vendor/wit-component/tests/components/import-resource-in-interface/module.wat +5 -0
- data/rust-vendor/wit-component/tests/components/import-resource-in-interface/module.wit +11 -0
- data/rust-vendor/wit-component/tests/components/import-resource-simple/component.wat +33 -0
- data/rust-vendor/wit-component/tests/components/import-resource-simple/component.wit.print +8 -0
- data/rust-vendor/wit-component/tests/components/import-resource-simple/module.wat +5 -0
- data/rust-vendor/wit-component/tests/components/import-resource-simple/module.wit +9 -0
- data/rust-vendor/wit-component/tests/components/imports/component.wat +149 -0
- data/rust-vendor/wit-component/tests/components/imports/component.wit.print +29 -0
- data/rust-vendor/wit-component/tests/components/imports/module.wat +12 -0
- data/rust-vendor/wit-component/tests/components/imports/module.wit +33 -0
- data/rust-vendor/wit-component/tests/components/initialize/component.wat +38 -0
- data/rust-vendor/wit-component/tests/components/initialize/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/initialize/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/initialize/module.wit +5 -0
- data/rust-vendor/wit-component/tests/components/lift-options/component.wat +286 -0
- data/rust-vendor/wit-component/tests/components/lift-options/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/lift-options/module.wat +24 -0
- data/rust-vendor/wit-component/tests/components/lift-options/module.wit +40 -0
- data/rust-vendor/wit-component/tests/components/link/component.wat +271 -0
- data/rust-vendor/wit-component/tests/components/link/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link/lib-bar.wat +29 -0
- data/rust-vendor/wit-component/tests/components/link/lib-bar.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link/lib-c.wat +27 -0
- data/rust-vendor/wit-component/tests/components/link/lib-c.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link/lib-foo.wat +55 -0
- data/rust-vendor/wit-component/tests/components/link/lib-foo.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link/lib-unused.wat +55 -0
- data/rust-vendor/wit-component/tests/components/link/lib-unused.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-asyncify/component.wat +267 -0
- data/rust-vendor/wit-component/tests/components/link-asyncify/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/link-asyncify/lib-bar.wat +81 -0
- data/rust-vendor/wit-component/tests/components/link-asyncify/lib-bar.wit +9 -0
- data/rust-vendor/wit-component/tests/components/link-asyncify/lib-foo.wat +78 -0
- data/rust-vendor/wit-component/tests/components/link-asyncify/lib-foo.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-bare-funcs/component.wat +212 -0
- data/rust-vendor/wit-component/tests/components/link-bare-funcs/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/link-bare-funcs/lib-c.wat +27 -0
- data/rust-vendor/wit-component/tests/components/link-bare-funcs/lib-c.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-bare-funcs/lib-foo.wat +18 -0
- data/rust-vendor/wit-component/tests/components/link-bare-funcs/lib-foo.wit +7 -0
- data/rust-vendor/wit-component/tests/components/link-circular/component.wat +133 -0
- data/rust-vendor/wit-component/tests/components/link-circular/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-circular/lib-bar.wat +12 -0
- data/rust-vendor/wit-component/tests/components/link-circular/lib-bar.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-circular/lib-foo.wat +15 -0
- data/rust-vendor/wit-component/tests/components/link-circular/lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable/component.wat +108 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable/dlopen-lib-foo.wat +15 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable/dlopen-lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/component.wat +657 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/dlopen-lib-foo.wat +17 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/dlopen-lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/lib-c.wat +30 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/lib-c.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/stub-missing-functions +0 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl/use-built-in-libdl +0 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/component.wat +654 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/dlopen-lib-foo.wat +19 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/dlopen-lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/lib-c.wat +39 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/lib-c.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/lib-unused.wat +55 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/lib-unused.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-dl-openable-builtin-libdl-with-unused/use-built-in-libdl +0 -0
- data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/component.wat +135 -0
- data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/lib-bar.wat +13 -0
- data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/lib-bar.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/lib-foo.wat +15 -0
- data/rust-vendor/wit-component/tests/components/link-duplicate-symbols/lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-got-func/component.wat +125 -0
- data/rust-vendor/wit-component/tests/components/link-got-func/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-got-func/lib-bar.wat +10 -0
- data/rust-vendor/wit-component/tests/components/link-got-func/lib-bar.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-got-func/lib-foo.wat +10 -0
- data/rust-vendor/wit-component/tests/components/link-got-func/lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-initialize/component.wat +271 -0
- data/rust-vendor/wit-component/tests/components/link-initialize/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-initialize/lib-bar.wat +29 -0
- data/rust-vendor/wit-component/tests/components/link-initialize/lib-bar.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-initialize/lib-c.wat +27 -0
- data/rust-vendor/wit-component/tests/components/link-initialize/lib-c.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-initialize/lib-foo.wat +55 -0
- data/rust-vendor/wit-component/tests/components/link-initialize/lib-foo.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/component.wat +148 -0
- data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/component.wit.print +19 -0
- data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/lib-c.wat +4 -0
- data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/lib-c.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/lib-foo.wat +12 -0
- data/rust-vendor/wit-component/tests/components/link-lib-with-async-export/lib-foo.wit +16 -0
- data/rust-vendor/wit-component/tests/components/link-resources/component.wat +150 -0
- data/rust-vendor/wit-component/tests/components/link-resources/component.wit.print +6 -0
- data/rust-vendor/wit-component/tests/components/link-resources/lib-bar.wat +15 -0
- data/rust-vendor/wit-component/tests/components/link-resources/lib-bar.wit +13 -0
- data/rust-vendor/wit-component/tests/components/link-resources/lib-foo.wat +17 -0
- data/rust-vendor/wit-component/tests/components/link-resources/lib-foo.wit +13 -0
- data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/component.wat +146 -0
- data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/lib-bar.wat +19 -0
- data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/lib-bar.wit +9 -0
- data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/lib-foo.wat +17 -0
- data/rust-vendor/wit-component/tests/components/link-stack-high-and-low/lib-foo.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/adapt-wasip2.wat +8 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/adapt-wasip2.wit +1 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/component.wat +330 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/deps/cli/environment.wit +5 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-bar.wat +29 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-bar.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-c.wat +29 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-c.wit +5 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-foo.wat +55 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-foo.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-unused.wat +55 -0
- data/rust-vendor/wit-component/tests/components/link-stub-wasip2/lib-unused.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-stubs/component.wat +118 -0
- data/rust-vendor/wit-component/tests/components/link-stubs/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-stubs/lib-foo.wat +13 -0
- data/rust-vendor/wit-component/tests/components/link-stubs/lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/link-stubs/stub-missing-functions +0 -0
- data/rust-vendor/wit-component/tests/components/link-tag/component.wat +123 -0
- data/rust-vendor/wit-component/tests/components/link-tag/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/link-tag/lib-bar.wat +6 -0
- data/rust-vendor/wit-component/tests/components/link-tag/lib-bar.wit +3 -0
- data/rust-vendor/wit-component/tests/components/link-tag/lib-foo.wat +7 -0
- data/rust-vendor/wit-component/tests/components/link-tag/lib-foo.wit +5 -0
- data/rust-vendor/wit-component/tests/components/link-weak-cabi-realloc/component.wat +99 -0
- data/rust-vendor/wit-component/tests/components/link-weak-cabi-realloc/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/link-weak-cabi-realloc/lib-foo.wat +14 -0
- data/rust-vendor/wit-component/tests/components/link-weak-cabi-realloc/lib-foo.wit +9 -0
- data/rust-vendor/wit-component/tests/components/link-weak-import/component.wat +120 -0
- data/rust-vendor/wit-component/tests/components/link-weak-import/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/link-weak-import/lib-foo.wat +15 -0
- data/rust-vendor/wit-component/tests/components/link-weak-import/lib-foo.wit +10 -0
- data/rust-vendor/wit-component/tests/components/live-exports-dead-imports/component.wat +38 -0
- data/rust-vendor/wit-component/tests/components/live-exports-dead-imports/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/live-exports-dead-imports/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/live-exports-dead-imports/module.wit +12 -0
- data/rust-vendor/wit-component/tests/components/lower-options/component.wat +281 -0
- data/rust-vendor/wit-component/tests/components/lower-options/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/lower-options/module.wat +20 -0
- data/rust-vendor/wit-component/tests/components/lower-options/module.wit +40 -0
- data/rust-vendor/wit-component/tests/components/many-same-names/component.wat +48 -0
- data/rust-vendor/wit-component/tests/components/many-same-names/component.wit.print +10 -0
- data/rust-vendor/wit-component/tests/components/many-same-names/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/many-same-names/module.wit +21 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions/component.wat +125 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions/module.wat +15 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions/module.wit +30 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/adapt-old.wat +10 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/adapt-old.wit +19 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/component.wat +104 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/module.wat +9 -0
- data/rust-vendor/wit-component/tests/components/merge-import-versions-with-adapter/module.wit +14 -0
- data/rust-vendor/wit-component/tests/components/multi-package/baz/qux/component.wat +90 -0
- data/rust-vendor/wit-component/tests/components/multi-package/baz/qux/component.wit.print +13 -0
- data/rust-vendor/wit-component/tests/components/multi-package/baz/qux/module.wat +7 -0
- data/rust-vendor/wit-component/tests/components/multi-package/component.wat +44 -0
- data/rust-vendor/wit-component/tests/components/multi-package/component.wit.print +4 -0
- data/rust-vendor/wit-component/tests/components/multi-package/foo/bar/component.wat +82 -0
- data/rust-vendor/wit-component/tests/components/multi-package/foo/bar/component.wit.print +13 -0
- data/rust-vendor/wit-component/tests/components/multi-package/foo/bar/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/multi-package/module.wit +25 -0
- data/rust-vendor/wit-component/tests/components/no-realloc-required/component.wat +67 -0
- data/rust-vendor/wit-component/tests/components/no-realloc-required/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/no-realloc-required/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/no-realloc-required/module.wit +7 -0
- data/rust-vendor/wit-component/tests/components/post-return/component.wat +36 -0
- data/rust-vendor/wit-component/tests/components/post-return/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/post-return/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/post-return/module.wit +5 -0
- data/rust-vendor/wit-component/tests/components/rename-import-interface/component.wat +29 -0
- data/rust-vendor/wit-component/tests/components/rename-import-interface/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/rename-import-interface/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/rename-import-interface/module.wit +9 -0
- data/rust-vendor/wit-component/tests/components/rename-interface/component.wat +39 -0
- data/rust-vendor/wit-component/tests/components/rename-interface/component.wit.print +10 -0
- data/rust-vendor/wit-component/tests/components/rename-interface/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/rename-interface/module.wit +18 -0
- data/rust-vendor/wit-component/tests/components/resource-intrinsics-with-just-import/component.wat +28 -0
- data/rust-vendor/wit-component/tests/components/resource-intrinsics-with-just-import/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/resource-intrinsics-with-just-import/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/resource-intrinsics-with-just-import/module.wit +7 -0
- data/rust-vendor/wit-component/tests/components/resource-used-through-import/component.wat +57 -0
- data/rust-vendor/wit-component/tests/components/resource-used-through-import/component.wit.print +11 -0
- data/rust-vendor/wit-component/tests/components/resource-used-through-import/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/resource-used-through-import/module.wit +13 -0
- data/rust-vendor/wit-component/tests/components/resource-using-export/component.wat +64 -0
- data/rust-vendor/wit-component/tests/components/resource-using-export/component.wit.print +10 -0
- data/rust-vendor/wit-component/tests/components/resource-using-export/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/resource-using-export/module.wit +16 -0
- data/rust-vendor/wit-component/tests/components/simple/component.wat +64 -0
- data/rust-vendor/wit-component/tests/components/simple/component.wit.print +7 -0
- data/rust-vendor/wit-component/tests/components/simple/module.wat +10 -0
- data/rust-vendor/wit-component/tests/components/simple/module.wit +7 -0
- data/rust-vendor/wit-component/tests/components/threading/component.wat +163 -0
- data/rust-vendor/wit-component/tests/components/threading/component.wit.print +6 -0
- data/rust-vendor/wit-component/tests/components/threading/module.wat +22 -0
- data/rust-vendor/wit-component/tests/components/threading/module.wit +10 -0
- data/rust-vendor/wit-component/tests/components/tricky-order/component.wat +44 -0
- data/rust-vendor/wit-component/tests/components/tricky-order/component.wit.print +11 -0
- data/rust-vendor/wit-component/tests/components/tricky-order/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/tricky-order/module.wit +20 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources/component.wat +75 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources/component.wit.print +11 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources/module.wat +7 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources/module.wit +19 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources2/component.wat +50 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources2/component.wit.print +10 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources2/module.wat +4 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources2/module.wit +14 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources3/component.wat +44 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources3/component.wit.print +9 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources3/module.wat +1 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources3/module.wit +17 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources4/component.wat +64 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources4/component.wit.print +8 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources4/module.wat +6 -0
- data/rust-vendor/wit-component/tests/components/tricky-resources4/module.wit +16 -0
- data/rust-vendor/wit-component/tests/components/unused-import/component.wat +29 -0
- data/rust-vendor/wit-component/tests/components/unused-import/component.wit.print +5 -0
- data/rust-vendor/wit-component/tests/components/unused-import/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/unused-import/module.wit +12 -0
- data/rust-vendor/wit-component/tests/components/worlds-with-type-renamings/component.wat +67 -0
- data/rust-vendor/wit-component/tests/components/worlds-with-type-renamings/component.wit.print +8 -0
- data/rust-vendor/wit-component/tests/components/worlds-with-type-renamings/module.wat +12 -0
- data/rust-vendor/wit-component/tests/components/worlds-with-type-renamings/module.wit +17 -0
- data/rust-vendor/wit-component/tests/components/worlds-with-types/component.wat +25 -0
- data/rust-vendor/wit-component/tests/components/worlds-with-types/component.wit.print +11 -0
- data/rust-vendor/wit-component/tests/components/worlds-with-types/module.wat +3 -0
- data/rust-vendor/wit-component/tests/components/worlds-with-types/module.wit +10 -0
- data/rust-vendor/wit-component/tests/components.rs +291 -0
- data/rust-vendor/wit-component/tests/interfaces/console.wat +18 -0
- data/rust-vendor/wit-component/tests/interfaces/console.wit +5 -0
- data/rust-vendor/wit-component/tests/interfaces/console.wit.print +6 -0
- data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate/foo.wit.print +20 -0
- data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate/join.wit +10 -0
- data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate/shared1.wit +3 -0
- data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate/shared2.wit +3 -0
- data/rust-vendor/wit-component/tests/interfaces/diamond-disambiguate.wat +70 -0
- data/rust-vendor/wit-component/tests/interfaces/diamond.wat +107 -0
- data/rust-vendor/wit-component/tests/interfaces/diamond.wit +31 -0
- data/rust-vendor/wit-component/tests/interfaces/diamond.wit.print +34 -0
- data/rust-vendor/wit-component/tests/interfaces/doc-comments/foo.wit +79 -0
- data/rust-vendor/wit-component/tests/interfaces/doc-comments/foo.wit.print +78 -0
- data/rust-vendor/wit-component/tests/interfaces/doc-comments.wat +73 -0
- data/rust-vendor/wit-component/tests/interfaces/empty.wat +50 -0
- data/rust-vendor/wit-component/tests/interfaces/empty.wit +12 -0
- data/rust-vendor/wit-component/tests/interfaces/empty.wit.print +16 -0
- data/rust-vendor/wit-component/tests/interfaces/export-other-packages-interface/deps/the-dep/the-doc.wit +9 -0
- data/rust-vendor/wit-component/tests/interfaces/export-other-packages-interface/foo.wit +5 -0
- data/rust-vendor/wit-component/tests/interfaces/export-other-packages-interface/foo.wit.print +5 -0
- data/rust-vendor/wit-component/tests/interfaces/export-other-packages-interface.wat +23 -0
- data/rust-vendor/wit-component/tests/interfaces/exports.wat +39 -0
- data/rust-vendor/wit-component/tests/interfaces/exports.wit +13 -0
- data/rust-vendor/wit-component/tests/interfaces/exports.wit.print +13 -0
- data/rust-vendor/wit-component/tests/interfaces/flags.wat +79 -0
- data/rust-vendor/wit-component/tests/interfaces/flags.wit +100 -0
- data/rust-vendor/wit-component/tests/interfaces/flags.wit.print +100 -0
- data/rust-vendor/wit-component/tests/interfaces/floats.wat +47 -0
- data/rust-vendor/wit-component/tests/interfaces/floats.wit +12 -0
- data/rust-vendor/wit-component/tests/interfaces/floats.wit.print +15 -0
- data/rust-vendor/wit-component/tests/interfaces/foreign-use-chain/deps/bar/bar.wit +9 -0
- data/rust-vendor/wit-component/tests/interfaces/foreign-use-chain/foo.wit +5 -0
- data/rust-vendor/wit-component/tests/interfaces/foreign-use-chain/foo.wit.print +6 -0
- data/rust-vendor/wit-component/tests/interfaces/foreign-use-chain.wat +31 -0
- data/rust-vendor/wit-component/tests/interfaces/import-and-export.wat +54 -0
- data/rust-vendor/wit-component/tests/interfaces/import-and-export.wit +14 -0
- data/rust-vendor/wit-component/tests/interfaces/import-and-export.wit.print +15 -0
- data/rust-vendor/wit-component/tests/interfaces/integers.wat +107 -0
- data/rust-vendor/wit-component/tests/interfaces/integers.wit +27 -0
- data/rust-vendor/wit-component/tests/interfaces/integers.wit.print +45 -0
- data/rust-vendor/wit-component/tests/interfaces/lists.wat +211 -0
- data/rust-vendor/wit-component/tests/interfaces/lists.wit +96 -0
- data/rust-vendor/wit-component/tests/interfaces/lists.wit.print +96 -0
- data/rust-vendor/wit-component/tests/interfaces/maps.wat +186 -0
- data/rust-vendor/wit-component/tests/interfaces/maps.wit +38 -0
- data/rust-vendor/wit-component/tests/interfaces/maps.wit.print +57 -0
- data/rust-vendor/wit-component/tests/interfaces/multi-doc/a.wit +9 -0
- data/rust-vendor/wit-component/tests/interfaces/multi-doc/b.wit +9 -0
- data/rust-vendor/wit-component/tests/interfaces/multi-doc/foo.wit.print +20 -0
- data/rust-vendor/wit-component/tests/interfaces/multi-doc.wat +78 -0
- data/rust-vendor/wit-component/tests/interfaces/multiple-use.wat +67 -0
- data/rust-vendor/wit-component/tests/interfaces/multiple-use.wit +16 -0
- data/rust-vendor/wit-component/tests/interfaces/multiple-use.wit.print +18 -0
- data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain/chain.wit.print +18 -0
- data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain/def.wit +13 -0
- data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain/the-use.wit +5 -0
- data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain.wat +70 -0
- data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain2/bar.wit +13 -0
- data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain2/foo.wit +5 -0
- data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain2/foo.wit.print +20 -0
- data/rust-vendor/wit-component/tests/interfaces/pkg-use-chain2.wat +70 -0
- data/rust-vendor/wit-component/tests/interfaces/preserve-dep-type-order/deps/dep/foo.wit +11 -0
- data/rust-vendor/wit-component/tests/interfaces/preserve-dep-type-order/foo.wit +9 -0
- data/rust-vendor/wit-component/tests/interfaces/preserve-dep-type-order/foo.wit.print +9 -0
- data/rust-vendor/wit-component/tests/interfaces/preserve-dep-type-order.wat +47 -0
- data/rust-vendor/wit-component/tests/interfaces/preserve-foreign-reexport/deps/my-dep/my-doc.wit +8 -0
- data/rust-vendor/wit-component/tests/interfaces/preserve-foreign-reexport/foo.wit +5 -0
- data/rust-vendor/wit-component/tests/interfaces/preserve-foreign-reexport/foo.wit.print +5 -0
- data/rust-vendor/wit-component/tests/interfaces/preserve-foreign-reexport.wat +24 -0
- data/rust-vendor/wit-component/tests/interfaces/print-keyword.wat +21 -0
- data/rust-vendor/wit-component/tests/interfaces/print-keyword.wit +10 -0
- data/rust-vendor/wit-component/tests/interfaces/print-keyword.wit.print +12 -0
- data/rust-vendor/wit-component/tests/interfaces/records.wat +141 -0
- data/rust-vendor/wit-component/tests/interfaces/records.wit +63 -0
- data/rust-vendor/wit-component/tests/interfaces/records.wit.print +64 -0
- data/rust-vendor/wit-component/tests/interfaces/reference-out-of-order.wat +63 -0
- data/rust-vendor/wit-component/tests/interfaces/reference-out-of-order.wit +28 -0
- data/rust-vendor/wit-component/tests/interfaces/reference-out-of-order.wit.print +31 -0
- data/rust-vendor/wit-component/tests/interfaces/resources.wat +192 -0
- data/rust-vendor/wit-component/tests/interfaces/resources.wit +80 -0
- data/rust-vendor/wit-component/tests/interfaces/resources.wit.print +81 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-deps/deps/some-dep/types.wit +5 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-deps/foo.wit +4 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-deps/foo.wit.print +6 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-deps.wat +26 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-multi/bar.wit +1 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-multi/foo.wit +3 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-multi/foo.wit.print +8 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-multi.wat +24 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-use.wat +40 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-use.wit +13 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-use.wit.print +15 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-world.wat +35 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-world.wit +9 -0
- data/rust-vendor/wit-component/tests/interfaces/simple-world.wit.print +9 -0
- data/rust-vendor/wit-component/tests/interfaces/single-named-result.wat +18 -0
- data/rust-vendor/wit-component/tests/interfaces/type-alias.wat +51 -0
- data/rust-vendor/wit-component/tests/interfaces/type-alias.wit +13 -0
- data/rust-vendor/wit-component/tests/interfaces/type-alias.wit.print +15 -0
- data/rust-vendor/wit-component/tests/interfaces/type-alias2.wat +41 -0
- data/rust-vendor/wit-component/tests/interfaces/type-alias2.wit +15 -0
- data/rust-vendor/wit-component/tests/interfaces/type-alias2.wit.print +15 -0
- data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name/deps/a/the-name.wit +4 -0
- data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name/deps/b/the-name.wit +4 -0
- data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name/foo.wit +6 -0
- data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name/foo.wit.print +7 -0
- data/rust-vendor/wit-component/tests/interfaces/upstream-deps-same-name.wat +36 -0
- data/rust-vendor/wit-component/tests/interfaces/use-chain.wat +72 -0
- data/rust-vendor/wit-component/tests/interfaces/use-chain.wit +15 -0
- data/rust-vendor/wit-component/tests/interfaces/use-chain.wit.print +18 -0
- data/rust-vendor/wit-component/tests/interfaces/use-for-type.wat +49 -0
- data/rust-vendor/wit-component/tests/interfaces/use-for-type.wit +16 -0
- data/rust-vendor/wit-component/tests/interfaces/use-for-type.wit.print +17 -0
- data/rust-vendor/wit-component/tests/interfaces/variants.wat +197 -0
- data/rust-vendor/wit-component/tests/interfaces/variants.wit +78 -0
- data/rust-vendor/wit-component/tests/interfaces/variants.wit.print +95 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/command.wit +7 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/environment.wit +18 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/exit.wit +4 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/imports.wit +20 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/run.wit +4 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/stdio.wit +17 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/cli/terminal.wit +47 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/clocks/monotonic-clock.wit +45 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/clocks/wall-clock.wit +42 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/clocks/world.wit +6 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/filesystem/preopens.wit +8 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/filesystem/types.wit +634 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/filesystem/world.wit +6 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/io/error.wit +34 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/io/poll.wit +41 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/io/streams.wit +251 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/io/world.wit +6 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/random/insecure-seed.wit +25 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/random/insecure.wit +22 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/random/random.wit +26 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/random/world.wit +7 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/instance-network.wit +9 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/ip-name-lookup.wit +51 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/network.wit +147 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/tcp-create-socket.wit +26 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/tcp.wit +321 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/udp-create-socket.wit +26 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/udp.wit +277 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/deps/sockets/world.wit +11 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/handler.wit +43 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/http.wit.print +571 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/proxy.wit +32 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http/types.wit +570 -0
- data/rust-vendor/wit-component/tests/interfaces/wasi-http.wat +881 -0
- data/rust-vendor/wit-component/tests/interfaces/world-inline-interface.wat +24 -0
- data/rust-vendor/wit-component/tests/interfaces/world-inline-interface.wit +6 -0
- data/rust-vendor/wit-component/tests/interfaces/world-inline-interface.wit.print +9 -0
- data/rust-vendor/wit-component/tests/interfaces/world-pkg-conflict/bar.wit +3 -0
- data/rust-vendor/wit-component/tests/interfaces/world-pkg-conflict/foo.wit +9 -0
- data/rust-vendor/wit-component/tests/interfaces/world-pkg-conflict/foo.wit.print +12 -0
- data/rust-vendor/wit-component/tests/interfaces/world-pkg-conflict.wat +47 -0
- data/rust-vendor/wit-component/tests/interfaces/world-top-level.wat +55 -0
- data/rust-vendor/wit-component/tests/interfaces/world-top-level.wit +20 -0
- data/rust-vendor/wit-component/tests/interfaces/world-top-level.wit.print +19 -0
- data/rust-vendor/wit-component/tests/interfaces/worlds-with-types.wat +56 -0
- data/rust-vendor/wit-component/tests/interfaces/worlds-with-types.wit +23 -0
- data/rust-vendor/wit-component/tests/interfaces/worlds-with-types.wit.print +23 -0
- data/rust-vendor/wit-component/tests/interfaces.rs +123 -0
- data/rust-vendor/wit-component/tests/linking.rs +299 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface1/error.txt +1 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface1/from/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface1/from/deps/foo/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface1/into/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface1/into/deps/foo/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface2/error.txt +1 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface2/from/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface2/from/deps/foo/a.wit +7 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface2/into/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-interface2/into/deps/foo/a.wit +7 -0
- data/rust-vendor/wit-component/tests/merge/bad-world1/error.txt +1 -0
- data/rust-vendor/wit-component/tests/merge/bad-world1/from/a.wit +4 -0
- data/rust-vendor/wit-component/tests/merge/bad-world1/from/deps/foo/a.wit +11 -0
- data/rust-vendor/wit-component/tests/merge/bad-world1/into/a.wit +4 -0
- data/rust-vendor/wit-component/tests/merge/bad-world1/into/deps/foo/a.wit +9 -0
- data/rust-vendor/wit-component/tests/merge/bad-world2/error.txt +1 -0
- data/rust-vendor/wit-component/tests/merge/bad-world2/from/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-world2/from/deps/foo/a.wit +8 -0
- data/rust-vendor/wit-component/tests/merge/bad-world2/into/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-world2/into/deps/foo/a.wit +9 -0
- data/rust-vendor/wit-component/tests/merge/bad-world3/error.txt +1 -0
- data/rust-vendor/wit-component/tests/merge/bad-world3/from/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-world3/from/deps/foo/a.wit +8 -0
- data/rust-vendor/wit-component/tests/merge/bad-world3/into/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-world3/into/deps/foo/a.wit +9 -0
- data/rust-vendor/wit-component/tests/merge/bad-world4/error.txt +1 -0
- data/rust-vendor/wit-component/tests/merge/bad-world4/from/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-world4/from/deps/foo/a.wit +11 -0
- data/rust-vendor/wit-component/tests/merge/bad-world4/into/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-world4/into/deps/foo/a.wit +9 -0
- data/rust-vendor/wit-component/tests/merge/bad-world5/error.txt +1 -0
- data/rust-vendor/wit-component/tests/merge/bad-world5/from/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-world5/from/deps/foo/a.wit +11 -0
- data/rust-vendor/wit-component/tests/merge/bad-world5/into/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/bad-world5/into/deps/foo/a.wit +9 -0
- data/rust-vendor/wit-component/tests/merge/success/from/a.wit +7 -0
- data/rust-vendor/wit-component/tests/merge/success/from/deps/foo/only-from.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/success/from/deps/foo/shared.wit +46 -0
- data/rust-vendor/wit-component/tests/merge/success/from/deps/only-from-dep/a.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/success/into/b.wit +7 -0
- data/rust-vendor/wit-component/tests/merge/success/into/deps/foo/only-into.wit +5 -0
- data/rust-vendor/wit-component/tests/merge/success/into/deps/foo/shared.wit +44 -0
- data/rust-vendor/wit-component/tests/merge/success/merge/foo.wit +77 -0
- data/rust-vendor/wit-component/tests/merge/success/merge/from.wit +8 -0
- data/rust-vendor/wit-component/tests/merge/success/merge/into.wit +8 -0
- data/rust-vendor/wit-component/tests/merge/success/merge/only-from-dep.wit +6 -0
- data/rust-vendor/wit-component/tests/merge.rs +80 -0
- data/rust-vendor/wit-component/tests/targets/error-missing-export/error.txt +2 -0
- data/rust-vendor/wit-component/tests/targets/error-missing-export/test.wat +39 -0
- data/rust-vendor/wit-component/tests/targets/error-missing-export/test.wit +18 -0
- data/rust-vendor/wit-component/tests/targets/error-missing-import/error.txt +2 -0
- data/rust-vendor/wit-component/tests/targets/error-missing-import/test.wat +37 -0
- data/rust-vendor/wit-component/tests/targets/error-missing-import/test.wit +13 -0
- data/rust-vendor/wit-component/tests/targets/success/test.wat +56 -0
- data/rust-vendor/wit-component/tests/targets/success/test.wit +14 -0
- data/rust-vendor/wit-component/tests/targets/success-empty/test.wat +1 -0
- data/rust-vendor/wit-component/tests/targets/success-empty/test.wit +9 -0
- data/rust-vendor/wit-component/tests/targets.rs +89 -0
- data/rust-vendor/wit-component/tests/wit/parse-dir/wit/deps/bar/bar.wit +9 -0
- data/rust-vendor/wit-component/tests/wit/parse-dir/wit/world.wit +5 -0
- data/rust-vendor/wit-component/tests/wit.rs +49 -0
- data/rust-vendor/wit-parser/.cargo-checksum.json +1 -0
- data/rust-vendor/wit-parser/.cargo_vcs_info.json +6 -0
- data/rust-vendor/wit-parser/Cargo.lock +576 -0
- data/rust-vendor/wit-parser/Cargo.toml +157 -0
- data/rust-vendor/wit-parser/Cargo.toml.orig +56 -0
- data/rust-vendor/wit-parser/README.md +13 -0
- data/rust-vendor/wit-parser/src/abi.rs +410 -0
- data/rust-vendor/wit-parser/src/ast/lex.rs +751 -0
- data/rust-vendor/wit-parser/src/ast/resolve.rs +1813 -0
- data/rust-vendor/wit-parser/src/ast/toposort.rs +249 -0
- data/rust-vendor/wit-parser/src/ast.rs +1958 -0
- data/rust-vendor/wit-parser/src/decoding.rs +1864 -0
- data/rust-vendor/wit-parser/src/lib.rs +1413 -0
- data/rust-vendor/wit-parser/src/live.rs +264 -0
- data/rust-vendor/wit-parser/src/metadata.rs +772 -0
- data/rust-vendor/wit-parser/src/resolve/clone.rs +227 -0
- data/rust-vendor/wit-parser/src/resolve.rs +4636 -0
- data/rust-vendor/wit-parser/src/serde_.rs +140 -0
- data/rust-vendor/wit-parser/src/sizealign.rs +626 -0
- data/rust-vendor/wit-parser/tests/.gitignore +2 -0
- data/rust-vendor/wit-parser/tests/all.rs +153 -0
- data/rust-vendor/wit-parser/tests/ui/async.wit +24 -0
- data/rust-vendor/wit-parser/tests/ui/async.wit.json +151 -0
- data/rust-vendor/wit-parser/tests/ui/comments.wit +25 -0
- data/rust-vendor/wit-parser/tests/ui/comments.wit.json +46 -0
- data/rust-vendor/wit-parser/tests/ui/complex-include/deps/bar/root.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/complex-include/deps/baz/root.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/complex-include/root.wit +26 -0
- data/rust-vendor/wit-parser/tests/ui/complex-include.wit.json +200 -0
- data/rust-vendor/wit-parser/tests/ui/cross-package-resource/deps/foo/foo.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/cross-package-resource/foo.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/cross-package-resource.wit.json +67 -0
- data/rust-vendor/wit-parser/tests/ui/diamond1/deps/dep1/types.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/diamond1/deps/dep2/types.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/diamond1/join.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/diamond1.wit.json +59 -0
- data/rust-vendor/wit-parser/tests/ui/disambiguate-diamond/shared1.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/disambiguate-diamond/shared2.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/disambiguate-diamond/world.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/disambiguate-diamond.wit.json +115 -0
- data/rust-vendor/wit-parser/tests/ui/empty.wit +1 -0
- data/rust-vendor/wit-parser/tests/ui/empty.wit.json +12 -0
- data/rust-vendor/wit-parser/tests/ui/error-context.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/error-context.wit.json +59 -0
- data/rust-vendor/wit-parser/tests/ui/feature-gates.wit +118 -0
- data/rust-vendor/wit-parser/tests/ui/feature-gates.wit.json +301 -0
- data/rust-vendor/wit-parser/tests/ui/feature-types.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/feature-types.wit.json +66 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/another-pkg/other-doc.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/corp/saas.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/different-pkg/the-doc.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/foreign-pkg/the-doc.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/some-pkg/some-doc.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/wasi/clocks.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps/deps/wasi/filesystem.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps/root.wit +44 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/another-pkg/other-doc.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/corp/saas.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/different-pkg/the-doc.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/foreign-pkg/the-doc.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/some-pkg/some-doc.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/wasi/clocks.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/wasi/filesystem.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/deps/wasi/wasi.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union/root.wit +50 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps-union.wit.json +410 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-deps.wit.json +362 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-interface-dep-gated.wit +17 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-interface-dep-gated.wit.json +39 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-world-dep-gated.wit +17 -0
- data/rust-vendor/wit-parser/tests/ui/foreign-world-dep-gated.wit.json +39 -0
- data/rust-vendor/wit-parser/tests/ui/functions.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/functions.wit.json +115 -0
- data/rust-vendor/wit-parser/tests/ui/gated-include.wit +67 -0
- data/rust-vendor/wit-parser/tests/ui/gated-include.wit.json +346 -0
- data/rust-vendor/wit-parser/tests/ui/gated-use.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/gated-use.wit.json +34 -0
- data/rust-vendor/wit-parser/tests/ui/ignore-files-deps/deps/bar/types.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/ignore-files-deps/deps/ignore-me.txt +1 -0
- data/rust-vendor/wit-parser/tests/ui/ignore-files-deps/world.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/ignore-files-deps.wit.json +41 -0
- data/rust-vendor/wit-parser/tests/ui/import-export-overlap1.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/import-export-overlap1.wit.json +37 -0
- data/rust-vendor/wit-parser/tests/ui/import-export-overlap2.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/import-export-overlap2.wit.json +42 -0
- data/rust-vendor/wit-parser/tests/ui/include-reps.wit +15 -0
- data/rust-vendor/wit-parser/tests/ui/include-reps.wit.json +68 -0
- data/rust-vendor/wit-parser/tests/ui/kebab-name-include-with.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/kebab-name-include-with.wit.json +66 -0
- data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/a.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/deps/b/root.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/deps/c.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/deps/d.wat +6 -0
- data/rust-vendor/wit-parser/tests/ui/kinds-of-deps/deps/e.wasm +0 -0
- data/rust-vendor/wit-parser/tests/ui/kinds-of-deps.wit.json +95 -0
- data/rust-vendor/wit-parser/tests/ui/many-names/a.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/many-names/b.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/many-names.wit.json +42 -0
- data/rust-vendor/wit-parser/tests/ui/maps.wit +34 -0
- data/rust-vendor/wit-parser/tests/ui/maps.wit.json +255 -0
- data/rust-vendor/wit-parser/tests/ui/multi-file/bar.wit +21 -0
- data/rust-vendor/wit-parser/tests/ui/multi-file/cycle-a.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/multi-file/cycle-b.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/multi-file/foo.wit +31 -0
- data/rust-vendor/wit-parser/tests/ui/multi-file-multi-package/a.wit +24 -0
- data/rust-vendor/wit-parser/tests/ui/multi-file-multi-package/b.wit +23 -0
- data/rust-vendor/wit-parser/tests/ui/multi-file-multi-package.wit.json +255 -0
- data/rust-vendor/wit-parser/tests/ui/multi-file.wit.json +300 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-deps/deps/dep.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-deps/root.wit +16 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-deps.wit.json +161 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-gated-include.wit +114 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-gated-include.wit.json +697 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-shared-deps/deps/dep1/types.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-shared-deps/deps/dep2/types.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-shared-deps/packages.wit +41 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-shared-deps.wit.json +261 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-transitive-deps/deps/dep1/types.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-transitive-deps/deps/dep2/types.wit +14 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-transitive-deps/packages.wit +12 -0
- data/rust-vendor/wit-parser/tests/ui/multi-package-transitive-deps.wit.json +174 -0
- data/rust-vendor/wit-parser/tests/ui/name-both-resource-and-type/deps/dep/foo.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/name-both-resource-and-type/foo.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/name-both-resource-and-type.wit.json +89 -0
- data/rust-vendor/wit-parser/tests/ui/package-syntax1.wit +1 -0
- data/rust-vendor/wit-parser/tests/ui/package-syntax1.wit.json +12 -0
- data/rust-vendor/wit-parser/tests/ui/package-syntax3.wit +1 -0
- data/rust-vendor/wit-parser/tests/ui/package-syntax3.wit.json +12 -0
- data/rust-vendor/wit-parser/tests/ui/package-syntax4.wit +1 -0
- data/rust-vendor/wit-parser/tests/ui/package-syntax4.wit.json +12 -0
- data/rust-vendor/wit-parser/tests/ui/packages-multiple-nested.wit +35 -0
- data/rust-vendor/wit-parser/tests/ui/packages-multiple-nested.wit.json +184 -0
- data/rust-vendor/wit-parser/tests/ui/packages-nested-colliding-decl-names.wit +24 -0
- data/rust-vendor/wit-parser/tests/ui/packages-nested-colliding-decl-names.wit.json +135 -0
- data/rust-vendor/wit-parser/tests/ui/packages-nested-internal-references.wit +16 -0
- data/rust-vendor/wit-parser/tests/ui/packages-nested-internal-references.wit.json +91 -0
- data/rust-vendor/wit-parser/tests/ui/packages-nested-with-semver.wit +24 -0
- data/rust-vendor/wit-parser/tests/ui/packages-nested-with-semver.wit.json +135 -0
- data/rust-vendor/wit-parser/tests/ui/packages-single-nested.wit +12 -0
- data/rust-vendor/wit-parser/tests/ui/packages-single-nested.wit.json +75 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/alias-no-type.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/alias-no-type.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world2.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world3.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world4.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad-world4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad1.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad2.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async-bad2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/async1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated1.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated2.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated3.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated4.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-deprecated4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-function.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-function.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-function2.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-function2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate1.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate2.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate3.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate4.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate5.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-gate5.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include1.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include2.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include3.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-include3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list2.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list3.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list4.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-list4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg1/root.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg2/deps/bar/empty.wit +1 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg2/root.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg3/deps/bar/.gitkeep +0 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg3/deps/bar/baz.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg3/root.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg4/deps/bar/.gitkeep +0 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg4/deps/bar/baz.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg4/root.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg5/deps/bar/.gitkeep +0 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg5/deps/bar/baz.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg5/root.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg5.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg6/deps/bar/.gitkeep +0 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg6/deps/bar/baz.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg6/root.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-pkg6.wit.result +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource1.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource10.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource10.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource11.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource11.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource12.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource12.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource13.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource13.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource14.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource14.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource15/deps/foo/foo.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource15/foo.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource15.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource16.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource16.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource17.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource17.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource2.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource3.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource4.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource5.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource5.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource6.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource6.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource7.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource7.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource8.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource8.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource9.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-resource9.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-since1.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-since1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-since3.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-since3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-world-type1.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/bad-world-type1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/case-insensitive-duplicates.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/case-insensitive-duplicates.wit.result +1 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/conflicting-package/a.wit +1 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/conflicting-package/b.wit +1 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/conflicting-package.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle2.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle3.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle4.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle5.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/cycle5.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/dangling-type.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/dangling-type.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-function-params.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-function-params.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-functions.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-functions.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface2/foo.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface2/foo2.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-interface2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-type.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/duplicate-type.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/empty-enum.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/empty-enum.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/empty-variant1.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/empty-variant1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/export-twice.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/export-twice.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export1.wit +17 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export2.wit +18 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export3.wit +37 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export4.wit +44 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export5.wit +18 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-and-export5.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-twice.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/import-twice.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-cycle.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-cycle.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-foreign/deps/bar/empty.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-foreign/root.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-foreign.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-with-id.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-with-id.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-with-on-id.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/include-with-on-id.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-toplevel.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-toplevel.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-type-reference.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-type-reference.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-type-reference2.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/invalid-type-reference2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/kebab-name-include-not-found.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/kebab-name-include-not-found.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/kebab-name-include.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/kebab-name-include.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/keyword.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/keyword.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/map-invalid-key.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/map-invalid-key.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-main-declaration-initial-main.wit +23 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-main-declaration-initial-main.wit.result +1 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-main-declaration-initial-nested.wit +23 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-main-declaration-initial-nested.wit.result +1 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-package.wit +0 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/missing-package.wit.result +1 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-file-missing-delimiter/observe.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-file-missing-delimiter/world.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-file-missing-delimiter.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-package-deps-share-nest/deps/dep1/types.wit +12 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-package-deps-share-nest/deps/dep2/types.wit +12 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-package-deps-share-nest/root.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multi-package-deps-share-nest.wit.result +3 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-docs/a.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-docs/b.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-docs.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-inline-cycle.wit +12 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-package-inline-cycle.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-packages-no-scope-blocks.wit +15 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/multiple-packages-no-scope-blocks.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/nested-packages-colliding-names.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/nested-packages-colliding-names.wit.result +3 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/nested-packages-with-error.wit +14 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/nested-packages-with-error.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/no-access-to-sibling-use/bar.wit +1 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/no-access-to-sibling-use/foo.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/no-access-to-sibling-use.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/non-existance-world-include/deps/bar/.gitkeep +0 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/non-existance-world-include/deps/bar/baz.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/non-existance-world-include/root.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/non-existance-world-include.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/old-float-types.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/old-float-types.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle/deps/a1/root.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle/root.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle2/deps/a1/root.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle2/deps/a2/root.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle2/root.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/pkg-cycle2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/resources-multiple-returns-borrow.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/resources-multiple-returns-borrow.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/resources-return-borrow.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/resources-return-borrow.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow1.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow2.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow3.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow4.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow5.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow5.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow6.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow6.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow7.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow7.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow8/deps/baz.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow8/foo.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/return-borrow8.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/type-and-resource-same-name/deps/dep/foo.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/type-and-resource-same-name/foo.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/type-and-resource-same-name.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/undefined-typed.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/undefined-typed.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unknown-interface.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unknown-interface.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface1.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface2.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface3.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface4.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-interface4.wit.result +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use1.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use10/bar.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use10/foo.wit +2 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use10.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use2.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use3.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use7.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use7.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use8.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use8.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use9.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unresolved-use9.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/unterminated-string.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-and-include-world/deps/bar/.gitkeep +0 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-and-include-world/deps/bar/baz.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-and-include-world/root.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-and-include-world.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict2.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict3.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-conflict3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-cycle1.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-cycle1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-cycle4.wit +14 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-cycle4.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-shadow1.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-shadow1.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-world/deps/bar/.gitkeep +0 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-world/deps/bar/baz.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-world/root.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/use-world.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/very-nested-packages.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/very-nested-packages.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-interface-clash.wit +3 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-interface-clash.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-same-fields2.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-same-fields2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-same-fields3.wit +8 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-same-fields3.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-top-level-func.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-top-level-func.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-top-level-func2.wit +4 -0
- data/rust-vendor/wit-parser/tests/ui/parse-fail/world-top-level-func2.wit.result +5 -0
- data/rust-vendor/wit-parser/tests/ui/random.wit +27 -0
- data/rust-vendor/wit-parser/tests/ui/random.wit.json +56 -0
- data/rust-vendor/wit-parser/tests/ui/resources-empty.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/resources-empty.wit.json +70 -0
- data/rust-vendor/wit-parser/tests/ui/resources-multiple-returns-own.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/resources-multiple-returns-own.wit.json +85 -0
- data/rust-vendor/wit-parser/tests/ui/resources-multiple.wit +17 -0
- data/rust-vendor/wit-parser/tests/ui/resources-multiple.wit.json +207 -0
- data/rust-vendor/wit-parser/tests/ui/resources-return-own.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/resources-return-own.wit.json +73 -0
- data/rust-vendor/wit-parser/tests/ui/resources.wit +55 -0
- data/rust-vendor/wit-parser/tests/ui/resources.wit.json +387 -0
- data/rust-vendor/wit-parser/tests/ui/resources1.wit +12 -0
- data/rust-vendor/wit-parser/tests/ui/resources1.wit.json +92 -0
- data/rust-vendor/wit-parser/tests/ui/same-name-import-export.wit +6 -0
- data/rust-vendor/wit-parser/tests/ui/same-name-import-export.wit.json +39 -0
- data/rust-vendor/wit-parser/tests/ui/shared-types.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/shared-types.wit.json +79 -0
- data/rust-vendor/wit-parser/tests/ui/simple-wasm-text.wat +6 -0
- data/rust-vendor/wit-parser/tests/ui/simple-wasm-text.wit.json +21 -0
- data/rust-vendor/wit-parser/tests/ui/since-and-unstable.wit +107 -0
- data/rust-vendor/wit-parser/tests/ui/since-and-unstable.wit.json +608 -0
- data/rust-vendor/wit-parser/tests/ui/streams-and-futures.wit +15 -0
- data/rust-vendor/wit-parser/tests/ui/streams-and-futures.wit.json +205 -0
- data/rust-vendor/wit-parser/tests/ui/stress-export-elaborate.wit +54 -0
- data/rust-vendor/wit-parser/tests/ui/stress-export-elaborate.wit.json +1156 -0
- data/rust-vendor/wit-parser/tests/ui/type-then-eof.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/type-then-eof.wit.json +28 -0
- data/rust-vendor/wit-parser/tests/ui/types.wit +59 -0
- data/rust-vendor/wit-parser/tests/ui/types.wit.json +768 -0
- data/rust-vendor/wit-parser/tests/ui/union-fuzz-1.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/union-fuzz-1.wit.json +35 -0
- data/rust-vendor/wit-parser/tests/ui/union-fuzz-2.wit +12 -0
- data/rust-vendor/wit-parser/tests/ui/union-fuzz-2.wit.json +62 -0
- data/rust-vendor/wit-parser/tests/ui/unstable-resource.wit +17 -0
- data/rust-vendor/wit-parser/tests/ui/unstable-resource.wit.json +44 -0
- data/rust-vendor/wit-parser/tests/ui/use-chain.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/use-chain.wit.json +53 -0
- data/rust-vendor/wit-parser/tests/ui/use.wit +34 -0
- data/rust-vendor/wit-parser/tests/ui/use.wit.json +168 -0
- data/rust-vendor/wit-parser/tests/ui/version-syntax.wit +10 -0
- data/rust-vendor/wit-parser/tests/ui/version-syntax.wit.json +57 -0
- data/rust-vendor/wit-parser/tests/ui/versions/deps/a1/foo.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/versions/deps/a2/foo.wit +5 -0
- data/rust-vendor/wit-parser/tests/ui/versions/foo.wit +7 -0
- data/rust-vendor/wit-parser/tests/ui/versions.wit.json +91 -0
- data/rust-vendor/wit-parser/tests/ui/wasi.wit +178 -0
- data/rust-vendor/wit-parser/tests/ui/wasi.wit.json +539 -0
- data/rust-vendor/wit-parser/tests/ui/with-resource-as.wit +15 -0
- data/rust-vendor/wit-parser/tests/ui/with-resource-as.wit.json +221 -0
- data/rust-vendor/wit-parser/tests/ui/world-diamond.wit +23 -0
- data/rust-vendor/wit-parser/tests/ui/world-diamond.wit.json +115 -0
- data/rust-vendor/wit-parser/tests/ui/world-iface-no-collide.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/world-iface-no-collide.wit.json +67 -0
- data/rust-vendor/wit-parser/tests/ui/world-implicit-import1.wit +12 -0
- data/rust-vendor/wit-parser/tests/ui/world-implicit-import1.wit.json +81 -0
- data/rust-vendor/wit-parser/tests/ui/world-implicit-import2.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/world-implicit-import2.wit.json +68 -0
- data/rust-vendor/wit-parser/tests/ui/world-implicit-import3.wit +11 -0
- data/rust-vendor/wit-parser/tests/ui/world-implicit-import3.wit.json +69 -0
- data/rust-vendor/wit-parser/tests/ui/world-same-fields4.wit +13 -0
- data/rust-vendor/wit-parser/tests/ui/world-same-fields4.wit.json +82 -0
- data/rust-vendor/wit-parser/tests/ui/world-top-level-funcs.wit +9 -0
- data/rust-vendor/wit-parser/tests/ui/world-top-level-funcs.wit.json +79 -0
- data/rust-vendor/wit-parser/tests/ui/world-top-level-resources.wit +24 -0
- data/rust-vendor/wit-parser/tests/ui/world-top-level-resources.wit.json +225 -0
- data/rust-vendor/wit-parser/tests/ui/worlds-union-dedup.wit +23 -0
- data/rust-vendor/wit-parser/tests/ui/worlds-union-dedup.wit.json +112 -0
- data/rust-vendor/wit-parser/tests/ui/worlds-with-types.wit +34 -0
- data/rust-vendor/wit-parser/tests/ui/worlds-with-types.wit.json +188 -0
- data/rust-vendor/zerocopy/.cargo-checksum.json +1 -1
- data/rust-vendor/zerocopy/.cargo_vcs_info.json +1 -2
- data/rust-vendor/zerocopy/Cargo.lock +3 -3
- data/rust-vendor/zerocopy/Cargo.toml +4 -4
- data/rust-vendor/zerocopy/Cargo.toml.orig +4 -4
- data/rust-vendor/zerocopy/agent_docs/reviewing.md +8 -0
- data/rust-vendor/zerocopy/build.rs +1 -0
- data/rust-vendor/zerocopy/ci/release_crate_version.sh +3 -0
- data/rust-vendor/zerocopy/src/doctests.rs +18 -2
- data/rust-vendor/zerocopy/src/impls.rs +7 -4
- data/rust-vendor/zerocopy/src/lib.rs +60 -28
- data/rust-vendor/zerocopy/src/macros.rs +24 -4
- data/rust-vendor/zerocopy/src/pointer/invariant.rs +31 -3
- data/rust-vendor/zerocopy/src/pointer/mod.rs +2 -2
- data/rust-vendor/zerocopy/src/pointer/ptr.rs +3 -3
- data/rust-vendor/zerocopy/src/util/macros.rs +21 -6
- data/rust-vendor/zerocopy/tests/trybuild.rs +3 -18
- data/rust-vendor/zerocopy-derive/.cargo-checksum.json +1 -1
- data/rust-vendor/zerocopy-derive/.cargo_vcs_info.json +1 -1
- data/rust-vendor/zerocopy-derive/Cargo.lock +1 -1
- data/rust-vendor/zerocopy-derive/Cargo.toml +9 -2
- data/rust-vendor/zerocopy-derive/Cargo.toml.orig +5 -2
- data/rust-vendor/zerocopy-derive/src/derive/from_bytes.rs +9 -7
- data/rust-vendor/zerocopy-derive/src/derive/into_bytes.rs +8 -4
- data/rust-vendor/zerocopy-derive/src/derive/try_from_bytes.rs +52 -18
- data/rust-vendor/zerocopy-derive/src/derive/unaligned.rs +3 -3
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_enum.expected.rs +7 -3
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_struct.expected.rs +7 -3
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_bytes_union.expected.rs +7 -3
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/from_zeros.expected.rs +7 -3
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes.expected.rs +7 -3
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_1.expected.rs +22 -10
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_2.expected.rs +22 -10
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_3.expected.rs +22 -10
- data/rust-vendor/zerocopy-derive/src/output_tests/expected/try_from_bytes_trivial_is_bit_valid_enum.expected.rs +7 -3
- data/rust-vendor/zerocopy-derive/src/util.rs +72 -5
- data/rust-vendor/zerocopy-derive/tests/on_error.rs +169 -0
- data/rust-vendor/zerocopy-derive/tests/trybuild.rs +9 -7
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/cfgs/on_error.rs +19 -0
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/cfgs/on_error.stderr +16 -0
- data/rust-vendor/zerocopy-derive/tests/ui-msrv/{union_into_bytes_cfg → cfgs}/union_into_bytes_cfg.stderr +1 -1
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/cfgs/on_error.rs +19 -0
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/cfgs/on_error.stderr +31 -0
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/cfgs/union_into_bytes_cfg.stderr +8 -0
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/union.stderr +0 -14
- data/rust-vendor/zerocopy-derive/tests/ui-stable/cfgs/on_error.rs +19 -0
- data/rust-vendor/zerocopy-derive/tests/ui-stable/cfgs/on_error.stderr +27 -0
- data/rust-vendor/zerocopy-derive/tests/ui-stable/cfgs/union_into_bytes_cfg.stderr +8 -0
- data/rust-vendor/zerocopy-derive/tests/ui-stable/union.stderr +0 -14
- data/rust-vendor/zmij/.cargo-checksum.json +1 -1
- data/rust-vendor/zmij/.cargo_vcs_info.json +1 -1
- data/rust-vendor/zmij/.github/workflows/ci.yml +9 -6
- data/rust-vendor/zmij/Cargo.lock +281 -58
- data/rust-vendor/zmij/Cargo.toml +3 -3
- data/rust-vendor/zmij/Cargo.toml.orig +3 -3
- data/rust-vendor/zmij/README.md +1 -1
- data/rust-vendor/zmij/src/lib.rs +124 -79
- data/rust-vendor/zmij/src/tests.rs +11 -5
- data/rust-vendor/zmij/tests/ryu_comparison.rs +3 -3
- metadata +1841 -55
- data/rust-vendor/libc/src/qurt/hexagon.rs +0 -340
- data/rust-vendor/regex/.vim/coc-settings.json +0 -6
- data/rust-vendor/regex/Cross.toml +0 -7
- data/rust-vendor/regex/rustfmt.toml +0 -2
- data/rust-vendor/regex/test +0 -46
- data/rust-vendor/regex/testdata/README.md +0 -22
- data/rust-vendor/regex/testdata/fowler/basic.toml +0 -1611
- data/rust-vendor/regex/testdata/fowler/dat/README +0 -25
- data/rust-vendor/regex/testdata/fowler/dat/basic.dat +0 -223
- data/rust-vendor/regex/testdata/fowler/dat/nullsubexpr.dat +0 -74
- data/rust-vendor/regex/testdata/fowler/dat/repetition.dat +0 -169
- data/rust-vendor/regex/testdata/fowler/nullsubexpr.toml +0 -405
- data/rust-vendor/regex/testdata/fowler/repetition.toml +0 -746
- data/rust-vendor/regex-automata/test +0 -95
- data/rust-vendor/regex-automata/tests/fuzz/mod.rs +0 -2
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_dense_crash-9486fb7c8a93b12c12a62166b43d31640c0208a9 +0 -0
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_dense_minimized-from-9486fb7c8a93b12c12a62166b43d31640c0208a9 +0 -0
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-0da59c0434eaf35e5a6b470fa9244bb79c72b000 +0 -0
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-18cfc246f2ddfc3dfc92b0c7893178c7cf65efa9 +0 -0
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-61fd8e3003bf9d99f6c1e5a8488727eefd234b98 +0 -0
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-a1b839d899ced76d5d7d0f78f9edb7a421505838 +0 -0
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-c383ae07ec5e191422eadc492117439011816570 +0 -0
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-d07703ceb94b10dcd9e4acb809f2051420449e2b +0 -0
- data/rust-vendor/regex-automata/tests/fuzz/testdata/deserialize_sparse_crash-dbb8172d3984e7e7d03f4b5f8bb86ecd1460eff9 +0 -0
- data/rust-vendor/regex-automata/tests/gen/README.md +0 -65
- data/rust-vendor/regex-automata/tests/gen/dense/multi_pattern_v2_fwd.bigendian.dfa +0 -0
- data/rust-vendor/regex-automata/tests/gen/dense/multi_pattern_v2_fwd.littleendian.dfa +0 -0
- data/rust-vendor/regex-automata/tests/gen/dense/multi_pattern_v2_rev.bigendian.dfa +0 -0
- data/rust-vendor/regex-automata/tests/gen/dense/multi_pattern_v2_rev.littleendian.dfa +0 -0
- data/rust-vendor/regex-automata/tests/gen/sparse/multi_pattern_v2_fwd.bigendian.dfa +0 -0
- data/rust-vendor/regex-automata/tests/gen/sparse/multi_pattern_v2_fwd.littleendian.dfa +0 -0
- data/rust-vendor/regex-automata/tests/gen/sparse/multi_pattern_v2_rev.bigendian.dfa +0 -0
- data/rust-vendor/regex-automata/tests/gen/sparse/multi_pattern_v2_rev.littleendian.dfa +0 -0
- data/rust-vendor/regex-syntax/benches/bench.rs +0 -63
- data/rust-vendor/regex-syntax/test +0 -30
- data/rust-vendor/zerocopy/tests/ui-msrv/invalid-impls/invalid-impls.rs +0 -31
- data/rust-vendor/zerocopy/tests/ui-msrv/invalid-impls/invalid-impls.stderr +0 -159
- data/rust-vendor/zerocopy/tests/ui-nightly/invalid-impls/invalid-impls.rs +0 -31
- data/rust-vendor/zerocopy/tests/ui-nightly/invalid-impls/invalid-impls.stderr +0 -139
- data/rust-vendor/zerocopy/tests/ui-stable/invalid-impls/invalid-impls.rs +0 -31
- data/rust-vendor/zerocopy/tests/ui-stable/invalid-impls/invalid-impls.stderr +0 -155
- data/rust-vendor/zerocopy-derive/tests/ui-nightly/union_into_bytes_cfg/union_into_bytes_cfg.stderr +0 -22
- data/rust-vendor/zerocopy-derive/tests/ui-stable/union_into_bytes_cfg/union_into_bytes_cfg.stderr +0 -22
- /data/rust-vendor/{getrandom → getrandom-0.3.4}/src/backends/sanitizer.rs +0 -0
- /data/rust-vendor/{getrandom → getrandom-0.3.4}/src/backends/wasi_p2.rs +0 -0
- /data/rust-vendor/{getrandom → getrandom-0.3.4}/src/lazy.rs +0 -0
- /data/rust-vendor/{getrandom → getrandom-0.3.4}/src/util_libc.rs +0 -0
- /data/rust-vendor/{wit-bindgen → wit-bindgen-0.46.0}/src/rt/wit_bindgen_cabi.c +0 -0
- /data/rust-vendor/{wit-bindgen → wit-bindgen-0.46.0}/src/rt/wit_bindgen_cabi.o +0 -0
- /data/rust-vendor/zerocopy-derive/tests/ui-msrv/{union_into_bytes_cfg → cfgs}/union_into_bytes_cfg.rs +0 -0
- /data/rust-vendor/zerocopy-derive/tests/ui-nightly/{union_into_bytes_cfg → cfgs}/union_into_bytes_cfg.rs +0 -0
- /data/rust-vendor/zerocopy-derive/tests/ui-stable/{union_into_bytes_cfg → cfgs}/union_into_bytes_cfg.rs +0 -0
|
@@ -0,0 +1,4036 @@
|
|
|
1
|
+
//! Types relating to type information provided by validation.
|
|
2
|
+
|
|
3
|
+
use super::component::ExternKind;
|
|
4
|
+
use super::{CanonicalOptions, Concurrency};
|
|
5
|
+
use crate::validator::StringEncoding;
|
|
6
|
+
use crate::validator::names::KebabString;
|
|
7
|
+
use crate::validator::types::{
|
|
8
|
+
CoreTypeId, EntityType, SnapshotList, TypeAlloc, TypeData, TypeIdentifier, TypeInfo, TypeList,
|
|
9
|
+
Types, TypesKind, TypesRef, TypesRefKind,
|
|
10
|
+
};
|
|
11
|
+
use crate::{AbstractHeapType, CompositeInnerType, HeapType, RefType, StorageType, prelude::*};
|
|
12
|
+
use crate::{
|
|
13
|
+
BinaryReaderError, FuncType, MemoryType, PrimitiveValType, Result, TableType, ValType,
|
|
14
|
+
};
|
|
15
|
+
use core::fmt;
|
|
16
|
+
use core::ops::Index;
|
|
17
|
+
use core::sync::atomic::{AtomicUsize, Ordering};
|
|
18
|
+
use core::{
|
|
19
|
+
borrow::Borrow,
|
|
20
|
+
hash::{Hash, Hasher},
|
|
21
|
+
mem,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/// The maximum number of parameters in the canonical ABI that can be passed by value.
|
|
25
|
+
///
|
|
26
|
+
/// Functions that exceed this limit will instead pass parameters indirectly from
|
|
27
|
+
/// linear memory via a single pointer parameter.
|
|
28
|
+
const MAX_FLAT_FUNC_PARAMS: usize = 16;
|
|
29
|
+
/// The maximum number of parameters in the canonical ABI that can be passed by
|
|
30
|
+
/// value in async function imports/exports.
|
|
31
|
+
const MAX_FLAT_ASYNC_PARAMS: usize = 4;
|
|
32
|
+
/// The maximum number of results in the canonical ABI that can be returned by a function.
|
|
33
|
+
///
|
|
34
|
+
/// Functions that exceed this limit have their results written to linear memory via an
|
|
35
|
+
/// additional pointer parameter (imports) or return a single pointer value (exports).
|
|
36
|
+
const MAX_FLAT_FUNC_RESULTS: usize = 1;
|
|
37
|
+
|
|
38
|
+
/// The maximum lowered types, including a possible type for a return pointer parameter.
|
|
39
|
+
const MAX_LOWERED_TYPES: usize = MAX_FLAT_FUNC_PARAMS + 1;
|
|
40
|
+
|
|
41
|
+
/// A simple alloc-free list of types used for calculating lowered function signatures.
|
|
42
|
+
pub(crate) struct LoweredTypes {
|
|
43
|
+
types: [ValType; MAX_LOWERED_TYPES],
|
|
44
|
+
len: usize,
|
|
45
|
+
max: usize,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
impl LoweredTypes {
|
|
49
|
+
fn new(max: usize) -> Self {
|
|
50
|
+
assert!(max <= MAX_LOWERED_TYPES);
|
|
51
|
+
Self {
|
|
52
|
+
types: [ValType::I32; MAX_LOWERED_TYPES],
|
|
53
|
+
len: 0,
|
|
54
|
+
max,
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fn len(&self) -> usize {
|
|
59
|
+
self.len
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
fn maxed(&self) -> bool {
|
|
63
|
+
self.len == self.max
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
fn get_mut(&mut self, index: usize) -> Option<&mut ValType> {
|
|
67
|
+
if index < self.len {
|
|
68
|
+
Some(&mut self.types[index])
|
|
69
|
+
} else {
|
|
70
|
+
None
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#[track_caller]
|
|
75
|
+
fn assert_push(&mut self, ty: ValType) {
|
|
76
|
+
assert!(self.try_push(ty));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#[must_use = "value is not actually pushed when maxed"]
|
|
80
|
+
fn try_push(&mut self, ty: ValType) -> bool {
|
|
81
|
+
if self.maxed() {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
self.types[self.len] = ty;
|
|
86
|
+
self.len += 1;
|
|
87
|
+
true
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
fn clear(&mut self) {
|
|
91
|
+
self.len = 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
pub fn as_slice(&self) -> &[ValType] {
|
|
95
|
+
&self.types[..self.len]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
pub fn iter(&self) -> impl Iterator<Item = ValType> + '_ {
|
|
99
|
+
self.as_slice().iter().copied()
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
impl fmt::Debug for LoweredTypes {
|
|
104
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
105
|
+
self.as_slice().fmt(f)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// Represents a component function type's in-progress lowering into a core
|
|
110
|
+
/// type.
|
|
111
|
+
#[derive(Debug)]
|
|
112
|
+
struct LoweredSignature {
|
|
113
|
+
params: LoweredTypes,
|
|
114
|
+
results: LoweredTypes,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
impl LoweredSignature {
|
|
118
|
+
pub(crate) fn into_func_type(self) -> FuncType {
|
|
119
|
+
FuncType::new(
|
|
120
|
+
self.params.as_slice().iter().copied(),
|
|
121
|
+
self.results.as_slice().iter().copied(),
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
impl Default for LoweredSignature {
|
|
127
|
+
fn default() -> Self {
|
|
128
|
+
Self {
|
|
129
|
+
params: LoweredTypes::new(MAX_FLAT_FUNC_PARAMS),
|
|
130
|
+
results: LoweredTypes::new(MAX_FLAT_FUNC_RESULTS),
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
impl PrimitiveValType {
|
|
136
|
+
pub(crate) fn lower_gc(
|
|
137
|
+
&self,
|
|
138
|
+
types: &TypeList,
|
|
139
|
+
_abi: Abi,
|
|
140
|
+
options: &CanonicalOptions,
|
|
141
|
+
offset: usize,
|
|
142
|
+
core: ArgOrField,
|
|
143
|
+
) -> Result<()> {
|
|
144
|
+
match (self, core) {
|
|
145
|
+
(
|
|
146
|
+
PrimitiveValType::Bool,
|
|
147
|
+
ArgOrField::Field(StorageType::I8) | ArgOrField::Arg(ValType::I32),
|
|
148
|
+
) => Ok(()),
|
|
149
|
+
(PrimitiveValType::Bool, ArgOrField::Arg(_)) => bail!(
|
|
150
|
+
offset,
|
|
151
|
+
"expected to lower component `bool` type to core `i32` type, found `{core}`"
|
|
152
|
+
),
|
|
153
|
+
(PrimitiveValType::Bool, ArgOrField::Field(_)) => bail!(
|
|
154
|
+
offset,
|
|
155
|
+
"expected to lower component `bool` type to core `i8` type, found `{core}`"
|
|
156
|
+
),
|
|
157
|
+
|
|
158
|
+
(
|
|
159
|
+
PrimitiveValType::S8,
|
|
160
|
+
ArgOrField::Field(StorageType::I8) | ArgOrField::Arg(ValType::I32),
|
|
161
|
+
) => Ok(()),
|
|
162
|
+
(PrimitiveValType::S8, ArgOrField::Arg(_)) => bail!(
|
|
163
|
+
offset,
|
|
164
|
+
"expected to lower component `s8` type to core `i32` type, found `{core}`"
|
|
165
|
+
),
|
|
166
|
+
(PrimitiveValType::S8, ArgOrField::Field(_)) => bail!(
|
|
167
|
+
offset,
|
|
168
|
+
"expected to lower component `s8` type to core `i8` type, found `{core}`"
|
|
169
|
+
),
|
|
170
|
+
|
|
171
|
+
(
|
|
172
|
+
PrimitiveValType::U8,
|
|
173
|
+
ArgOrField::Field(StorageType::I8) | ArgOrField::Arg(ValType::I32),
|
|
174
|
+
) => Ok(()),
|
|
175
|
+
(PrimitiveValType::U8, ArgOrField::Arg(_)) => bail!(
|
|
176
|
+
offset,
|
|
177
|
+
"expected to lower component `u8` type to core `i32` type, found `{core}`"
|
|
178
|
+
),
|
|
179
|
+
(PrimitiveValType::U8, ArgOrField::Field(_)) => bail!(
|
|
180
|
+
offset,
|
|
181
|
+
"expected to lower component `u8` type to core `i8` type, found `{core}`"
|
|
182
|
+
),
|
|
183
|
+
|
|
184
|
+
(
|
|
185
|
+
PrimitiveValType::S16,
|
|
186
|
+
ArgOrField::Field(StorageType::I16) | ArgOrField::Arg(ValType::I32),
|
|
187
|
+
) => Ok(()),
|
|
188
|
+
(PrimitiveValType::S16, ArgOrField::Arg(_)) => bail!(
|
|
189
|
+
offset,
|
|
190
|
+
"expected to lower component `s16` type to core `i32` type, found `{core}`"
|
|
191
|
+
),
|
|
192
|
+
(PrimitiveValType::S16, ArgOrField::Field(_)) => bail!(
|
|
193
|
+
offset,
|
|
194
|
+
"expected to lower component `s16` type to core `i16` type, found `{core}`"
|
|
195
|
+
),
|
|
196
|
+
|
|
197
|
+
(
|
|
198
|
+
PrimitiveValType::U16,
|
|
199
|
+
ArgOrField::Field(StorageType::I16) | ArgOrField::Arg(ValType::I32),
|
|
200
|
+
) => Ok(()),
|
|
201
|
+
(PrimitiveValType::U16, ArgOrField::Arg(_)) => bail!(
|
|
202
|
+
offset,
|
|
203
|
+
"expected to lower component `u16` type to core `i32` type, found `{core}`"
|
|
204
|
+
),
|
|
205
|
+
(PrimitiveValType::U16, ArgOrField::Field(_)) => bail!(
|
|
206
|
+
offset,
|
|
207
|
+
"expected to lower component `u16` type to core `i16` type, found `{core}`"
|
|
208
|
+
),
|
|
209
|
+
|
|
210
|
+
(PrimitiveValType::S32, _) if core.as_val_type() == Some(ValType::I32) => Ok(()),
|
|
211
|
+
(PrimitiveValType::S32, _) => bail!(
|
|
212
|
+
offset,
|
|
213
|
+
"expected to lower component `s32` type to core `i32` type, found `{core}`"
|
|
214
|
+
),
|
|
215
|
+
|
|
216
|
+
(PrimitiveValType::U32, _) if core.as_val_type() == Some(ValType::I32) => Ok(()),
|
|
217
|
+
(PrimitiveValType::U32, _) => bail!(
|
|
218
|
+
offset,
|
|
219
|
+
"expected to lower component `u32` type to core `i32` type, found `{core}`"
|
|
220
|
+
),
|
|
221
|
+
|
|
222
|
+
(PrimitiveValType::S64, _) if core.as_val_type() == Some(ValType::I64) => Ok(()),
|
|
223
|
+
(PrimitiveValType::S64, _) => bail!(
|
|
224
|
+
offset,
|
|
225
|
+
"expected to lower component `s64` type to core `i64` type, found `{core}`"
|
|
226
|
+
),
|
|
227
|
+
|
|
228
|
+
(PrimitiveValType::U64, _) if core.as_val_type() == Some(ValType::I64) => Ok(()),
|
|
229
|
+
(PrimitiveValType::U64, _) => bail!(
|
|
230
|
+
offset,
|
|
231
|
+
"expected to lower component `u64` type to core `i64` type, found `{core}`"
|
|
232
|
+
),
|
|
233
|
+
|
|
234
|
+
(PrimitiveValType::F32, _) if core.as_val_type() == Some(ValType::F32) => Ok(()),
|
|
235
|
+
(PrimitiveValType::F32, _) => bail!(
|
|
236
|
+
offset,
|
|
237
|
+
"expected to lower component `f32` type to core `f32` type, found `{core}`"
|
|
238
|
+
),
|
|
239
|
+
|
|
240
|
+
(PrimitiveValType::F64, _) if core.as_val_type() == Some(ValType::F64) => Ok(()),
|
|
241
|
+
(PrimitiveValType::F64, _) => bail!(
|
|
242
|
+
offset,
|
|
243
|
+
"expected to lower component `f64` type to core `f64` type, found `{core}`"
|
|
244
|
+
),
|
|
245
|
+
|
|
246
|
+
(PrimitiveValType::Char, _) if core.as_val_type() == Some(ValType::I32) => Ok(()),
|
|
247
|
+
(PrimitiveValType::Char, _) => bail!(
|
|
248
|
+
offset,
|
|
249
|
+
"expected to lower component `char` type to core `i32` type, found `{core}`"
|
|
250
|
+
),
|
|
251
|
+
|
|
252
|
+
(PrimitiveValType::String, _) => {
|
|
253
|
+
let type_mismatch_err = || {
|
|
254
|
+
let expected = match options.string_encoding {
|
|
255
|
+
StringEncoding::Utf8 | StringEncoding::CompactUtf16 => {
|
|
256
|
+
"(ref null? (array (mut? i8)))"
|
|
257
|
+
}
|
|
258
|
+
StringEncoding::Utf16 => "(ref null? (array (mut? i16)))",
|
|
259
|
+
};
|
|
260
|
+
bail!(
|
|
261
|
+
offset,
|
|
262
|
+
"expected to lower component `string` type to core `{expected}` \
|
|
263
|
+
type, found `{core}`"
|
|
264
|
+
)
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
match core.as_concrete_ref() {
|
|
268
|
+
Some(id) => match types[id].composite_type.inner {
|
|
269
|
+
CompositeInnerType::Array(ty) => {
|
|
270
|
+
match (options.string_encoding, ty.0.element_type) {
|
|
271
|
+
(
|
|
272
|
+
StringEncoding::Utf8 | StringEncoding::CompactUtf16,
|
|
273
|
+
StorageType::I8,
|
|
274
|
+
)
|
|
275
|
+
| (StringEncoding::Utf16, StorageType::I16) => Ok(()),
|
|
276
|
+
_ => type_mismatch_err(),
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
_ => type_mismatch_err(),
|
|
280
|
+
},
|
|
281
|
+
_ => type_mismatch_err(),
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
(PrimitiveValType::ErrorContext, _) => {
|
|
286
|
+
if let Some(r) = core.as_ref_type() {
|
|
287
|
+
if let HeapType::Abstract {
|
|
288
|
+
shared: _,
|
|
289
|
+
ty: AbstractHeapType::Extern,
|
|
290
|
+
} = r.heap_type()
|
|
291
|
+
{
|
|
292
|
+
return Ok(());
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
bail!(
|
|
296
|
+
offset,
|
|
297
|
+
"expected to lower component `error-context` type into core `(ref null? extern)` type, but \
|
|
298
|
+
found `{core}`",
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
fn push_primitive_wasm_types(ty: &PrimitiveValType, lowered_types: &mut LoweredTypes) -> bool {
|
|
306
|
+
match ty {
|
|
307
|
+
PrimitiveValType::Bool
|
|
308
|
+
| PrimitiveValType::S8
|
|
309
|
+
| PrimitiveValType::U8
|
|
310
|
+
| PrimitiveValType::S16
|
|
311
|
+
| PrimitiveValType::U16
|
|
312
|
+
| PrimitiveValType::S32
|
|
313
|
+
| PrimitiveValType::U32
|
|
314
|
+
| PrimitiveValType::Char
|
|
315
|
+
| PrimitiveValType::ErrorContext => lowered_types.try_push(ValType::I32),
|
|
316
|
+
PrimitiveValType::S64 | PrimitiveValType::U64 => lowered_types.try_push(ValType::I64),
|
|
317
|
+
PrimitiveValType::F32 => lowered_types.try_push(ValType::F32),
|
|
318
|
+
PrimitiveValType::F64 => lowered_types.try_push(ValType::F64),
|
|
319
|
+
PrimitiveValType::String => {
|
|
320
|
+
lowered_types.try_push(ValType::I32) && lowered_types.try_push(ValType::I32)
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/// A type that can be aliased in the component model.
|
|
326
|
+
pub trait Aliasable {
|
|
327
|
+
#[doc(hidden)]
|
|
328
|
+
fn alias_id(&self) -> u32;
|
|
329
|
+
|
|
330
|
+
#[doc(hidden)]
|
|
331
|
+
fn set_alias_id(&mut self, alias_id: u32);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/// A fresh alias id that means the entity is not an alias of anything.
|
|
335
|
+
///
|
|
336
|
+
/// Note that the `TypeList::alias_counter` starts at zero, so we can't use that
|
|
337
|
+
/// as this sentinel. The implementation limits are such that we can't ever
|
|
338
|
+
/// generate `u32::MAX` aliases, so we don't need to worryabout running into
|
|
339
|
+
/// this value in practice either.
|
|
340
|
+
const NO_ALIAS: u32 = u32::MAX;
|
|
341
|
+
|
|
342
|
+
macro_rules! define_wrapper_id {
|
|
343
|
+
(
|
|
344
|
+
$(#[$outer_attrs:meta])*
|
|
345
|
+
pub enum $name:ident {
|
|
346
|
+
$(
|
|
347
|
+
#[unwrap = $unwrap:ident]
|
|
348
|
+
$(#[$inner_attrs:meta])*
|
|
349
|
+
$variant:ident ( $inner:ty ) ,
|
|
350
|
+
)*
|
|
351
|
+
}
|
|
352
|
+
) => {
|
|
353
|
+
$(#[$outer_attrs])*
|
|
354
|
+
pub enum $name {
|
|
355
|
+
$(
|
|
356
|
+
$(#[$inner_attrs])*
|
|
357
|
+
$variant ( $inner ) ,
|
|
358
|
+
)*
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
$(
|
|
362
|
+
impl From<$inner> for $name {
|
|
363
|
+
#[inline]
|
|
364
|
+
fn from(x: $inner) -> Self {
|
|
365
|
+
Self::$variant(x)
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
impl TryFrom<$name> for $inner {
|
|
370
|
+
type Error = ();
|
|
371
|
+
|
|
372
|
+
#[inline]
|
|
373
|
+
fn try_from(x: $name) -> Result<Self, Self::Error> {
|
|
374
|
+
match x {
|
|
375
|
+
$name::$variant(x) => Ok(x),
|
|
376
|
+
_ => Err(())
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
)*
|
|
381
|
+
|
|
382
|
+
impl $name {
|
|
383
|
+
$(
|
|
384
|
+
#[doc = "Unwrap a `"]
|
|
385
|
+
#[doc = stringify!($inner)]
|
|
386
|
+
#[doc = "` or panic."]
|
|
387
|
+
#[inline]
|
|
388
|
+
pub fn $unwrap(self) -> $inner {
|
|
389
|
+
<$inner>::try_from(self).unwrap()
|
|
390
|
+
}
|
|
391
|
+
)*
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
macro_rules! define_transitive_conversions {
|
|
397
|
+
(
|
|
398
|
+
$(
|
|
399
|
+
$outer:ty,
|
|
400
|
+
$middle:ty,
|
|
401
|
+
$inner:ty,
|
|
402
|
+
$unwrap:ident;
|
|
403
|
+
)*
|
|
404
|
+
) => {
|
|
405
|
+
$(
|
|
406
|
+
impl From<$inner> for $outer {
|
|
407
|
+
#[inline]
|
|
408
|
+
fn from(x: $inner) -> Self {
|
|
409
|
+
<$middle>::from(x).into()
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
impl TryFrom<$outer> for $inner {
|
|
414
|
+
type Error = ();
|
|
415
|
+
|
|
416
|
+
#[inline]
|
|
417
|
+
fn try_from(x: $outer) -> Result<Self, Self::Error> {
|
|
418
|
+
let middle = <$middle>::try_from(x)?;
|
|
419
|
+
<$inner>::try_from(middle)
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
impl $outer {
|
|
424
|
+
#[doc = "Unwrap a `"]
|
|
425
|
+
#[doc = stringify!($inner)]
|
|
426
|
+
#[doc = "` or panic."]
|
|
427
|
+
#[inline]
|
|
428
|
+
pub fn $unwrap(self) -> $inner {
|
|
429
|
+
<$inner>::try_from(self).unwrap()
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
)*
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
define_wrapper_id! {
|
|
437
|
+
/// An identifier pointing to any kind of type, component or core.
|
|
438
|
+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
|
439
|
+
pub enum AnyTypeId {
|
|
440
|
+
#[unwrap = unwrap_component_core_type]
|
|
441
|
+
/// A core type.
|
|
442
|
+
Core(ComponentCoreTypeId),
|
|
443
|
+
|
|
444
|
+
#[unwrap = unwrap_component_any_type]
|
|
445
|
+
/// A component type.
|
|
446
|
+
Component(ComponentAnyTypeId),
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
define_transitive_conversions! {
|
|
451
|
+
AnyTypeId, ComponentCoreTypeId, CoreTypeId, unwrap_core_type;
|
|
452
|
+
AnyTypeId, ComponentCoreTypeId, ComponentCoreModuleTypeId, unwrap_component_core_module_type;
|
|
453
|
+
AnyTypeId, ComponentAnyTypeId, AliasableResourceId, unwrap_aliasable_resource;
|
|
454
|
+
AnyTypeId, ComponentAnyTypeId, ComponentDefinedTypeId, unwrap_component_defined_type;
|
|
455
|
+
AnyTypeId, ComponentAnyTypeId, ComponentFuncTypeId, unwrap_component_func_type;
|
|
456
|
+
AnyTypeId, ComponentAnyTypeId, ComponentInstanceTypeId, unwrap_component_instance_type;
|
|
457
|
+
AnyTypeId, ComponentAnyTypeId, ComponentTypeId, unwrap_component_type;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
impl AnyTypeId {
|
|
461
|
+
/// Peel off one layer of aliasing from this type and return the aliased
|
|
462
|
+
/// inner type, or `None` if this type is not aliasing anything.
|
|
463
|
+
pub fn peel_alias(&self, types: &Types) -> Option<Self> {
|
|
464
|
+
match *self {
|
|
465
|
+
Self::Core(id) => id.peel_alias(types).map(Self::Core),
|
|
466
|
+
Self::Component(id) => types.peel_alias(id).map(Self::Component),
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
define_wrapper_id! {
|
|
472
|
+
/// An identifier for a core type or a core module's type.
|
|
473
|
+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
|
474
|
+
pub enum ComponentCoreTypeId {
|
|
475
|
+
#[unwrap = unwrap_sub]
|
|
476
|
+
/// A core type.
|
|
477
|
+
Sub(CoreTypeId),
|
|
478
|
+
|
|
479
|
+
#[unwrap = unwrap_module]
|
|
480
|
+
/// A core module's type.
|
|
481
|
+
Module(ComponentCoreModuleTypeId),
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
impl ComponentCoreTypeId {
|
|
486
|
+
/// Peel off one layer of aliasing from this type and return the aliased
|
|
487
|
+
/// inner type, or `None` if this type is not aliasing anything.
|
|
488
|
+
pub fn peel_alias(&self, types: &Types) -> Option<Self> {
|
|
489
|
+
match *self {
|
|
490
|
+
Self::Sub(_) => None,
|
|
491
|
+
Self::Module(id) => types.peel_alias(id).map(Self::Module),
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/// An aliasable resource identifier.
|
|
497
|
+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
|
498
|
+
pub struct AliasableResourceId {
|
|
499
|
+
id: ResourceId,
|
|
500
|
+
alias_id: u32,
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
impl Aliasable for AliasableResourceId {
|
|
504
|
+
fn alias_id(&self) -> u32 {
|
|
505
|
+
self.alias_id
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
fn set_alias_id(&mut self, alias_id: u32) {
|
|
509
|
+
self.alias_id = alias_id;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
impl AliasableResourceId {
|
|
514
|
+
/// Create a new instance with the specified resource ID and `self`'s alias
|
|
515
|
+
/// ID.
|
|
516
|
+
pub fn with_resource_id(&self, id: ResourceId) -> Self {
|
|
517
|
+
Self {
|
|
518
|
+
id,
|
|
519
|
+
alias_id: self.alias_id,
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/// Get the underlying resource.
|
|
524
|
+
pub fn resource(&self) -> ResourceId {
|
|
525
|
+
self.id
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
pub(crate) fn resource_mut(&mut self) -> &mut ResourceId {
|
|
529
|
+
&mut self.id
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
define_wrapper_id! {
|
|
534
|
+
/// An identifier for any kind of component type.
|
|
535
|
+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
|
536
|
+
pub enum ComponentAnyTypeId {
|
|
537
|
+
#[unwrap = unwrap_resource]
|
|
538
|
+
/// The type is a resource with the specified id.
|
|
539
|
+
Resource(AliasableResourceId),
|
|
540
|
+
|
|
541
|
+
#[unwrap = unwrap_defined]
|
|
542
|
+
/// The type is a defined type with the specified id.
|
|
543
|
+
Defined(ComponentDefinedTypeId),
|
|
544
|
+
|
|
545
|
+
#[unwrap = unwrap_func]
|
|
546
|
+
/// The type is a function type with the specified id.
|
|
547
|
+
Func(ComponentFuncTypeId),
|
|
548
|
+
|
|
549
|
+
#[unwrap = unwrap_instance]
|
|
550
|
+
/// The type is an instance type with the specified id.
|
|
551
|
+
Instance(ComponentInstanceTypeId),
|
|
552
|
+
|
|
553
|
+
#[unwrap = unwrap_component]
|
|
554
|
+
/// The type is a component type with the specified id.
|
|
555
|
+
Component(ComponentTypeId),
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
impl Aliasable for ComponentAnyTypeId {
|
|
560
|
+
fn alias_id(&self) -> u32 {
|
|
561
|
+
match self {
|
|
562
|
+
ComponentAnyTypeId::Resource(x) => x.alias_id(),
|
|
563
|
+
ComponentAnyTypeId::Defined(x) => x.alias_id(),
|
|
564
|
+
ComponentAnyTypeId::Func(x) => x.alias_id(),
|
|
565
|
+
ComponentAnyTypeId::Instance(x) => x.alias_id(),
|
|
566
|
+
ComponentAnyTypeId::Component(x) => x.alias_id(),
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
fn set_alias_id(&mut self, alias_id: u32) {
|
|
571
|
+
match self {
|
|
572
|
+
ComponentAnyTypeId::Resource(x) => x.set_alias_id(alias_id),
|
|
573
|
+
ComponentAnyTypeId::Defined(x) => x.set_alias_id(alias_id),
|
|
574
|
+
ComponentAnyTypeId::Func(x) => x.set_alias_id(alias_id),
|
|
575
|
+
ComponentAnyTypeId::Instance(x) => x.set_alias_id(alias_id),
|
|
576
|
+
ComponentAnyTypeId::Component(x) => x.set_alias_id(alias_id),
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
impl ComponentAnyTypeId {
|
|
582
|
+
pub(crate) fn info(&self, types: &TypeList) -> TypeInfo {
|
|
583
|
+
match *self {
|
|
584
|
+
Self::Resource(_) => TypeInfo::new(),
|
|
585
|
+
Self::Defined(id) => types[id].type_info(types),
|
|
586
|
+
Self::Func(id) => types[id].type_info(types),
|
|
587
|
+
Self::Instance(id) => types[id].type_info(types),
|
|
588
|
+
Self::Component(id) => types[id].type_info(types),
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
pub(crate) fn desc(&self) -> &'static str {
|
|
593
|
+
match self {
|
|
594
|
+
Self::Resource(_) => "resource",
|
|
595
|
+
Self::Defined(_) => "defined type",
|
|
596
|
+
Self::Func(_) => "func",
|
|
597
|
+
Self::Instance(_) => "instance",
|
|
598
|
+
Self::Component(_) => "component",
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
macro_rules! define_type_id {
|
|
604
|
+
($name:ident $($rest:tt)*) => {
|
|
605
|
+
super::types::define_type_id!($name $($rest)*);
|
|
606
|
+
|
|
607
|
+
impl Aliasable for $name {
|
|
608
|
+
fn alias_id(&self) -> u32 {
|
|
609
|
+
NO_ALIAS
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
fn set_alias_id(&mut self, _: u32) {}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
define_type_id!(
|
|
618
|
+
ComponentTypeId,
|
|
619
|
+
ComponentType,
|
|
620
|
+
component.components,
|
|
621
|
+
"component"
|
|
622
|
+
);
|
|
623
|
+
|
|
624
|
+
define_type_id!(
|
|
625
|
+
ComponentValueTypeId,
|
|
626
|
+
ComponentValType,
|
|
627
|
+
component.component_values,
|
|
628
|
+
"component value"
|
|
629
|
+
);
|
|
630
|
+
|
|
631
|
+
define_type_id!(
|
|
632
|
+
ComponentInstanceTypeId,
|
|
633
|
+
ComponentInstanceType,
|
|
634
|
+
component.component_instances,
|
|
635
|
+
"component instance"
|
|
636
|
+
);
|
|
637
|
+
|
|
638
|
+
define_type_id!(
|
|
639
|
+
ComponentFuncTypeId,
|
|
640
|
+
ComponentFuncType,
|
|
641
|
+
component.component_funcs,
|
|
642
|
+
"component function"
|
|
643
|
+
);
|
|
644
|
+
|
|
645
|
+
define_type_id!(
|
|
646
|
+
ComponentCoreInstanceTypeId,
|
|
647
|
+
InstanceType,
|
|
648
|
+
component.core_instances,
|
|
649
|
+
"component's core instance"
|
|
650
|
+
);
|
|
651
|
+
|
|
652
|
+
define_type_id!(
|
|
653
|
+
ComponentCoreModuleTypeId,
|
|
654
|
+
ModuleType,
|
|
655
|
+
component.core_modules,
|
|
656
|
+
"component's core module"
|
|
657
|
+
);
|
|
658
|
+
|
|
659
|
+
/// Represents a unique identifier for a component type type known to a
|
|
660
|
+
/// [`crate::Validator`].
|
|
661
|
+
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
662
|
+
#[repr(C)]
|
|
663
|
+
pub struct ComponentDefinedTypeId {
|
|
664
|
+
index: u32,
|
|
665
|
+
alias_id: u32,
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
#[test]
|
|
669
|
+
fn assert_defined_type_small() {
|
|
670
|
+
assert!(core::mem::size_of::<ComponentDefinedTypeId>() <= 8);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
impl TypeIdentifier for ComponentDefinedTypeId {
|
|
674
|
+
type Data = ComponentDefinedType;
|
|
675
|
+
|
|
676
|
+
fn from_index(index: u32) -> Self {
|
|
677
|
+
ComponentDefinedTypeId {
|
|
678
|
+
index,
|
|
679
|
+
alias_id: NO_ALIAS,
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
fn list(types: &TypeList) -> &SnapshotList<Self::Data> {
|
|
684
|
+
&types.component.component_defined_types
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
fn list_mut(types: &mut TypeList) -> &mut SnapshotList<Self::Data> {
|
|
688
|
+
&mut types.component.component_defined_types
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
fn index(&self) -> usize {
|
|
692
|
+
usize::try_from(self.index).unwrap()
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
impl Aliasable for ComponentDefinedTypeId {
|
|
697
|
+
fn alias_id(&self) -> u32 {
|
|
698
|
+
self.alias_id
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
fn set_alias_id(&mut self, alias_id: u32) {
|
|
702
|
+
self.alias_id = alias_id;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/// A component value type.
|
|
707
|
+
#[derive(Debug, Clone, Copy)]
|
|
708
|
+
pub enum ComponentValType {
|
|
709
|
+
/// The value type is one of the primitive types.
|
|
710
|
+
Primitive(PrimitiveValType),
|
|
711
|
+
/// The type is represented with the given type identifier.
|
|
712
|
+
Type(ComponentDefinedTypeId),
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
impl TypeData for ComponentValType {
|
|
716
|
+
type Id = ComponentValueTypeId;
|
|
717
|
+
const IS_CORE_SUB_TYPE: bool = false;
|
|
718
|
+
fn type_info(&self, types: &TypeList) -> TypeInfo {
|
|
719
|
+
match self {
|
|
720
|
+
ComponentValType::Primitive(_) => TypeInfo::new(),
|
|
721
|
+
ComponentValType::Type(id) => types[*id].type_info(types),
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
impl ComponentValType {
|
|
727
|
+
pub(crate) fn contains_ptr(&self, types: &TypeList) -> bool {
|
|
728
|
+
match self {
|
|
729
|
+
ComponentValType::Primitive(ty) => ty.contains_ptr(),
|
|
730
|
+
ComponentValType::Type(ty) => types[*ty].contains_ptr(types),
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
fn push_wasm_types(&self, types: &TypeList, lowered_types: &mut LoweredTypes) -> bool {
|
|
735
|
+
match self {
|
|
736
|
+
Self::Primitive(ty) => push_primitive_wasm_types(ty, lowered_types),
|
|
737
|
+
Self::Type(id) => types[*id].push_wasm_types(types, lowered_types),
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
pub(crate) fn info(&self, types: &TypeList) -> TypeInfo {
|
|
742
|
+
match self {
|
|
743
|
+
Self::Primitive(_) => TypeInfo::new(),
|
|
744
|
+
Self::Type(id) => types[*id].type_info(types),
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
fn lower_gc(
|
|
749
|
+
&self,
|
|
750
|
+
types: &TypeList,
|
|
751
|
+
abi: Abi,
|
|
752
|
+
options: &CanonicalOptions,
|
|
753
|
+
offset: usize,
|
|
754
|
+
core: ArgOrField,
|
|
755
|
+
) -> Result<()> {
|
|
756
|
+
match self {
|
|
757
|
+
ComponentValType::Primitive(ty) => ty.lower_gc(types, abi, options, offset, core),
|
|
758
|
+
ComponentValType::Type(ty) => types[*ty].lower_gc(types, abi, options, offset, core),
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
trait ModuleImportKey {
|
|
764
|
+
fn module(&self) -> &str;
|
|
765
|
+
fn name(&self) -> &str;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
impl<'a> Borrow<dyn ModuleImportKey + 'a> for (String, String) {
|
|
769
|
+
fn borrow(&self) -> &(dyn ModuleImportKey + 'a) {
|
|
770
|
+
self
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
impl Hash for dyn ModuleImportKey + '_ {
|
|
775
|
+
fn hash<H: Hasher>(&self, state: &mut H) {
|
|
776
|
+
self.module().hash(state);
|
|
777
|
+
self.name().hash(state);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
impl PartialEq for dyn ModuleImportKey + '_ {
|
|
782
|
+
fn eq(&self, other: &Self) -> bool {
|
|
783
|
+
self.module() == other.module() && self.name() == other.name()
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
impl Eq for dyn ModuleImportKey + '_ {}
|
|
788
|
+
|
|
789
|
+
impl Ord for dyn ModuleImportKey + '_ {
|
|
790
|
+
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
|
|
791
|
+
match self.module().cmp(other.module()) {
|
|
792
|
+
core::cmp::Ordering::Equal => (),
|
|
793
|
+
order => return order,
|
|
794
|
+
};
|
|
795
|
+
self.name().cmp(other.name())
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
impl PartialOrd for dyn ModuleImportKey + '_ {
|
|
800
|
+
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
|
|
801
|
+
Some(self.cmp(other))
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
impl ModuleImportKey for (String, String) {
|
|
806
|
+
fn module(&self) -> &str {
|
|
807
|
+
&self.0
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
fn name(&self) -> &str {
|
|
811
|
+
&self.1
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
impl ModuleImportKey for (&str, &str) {
|
|
816
|
+
fn module(&self) -> &str {
|
|
817
|
+
self.0
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
fn name(&self) -> &str {
|
|
821
|
+
self.1
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/// Represents a core module type.
|
|
826
|
+
#[derive(Debug, Clone)]
|
|
827
|
+
pub struct ModuleType {
|
|
828
|
+
/// Metadata about this module type
|
|
829
|
+
pub(crate) info: TypeInfo,
|
|
830
|
+
/// The imports of the module type.
|
|
831
|
+
pub imports: IndexMap<(String, String), EntityType>,
|
|
832
|
+
/// The exports of the module type.
|
|
833
|
+
pub exports: IndexMap<String, EntityType>,
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
impl TypeData for ModuleType {
|
|
837
|
+
type Id = ComponentCoreModuleTypeId;
|
|
838
|
+
const IS_CORE_SUB_TYPE: bool = false;
|
|
839
|
+
fn type_info(&self, _types: &TypeList) -> TypeInfo {
|
|
840
|
+
self.info
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
impl ModuleType {
|
|
845
|
+
/// Looks up an import by its module and name.
|
|
846
|
+
///
|
|
847
|
+
/// Returns `None` if the import was not found.
|
|
848
|
+
pub fn lookup_import(&self, module: &str, name: &str) -> Option<&EntityType> {
|
|
849
|
+
self.imports.get(&(module, name) as &dyn ModuleImportKey)
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/// Represents the kind of module instance type.
|
|
854
|
+
#[derive(Debug, Clone)]
|
|
855
|
+
pub enum CoreInstanceTypeKind {
|
|
856
|
+
/// The instance type is the result of instantiating a module type.
|
|
857
|
+
Instantiated(ComponentCoreModuleTypeId),
|
|
858
|
+
|
|
859
|
+
/// The instance type is the result of instantiating from exported items.
|
|
860
|
+
Exports(IndexMap<String, EntityType>),
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/// Represents a module instance type.
|
|
864
|
+
#[derive(Debug, Clone)]
|
|
865
|
+
pub struct InstanceType {
|
|
866
|
+
/// Metadata about this instance type
|
|
867
|
+
pub(crate) info: TypeInfo,
|
|
868
|
+
/// The kind of module instance type.
|
|
869
|
+
pub kind: CoreInstanceTypeKind,
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
impl TypeData for InstanceType {
|
|
873
|
+
type Id = ComponentCoreInstanceTypeId;
|
|
874
|
+
const IS_CORE_SUB_TYPE: bool = false;
|
|
875
|
+
fn type_info(&self, _types: &TypeList) -> TypeInfo {
|
|
876
|
+
self.info
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
impl InstanceType {
|
|
881
|
+
/// Gets the exports of the instance type.
|
|
882
|
+
pub fn exports<'a>(&'a self, types: TypesRef<'a>) -> &'a IndexMap<String, EntityType> {
|
|
883
|
+
self.internal_exports(types.list)
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
pub(crate) fn internal_exports<'a>(
|
|
887
|
+
&'a self,
|
|
888
|
+
types: &'a TypeList,
|
|
889
|
+
) -> &'a IndexMap<String, EntityType> {
|
|
890
|
+
match &self.kind {
|
|
891
|
+
CoreInstanceTypeKind::Instantiated(id) => &types[*id].exports,
|
|
892
|
+
CoreInstanceTypeKind::Exports(exports) => exports,
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/// The entity type for imports and exports of a component.
|
|
898
|
+
#[derive(Debug, Clone, Copy)]
|
|
899
|
+
pub enum ComponentEntityType {
|
|
900
|
+
/// The entity is a core module.
|
|
901
|
+
Module(ComponentCoreModuleTypeId),
|
|
902
|
+
/// The entity is a function.
|
|
903
|
+
Func(ComponentFuncTypeId),
|
|
904
|
+
/// The entity is a value.
|
|
905
|
+
Value(ComponentValType),
|
|
906
|
+
/// The entity is a type.
|
|
907
|
+
Type {
|
|
908
|
+
/// This is the identifier of the type that was referenced when this
|
|
909
|
+
/// entity was created.
|
|
910
|
+
referenced: ComponentAnyTypeId,
|
|
911
|
+
/// This is the identifier of the type that was created when this type
|
|
912
|
+
/// was imported or exported from the component.
|
|
913
|
+
///
|
|
914
|
+
/// Note that the underlying type information for the `referenced`
|
|
915
|
+
/// field and for this `created` field is the same, but these two types
|
|
916
|
+
/// will hash to different values.
|
|
917
|
+
created: ComponentAnyTypeId,
|
|
918
|
+
},
|
|
919
|
+
/// The entity is a component instance.
|
|
920
|
+
Instance(ComponentInstanceTypeId),
|
|
921
|
+
/// The entity is a component.
|
|
922
|
+
Component(ComponentTypeId),
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
impl ComponentEntityType {
|
|
926
|
+
/// Determines if component entity type `a` is a subtype of `b`.
|
|
927
|
+
///
|
|
928
|
+
/// # Panics
|
|
929
|
+
///
|
|
930
|
+
/// Panics if the two given `TypesRef`s are not associated with the same
|
|
931
|
+
/// `Validator`.
|
|
932
|
+
pub fn is_subtype_of(a: &Self, at: TypesRef<'_>, b: &Self, bt: TypesRef<'_>) -> bool {
|
|
933
|
+
assert_eq!(at.id(), bt.id());
|
|
934
|
+
SubtypeCx::new(at.list, bt.list)
|
|
935
|
+
.component_entity_type(a, b, 0)
|
|
936
|
+
.is_ok()
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
pub(crate) fn desc(&self) -> &'static str {
|
|
940
|
+
match self {
|
|
941
|
+
Self::Module(_) => "module",
|
|
942
|
+
Self::Func(_) => "func",
|
|
943
|
+
Self::Value(_) => "value",
|
|
944
|
+
Self::Type { .. } => "type",
|
|
945
|
+
Self::Instance(_) => "instance",
|
|
946
|
+
Self::Component(_) => "component",
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
pub(crate) fn info(&self, types: &TypeList) -> TypeInfo {
|
|
951
|
+
match self {
|
|
952
|
+
Self::Module(ty) => types[*ty].type_info(types),
|
|
953
|
+
Self::Func(ty) => types[*ty].type_info(types),
|
|
954
|
+
Self::Type { referenced: ty, .. } => ty.info(types),
|
|
955
|
+
Self::Instance(ty) => types[*ty].type_info(types),
|
|
956
|
+
Self::Component(ty) => types[*ty].type_info(types),
|
|
957
|
+
Self::Value(ty) => ty.info(types),
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/// Represents a type of a component.
|
|
963
|
+
#[derive(Debug, Clone)]
|
|
964
|
+
pub struct ComponentType {
|
|
965
|
+
/// Metadata about this component type
|
|
966
|
+
pub(crate) info: TypeInfo,
|
|
967
|
+
|
|
968
|
+
/// The imports of the component type.
|
|
969
|
+
///
|
|
970
|
+
/// Each import has its own kebab-name and an optional URL listed. Note that
|
|
971
|
+
/// the set of import names is disjoint with the set of export names.
|
|
972
|
+
pub imports: IndexMap<String, ComponentEntityType>,
|
|
973
|
+
|
|
974
|
+
/// The exports of the component type.
|
|
975
|
+
///
|
|
976
|
+
/// Each export has its own kebab-name and an optional URL listed. Note that
|
|
977
|
+
/// the set of export names is disjoint with the set of import names.
|
|
978
|
+
pub exports: IndexMap<String, ComponentEntityType>,
|
|
979
|
+
|
|
980
|
+
/// Universally quantified resources required to be provided when
|
|
981
|
+
/// instantiating this component type.
|
|
982
|
+
///
|
|
983
|
+
/// Each resource in this map is explicitly imported somewhere in the
|
|
984
|
+
/// `imports` map. The "path" to where it's imported is specified by the
|
|
985
|
+
/// `Vec<usize>` payload here. For more information about the indexes see
|
|
986
|
+
/// the documentation on `ComponentState::imported_resources`.
|
|
987
|
+
///
|
|
988
|
+
/// This should technically be inferable from the structure of `imports`,
|
|
989
|
+
/// but it's stored as an auxiliary set for subtype checking and
|
|
990
|
+
/// instantiation.
|
|
991
|
+
///
|
|
992
|
+
/// Note that this is not a set of all resources referred to by the
|
|
993
|
+
/// `imports`. Instead it's only those created, relative to the internals of
|
|
994
|
+
/// this component, by the imports.
|
|
995
|
+
pub imported_resources: Vec<(ResourceId, Vec<usize>)>,
|
|
996
|
+
|
|
997
|
+
/// The dual of the `imported_resources`, or the set of defined
|
|
998
|
+
/// resources -- those created through the instantiation process which are
|
|
999
|
+
/// unique to this component.
|
|
1000
|
+
///
|
|
1001
|
+
/// This set is similar to the `imported_resources` set but it's those
|
|
1002
|
+
/// contained within the `exports`. Instantiating this component will
|
|
1003
|
+
/// create fresh new versions of all of these resources. The path here is
|
|
1004
|
+
/// within the `exports` array.
|
|
1005
|
+
pub defined_resources: Vec<(ResourceId, Vec<usize>)>,
|
|
1006
|
+
|
|
1007
|
+
/// The set of all resources which are explicitly exported by this
|
|
1008
|
+
/// component, and where they're exported.
|
|
1009
|
+
///
|
|
1010
|
+
/// This mapping is stored separately from `defined_resources` to ensure
|
|
1011
|
+
/// that it contains all exported resources, not just those which are
|
|
1012
|
+
/// defined. That means that this can cover reexports of imported
|
|
1013
|
+
/// resources, exports of local resources, or exports of closed-over
|
|
1014
|
+
/// resources for example.
|
|
1015
|
+
pub explicit_resources: IndexMap<ResourceId, Vec<usize>>,
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
impl TypeData for ComponentType {
|
|
1019
|
+
type Id = ComponentTypeId;
|
|
1020
|
+
const IS_CORE_SUB_TYPE: bool = false;
|
|
1021
|
+
fn type_info(&self, _types: &TypeList) -> TypeInfo {
|
|
1022
|
+
self.info
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/// Represents a type of a component instance.
|
|
1027
|
+
#[derive(Debug, Clone)]
|
|
1028
|
+
pub struct ComponentInstanceType {
|
|
1029
|
+
/// Metadata about this instance type
|
|
1030
|
+
pub(crate) info: TypeInfo,
|
|
1031
|
+
|
|
1032
|
+
/// The list of exports, keyed by name, that this instance has.
|
|
1033
|
+
///
|
|
1034
|
+
/// An optional URL and type of each export is provided as well.
|
|
1035
|
+
pub exports: IndexMap<String, ComponentEntityType>,
|
|
1036
|
+
|
|
1037
|
+
/// The list of "defined resources" or those which are closed over in
|
|
1038
|
+
/// this instance type.
|
|
1039
|
+
///
|
|
1040
|
+
/// This list is populated, for example, when the type of an instance is
|
|
1041
|
+
/// declared and it contains its own resource type exports defined
|
|
1042
|
+
/// internally. For example:
|
|
1043
|
+
///
|
|
1044
|
+
/// ```wasm
|
|
1045
|
+
/// (component
|
|
1046
|
+
/// (type (instance
|
|
1047
|
+
/// (export "x" (type sub resource)) ;; one `defined_resources` entry
|
|
1048
|
+
/// ))
|
|
1049
|
+
/// )
|
|
1050
|
+
/// ```
|
|
1051
|
+
///
|
|
1052
|
+
/// This list is also a bit of an oddity, however, because the type of a
|
|
1053
|
+
/// concrete instance will always have this as empty. For example:
|
|
1054
|
+
///
|
|
1055
|
+
/// ```wasm
|
|
1056
|
+
/// (component
|
|
1057
|
+
/// (type $t (instance (export "x" (type sub resource))))
|
|
1058
|
+
///
|
|
1059
|
+
/// ;; the type of this instance has no defined resources
|
|
1060
|
+
/// (import "i" (instance (type $t)))
|
|
1061
|
+
/// )
|
|
1062
|
+
/// ```
|
|
1063
|
+
///
|
|
1064
|
+
/// This list ends up only being populated for instance types declared in a
|
|
1065
|
+
/// module which aren't yet "attached" to anything. Once something is
|
|
1066
|
+
/// instantiated, imported, exported, or otherwise refers to a concrete
|
|
1067
|
+
/// instance then this list is always empty. For concrete instances
|
|
1068
|
+
/// defined resources are tracked in the component state or component type.
|
|
1069
|
+
pub defined_resources: Vec<ResourceId>,
|
|
1070
|
+
|
|
1071
|
+
/// The list of all resources that are explicitly exported from this
|
|
1072
|
+
/// instance type along with the path they're exported at.
|
|
1073
|
+
pub explicit_resources: IndexMap<ResourceId, Vec<usize>>,
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
impl TypeData for ComponentInstanceType {
|
|
1077
|
+
type Id = ComponentInstanceTypeId;
|
|
1078
|
+
const IS_CORE_SUB_TYPE: bool = false;
|
|
1079
|
+
fn type_info(&self, _types: &TypeList) -> TypeInfo {
|
|
1080
|
+
self.info
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/// Represents a type of a component function.
|
|
1085
|
+
#[derive(Debug, Clone)]
|
|
1086
|
+
pub struct ComponentFuncType {
|
|
1087
|
+
/// Metadata about this function type.
|
|
1088
|
+
pub(crate) info: TypeInfo,
|
|
1089
|
+
/// Whether or not this is an async function.
|
|
1090
|
+
pub async_: bool,
|
|
1091
|
+
/// The function parameters.
|
|
1092
|
+
pub params: Box<[(KebabString, ComponentValType)]>,
|
|
1093
|
+
/// The function's result.
|
|
1094
|
+
pub result: Option<ComponentValType>,
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
impl TypeData for ComponentFuncType {
|
|
1098
|
+
type Id = ComponentFuncTypeId;
|
|
1099
|
+
const IS_CORE_SUB_TYPE: bool = false;
|
|
1100
|
+
fn type_info(&self, _types: &TypeList) -> TypeInfo {
|
|
1101
|
+
self.info
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
|
1106
|
+
pub(crate) enum Abi {
|
|
1107
|
+
Lift,
|
|
1108
|
+
Lower,
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
impl Abi {
|
|
1112
|
+
fn invert(&self) -> Self {
|
|
1113
|
+
match self {
|
|
1114
|
+
Abi::Lift => Abi::Lower,
|
|
1115
|
+
Abi::Lower => Abi::Lift,
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
|
1121
|
+
pub(crate) enum ArgOrField {
|
|
1122
|
+
/// Lifting to, or lowering from, an argument value.
|
|
1123
|
+
Arg(ValType),
|
|
1124
|
+
/// Lifting to, or lowering from, a struct field or array element.
|
|
1125
|
+
Field(StorageType),
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
impl From<ValType> for ArgOrField {
|
|
1129
|
+
fn from(v: ValType) -> Self {
|
|
1130
|
+
Self::Arg(v)
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
impl From<StorageType> for ArgOrField {
|
|
1135
|
+
fn from(v: StorageType) -> Self {
|
|
1136
|
+
Self::Field(v)
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
impl core::fmt::Display for ArgOrField {
|
|
1141
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
1142
|
+
match self {
|
|
1143
|
+
ArgOrField::Arg(ty) => core::fmt::Display::fmt(ty, f),
|
|
1144
|
+
ArgOrField::Field(ty) => core::fmt::Display::fmt(ty, f),
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
impl ArgOrField {
|
|
1150
|
+
pub(crate) fn as_val_type(self) -> Option<ValType> {
|
|
1151
|
+
match self {
|
|
1152
|
+
ArgOrField::Arg(ty) | ArgOrField::Field(StorageType::Val(ty)) => Some(ty),
|
|
1153
|
+
_ => None,
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
pub(crate) fn as_ref_type(self) -> Option<RefType> {
|
|
1158
|
+
self.as_val_type()?.as_reference_type()
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
pub(crate) fn as_concrete_ref(self) -> Option<CoreTypeId> {
|
|
1162
|
+
match self.as_ref_type()?.heap_type() {
|
|
1163
|
+
HeapType::Abstract { .. } => None,
|
|
1164
|
+
HeapType::Concrete(idx) | HeapType::Exact(idx) => {
|
|
1165
|
+
let id = idx
|
|
1166
|
+
.as_core_type_id()
|
|
1167
|
+
.expect("validation only sees core type ids");
|
|
1168
|
+
Some(id)
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
pub(crate) enum LoweredFuncType {
|
|
1175
|
+
New(FuncType),
|
|
1176
|
+
Existing(CoreTypeId),
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
impl LoweredFuncType {
|
|
1180
|
+
pub(crate) fn intern(self, types: &mut TypeAlloc, offset: usize) -> CoreTypeId {
|
|
1181
|
+
match self {
|
|
1182
|
+
LoweredFuncType::New(ty) => types.intern_func_type(ty, offset),
|
|
1183
|
+
LoweredFuncType::Existing(id) => id,
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
impl ComponentFuncType {
|
|
1189
|
+
/// Lowers the component function type to core parameter and result types for the
|
|
1190
|
+
/// canonical ABI.
|
|
1191
|
+
pub(crate) fn lower(
|
|
1192
|
+
&self,
|
|
1193
|
+
types: &TypeList,
|
|
1194
|
+
options: &CanonicalOptions,
|
|
1195
|
+
abi: Abi,
|
|
1196
|
+
offset: usize,
|
|
1197
|
+
) -> Result<LoweredFuncType> {
|
|
1198
|
+
let mut sig = LoweredSignature::default();
|
|
1199
|
+
|
|
1200
|
+
if options.gc {
|
|
1201
|
+
return self.lower_gc(types, abi, options, offset);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
if abi == Abi::Lower && options.concurrency.is_async() {
|
|
1205
|
+
sig.params.max = MAX_FLAT_ASYNC_PARAMS;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
for (_, ty) in self.params.iter() {
|
|
1209
|
+
// Check to see if `ty` has a pointer somewhere in it, needed for
|
|
1210
|
+
// any type that transitively contains either a string or a list.
|
|
1211
|
+
// In this situation lowered functions must specify `memory`, and
|
|
1212
|
+
// lifted functions must specify `realloc` as well. Lifted functions
|
|
1213
|
+
// gain their memory requirement through the final clause of this
|
|
1214
|
+
// function.
|
|
1215
|
+
match abi {
|
|
1216
|
+
Abi::Lower => {
|
|
1217
|
+
options.require_memory_if(offset, || ty.contains_ptr(types))?;
|
|
1218
|
+
}
|
|
1219
|
+
Abi::Lift => {
|
|
1220
|
+
options.require_realloc_if(offset, || ty.contains_ptr(types))?;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
if !ty.push_wasm_types(types, &mut sig.params) {
|
|
1225
|
+
// Too many parameters to pass directly
|
|
1226
|
+
// Function will have a single pointer parameter to pass the arguments
|
|
1227
|
+
// via linear memory
|
|
1228
|
+
sig.params.clear();
|
|
1229
|
+
assert!(sig.params.try_push(ValType::I32));
|
|
1230
|
+
options.require_memory(offset)?;
|
|
1231
|
+
|
|
1232
|
+
// We need realloc as well when lifting a function
|
|
1233
|
+
if let Abi::Lift = abi {
|
|
1234
|
+
options.require_realloc(offset)?;
|
|
1235
|
+
}
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
match (abi, options.concurrency) {
|
|
1241
|
+
(Abi::Lower | Abi::Lift, Concurrency::Sync) => {
|
|
1242
|
+
if let Some(ty) = &self.result {
|
|
1243
|
+
// Results of lowered functions that contains pointers must be
|
|
1244
|
+
// allocated by the callee meaning that realloc is required.
|
|
1245
|
+
// Results of lifted function are allocated by the guest which
|
|
1246
|
+
// means that no realloc option is necessary.
|
|
1247
|
+
options.require_realloc_if(offset, || {
|
|
1248
|
+
abi == Abi::Lower && ty.contains_ptr(types)
|
|
1249
|
+
})?;
|
|
1250
|
+
|
|
1251
|
+
if !ty.push_wasm_types(types, &mut sig.results) {
|
|
1252
|
+
// Too many results to return directly, either a retptr
|
|
1253
|
+
// parameter will be used (import) or a single pointer
|
|
1254
|
+
// will be returned (export).
|
|
1255
|
+
sig.results.clear();
|
|
1256
|
+
options.require_memory(offset)?;
|
|
1257
|
+
match abi {
|
|
1258
|
+
Abi::Lower => {
|
|
1259
|
+
sig.params.max = MAX_LOWERED_TYPES;
|
|
1260
|
+
assert!(sig.params.try_push(ValType::I32));
|
|
1261
|
+
}
|
|
1262
|
+
Abi::Lift => {
|
|
1263
|
+
assert!(sig.results.try_push(ValType::I32));
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
(Abi::Lower, Concurrency::Async { callback: _ }) => {
|
|
1270
|
+
if self.result.is_some() {
|
|
1271
|
+
sig.params.max = MAX_LOWERED_TYPES;
|
|
1272
|
+
sig.params.assert_push(ValType::I32);
|
|
1273
|
+
options.require_memory(offset)?;
|
|
1274
|
+
}
|
|
1275
|
+
sig.results.assert_push(ValType::I32);
|
|
1276
|
+
}
|
|
1277
|
+
(Abi::Lift, Concurrency::Async { callback }) => {
|
|
1278
|
+
if let Some(ty) = &self.result {
|
|
1279
|
+
// The result of an async lift will be returned via a call
|
|
1280
|
+
// to `task.return` rather than the lifted function itself.
|
|
1281
|
+
// Here we require a memory if either the return type
|
|
1282
|
+
// contains a pointer or has a flattened form that exceeds
|
|
1283
|
+
// `MAX_FLAT_FUNC_PARAMS`.
|
|
1284
|
+
//
|
|
1285
|
+
// Note that the return type itself has no effect on the
|
|
1286
|
+
// expected core signature of the lifted function.
|
|
1287
|
+
|
|
1288
|
+
let overflow =
|
|
1289
|
+
!ty.push_wasm_types(types, &mut LoweredTypes::new(MAX_FLAT_FUNC_PARAMS));
|
|
1290
|
+
|
|
1291
|
+
options.require_memory_if(offset, || overflow || ty.contains_ptr(types))?;
|
|
1292
|
+
}
|
|
1293
|
+
if callback.is_some() {
|
|
1294
|
+
sig.results.assert_push(ValType::I32);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
Ok(LoweredFuncType::New(sig.into_func_type()))
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
fn lower_gc(
|
|
1303
|
+
&self,
|
|
1304
|
+
types: &TypeList,
|
|
1305
|
+
abi: Abi,
|
|
1306
|
+
options: &CanonicalOptions,
|
|
1307
|
+
offset: usize,
|
|
1308
|
+
) -> Result<LoweredFuncType> {
|
|
1309
|
+
let core_type_id = options.core_type.unwrap();
|
|
1310
|
+
let core_func_ty = types[core_type_id].unwrap_func();
|
|
1311
|
+
|
|
1312
|
+
ensure!(
|
|
1313
|
+
core_func_ty.params().len() == self.params.len(),
|
|
1314
|
+
offset,
|
|
1315
|
+
"declared `core-type` has {} parameters, but component function has {} parameters",
|
|
1316
|
+
core_func_ty.params().len(),
|
|
1317
|
+
self.params.len(),
|
|
1318
|
+
);
|
|
1319
|
+
for (core, (_name, comp)) in core_func_ty.params().iter().zip(self.params.iter()) {
|
|
1320
|
+
comp.lower_gc(types, abi.invert(), options, offset, (*core).into())?;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
ensure!(
|
|
1324
|
+
core_func_ty.results().len() == usize::from(self.result.is_some()),
|
|
1325
|
+
offset,
|
|
1326
|
+
"declared `core-type` has {} results, but component function has {} results",
|
|
1327
|
+
core_func_ty.results().len(),
|
|
1328
|
+
usize::from(self.result.is_some()),
|
|
1329
|
+
);
|
|
1330
|
+
if let Some(result) = self.result {
|
|
1331
|
+
result.lower_gc(
|
|
1332
|
+
types,
|
|
1333
|
+
abi,
|
|
1334
|
+
options,
|
|
1335
|
+
offset,
|
|
1336
|
+
core_func_ty.results()[0].into(),
|
|
1337
|
+
)?;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
Ok(LoweredFuncType::Existing(core_type_id))
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
/// Represents a variant case.
|
|
1345
|
+
#[derive(Debug, Clone)]
|
|
1346
|
+
pub struct VariantCase {
|
|
1347
|
+
/// The variant case type.
|
|
1348
|
+
pub ty: Option<ComponentValType>,
|
|
1349
|
+
/// The name of the variant case refined by this one.
|
|
1350
|
+
pub refines: Option<KebabString>,
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
/// Represents a record type.
|
|
1354
|
+
#[derive(Debug, Clone)]
|
|
1355
|
+
pub struct RecordType {
|
|
1356
|
+
/// Metadata about this record type.
|
|
1357
|
+
pub(crate) info: TypeInfo,
|
|
1358
|
+
/// The map of record fields.
|
|
1359
|
+
pub fields: IndexMap<KebabString, ComponentValType>,
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
impl RecordType {
|
|
1363
|
+
fn lower_gc(
|
|
1364
|
+
&self,
|
|
1365
|
+
types: &TypeList,
|
|
1366
|
+
abi: Abi,
|
|
1367
|
+
options: &CanonicalOptions,
|
|
1368
|
+
offset: usize,
|
|
1369
|
+
core: ArgOrField,
|
|
1370
|
+
) -> Result<()> {
|
|
1371
|
+
lower_gc_product_type(
|
|
1372
|
+
self.fields.values(),
|
|
1373
|
+
types,
|
|
1374
|
+
abi,
|
|
1375
|
+
options,
|
|
1376
|
+
offset,
|
|
1377
|
+
core,
|
|
1378
|
+
"record",
|
|
1379
|
+
)
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
/// Represents a variant type.
|
|
1384
|
+
#[derive(Debug, Clone)]
|
|
1385
|
+
pub struct VariantType {
|
|
1386
|
+
/// Metadata about this variant type.
|
|
1387
|
+
pub(crate) info: TypeInfo,
|
|
1388
|
+
/// The map of variant cases.
|
|
1389
|
+
pub cases: IndexMap<KebabString, VariantCase>,
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
impl VariantType {
|
|
1393
|
+
fn lower_gc(
|
|
1394
|
+
&self,
|
|
1395
|
+
types: &TypeList,
|
|
1396
|
+
abi: Abi,
|
|
1397
|
+
options: &CanonicalOptions,
|
|
1398
|
+
offset: usize,
|
|
1399
|
+
core: ArgOrField,
|
|
1400
|
+
) -> Result<()> {
|
|
1401
|
+
lower_gc_sum_type(types, abi, options, offset, core, "variant")
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/// Common helper for lowering sum types (variants, options, and results) to
|
|
1406
|
+
/// core GC types.
|
|
1407
|
+
fn lower_gc_sum_type(
|
|
1408
|
+
types: &TypeList,
|
|
1409
|
+
_abi: Abi,
|
|
1410
|
+
_options: &CanonicalOptions,
|
|
1411
|
+
offset: usize,
|
|
1412
|
+
core: ArgOrField,
|
|
1413
|
+
kind: &str,
|
|
1414
|
+
) -> Result<()> {
|
|
1415
|
+
if let Some(id) = core.as_concrete_ref() {
|
|
1416
|
+
if let CompositeInnerType::Struct(ty) = &types[id].composite_type.inner {
|
|
1417
|
+
if ty.fields.is_empty() {
|
|
1418
|
+
return Ok(());
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
bail!(
|
|
1424
|
+
offset,
|
|
1425
|
+
"expected to lower component `{kind}` type to core `(ref null? (struct))`, \
|
|
1426
|
+
but found `{core}`",
|
|
1427
|
+
)
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
/// Represents a tuple type.
|
|
1431
|
+
#[derive(Debug, Clone)]
|
|
1432
|
+
pub struct TupleType {
|
|
1433
|
+
/// Metadata about this tuple type.
|
|
1434
|
+
pub(crate) info: TypeInfo,
|
|
1435
|
+
/// The types of the tuple.
|
|
1436
|
+
pub types: Box<[ComponentValType]>,
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
impl TupleType {
|
|
1440
|
+
fn lower_gc(
|
|
1441
|
+
&self,
|
|
1442
|
+
types: &TypeList,
|
|
1443
|
+
abi: Abi,
|
|
1444
|
+
options: &CanonicalOptions,
|
|
1445
|
+
offset: usize,
|
|
1446
|
+
core: ArgOrField,
|
|
1447
|
+
) -> Result<()> {
|
|
1448
|
+
lower_gc_product_type(
|
|
1449
|
+
self.types.iter(),
|
|
1450
|
+
types,
|
|
1451
|
+
abi,
|
|
1452
|
+
options,
|
|
1453
|
+
offset,
|
|
1454
|
+
core,
|
|
1455
|
+
"tuple",
|
|
1456
|
+
)
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/// Represents a component defined type.
|
|
1461
|
+
#[derive(Debug, Clone)]
|
|
1462
|
+
pub enum ComponentDefinedType {
|
|
1463
|
+
/// The type is a primitive value type.
|
|
1464
|
+
Primitive(PrimitiveValType),
|
|
1465
|
+
/// The type is a record.
|
|
1466
|
+
Record(RecordType),
|
|
1467
|
+
/// The type is a variant.
|
|
1468
|
+
Variant(VariantType),
|
|
1469
|
+
/// The type is a list.
|
|
1470
|
+
List(ComponentValType),
|
|
1471
|
+
/// The type is a map.
|
|
1472
|
+
Map(ComponentValType, ComponentValType),
|
|
1473
|
+
/// The type is a fixed size list.
|
|
1474
|
+
FixedSizeList(ComponentValType, u32),
|
|
1475
|
+
/// The type is a tuple.
|
|
1476
|
+
Tuple(TupleType),
|
|
1477
|
+
/// The type is a set of flags.
|
|
1478
|
+
Flags(IndexSet<KebabString>),
|
|
1479
|
+
/// The type is an enumeration.
|
|
1480
|
+
Enum(IndexSet<KebabString>),
|
|
1481
|
+
/// The type is an `option`.
|
|
1482
|
+
Option(ComponentValType),
|
|
1483
|
+
/// The type is a `result`.
|
|
1484
|
+
Result {
|
|
1485
|
+
/// The `ok` type.
|
|
1486
|
+
ok: Option<ComponentValType>,
|
|
1487
|
+
/// The `error` type.
|
|
1488
|
+
err: Option<ComponentValType>,
|
|
1489
|
+
},
|
|
1490
|
+
/// The type is an owned handle to the specified resource.
|
|
1491
|
+
Own(AliasableResourceId),
|
|
1492
|
+
/// The type is a borrowed handle to the specified resource.
|
|
1493
|
+
Borrow(AliasableResourceId),
|
|
1494
|
+
/// A future type with the specified payload type.
|
|
1495
|
+
Future(Option<ComponentValType>),
|
|
1496
|
+
/// A stream type with the specified payload type.
|
|
1497
|
+
Stream(Option<ComponentValType>),
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
impl TypeData for ComponentDefinedType {
|
|
1501
|
+
type Id = ComponentDefinedTypeId;
|
|
1502
|
+
const IS_CORE_SUB_TYPE: bool = false;
|
|
1503
|
+
fn type_info(&self, types: &TypeList) -> TypeInfo {
|
|
1504
|
+
match self {
|
|
1505
|
+
Self::Primitive(_)
|
|
1506
|
+
| Self::Flags(_)
|
|
1507
|
+
| Self::Enum(_)
|
|
1508
|
+
| Self::Own(_)
|
|
1509
|
+
| Self::Future(_)
|
|
1510
|
+
| Self::Stream(_) => TypeInfo::new(),
|
|
1511
|
+
Self::Borrow(_) => TypeInfo::borrow(),
|
|
1512
|
+
Self::Record(r) => r.info,
|
|
1513
|
+
Self::Variant(v) => v.info,
|
|
1514
|
+
Self::Tuple(t) => t.info,
|
|
1515
|
+
Self::List(ty) | Self::FixedSizeList(ty, _) | Self::Option(ty) => ty.info(types),
|
|
1516
|
+
Self::Map(k, v) => {
|
|
1517
|
+
let mut info = k.info(types);
|
|
1518
|
+
info.combine(v.info(types), 0).unwrap();
|
|
1519
|
+
info
|
|
1520
|
+
}
|
|
1521
|
+
Self::Result { ok, err } => {
|
|
1522
|
+
let default = TypeInfo::new();
|
|
1523
|
+
let mut info = ok.map(|ty| ty.type_info(types)).unwrap_or(default);
|
|
1524
|
+
info.combine(err.map(|ty| ty.type_info(types)).unwrap_or(default), 0)
|
|
1525
|
+
.unwrap();
|
|
1526
|
+
info
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
impl ComponentDefinedType {
|
|
1533
|
+
pub(crate) fn contains_ptr(&self, types: &TypeList) -> bool {
|
|
1534
|
+
match self {
|
|
1535
|
+
Self::Primitive(ty) => ty.contains_ptr(),
|
|
1536
|
+
Self::Record(r) => r.fields.values().any(|ty| ty.contains_ptr(types)),
|
|
1537
|
+
Self::Variant(v) => v
|
|
1538
|
+
.cases
|
|
1539
|
+
.values()
|
|
1540
|
+
.any(|case| case.ty.map(|ty| ty.contains_ptr(types)).unwrap_or(false)),
|
|
1541
|
+
Self::List(_) | Self::Map(_, _) => true,
|
|
1542
|
+
Self::Tuple(t) => t.types.iter().any(|ty| ty.contains_ptr(types)),
|
|
1543
|
+
Self::Flags(_)
|
|
1544
|
+
| Self::Enum(_)
|
|
1545
|
+
| Self::Own(_)
|
|
1546
|
+
| Self::Borrow(_)
|
|
1547
|
+
| Self::Future(_)
|
|
1548
|
+
| Self::Stream(_) => false,
|
|
1549
|
+
Self::Option(ty) | Self::FixedSizeList(ty, _) => ty.contains_ptr(types),
|
|
1550
|
+
Self::Result { ok, err } => {
|
|
1551
|
+
ok.map(|ty| ty.contains_ptr(types)).unwrap_or(false)
|
|
1552
|
+
|| err.map(|ty| ty.contains_ptr(types)).unwrap_or(false)
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
fn push_wasm_types(&self, types: &TypeList, lowered_types: &mut LoweredTypes) -> bool {
|
|
1558
|
+
match self {
|
|
1559
|
+
Self::Primitive(ty) => push_primitive_wasm_types(ty, lowered_types),
|
|
1560
|
+
Self::Record(r) => r
|
|
1561
|
+
.fields
|
|
1562
|
+
.iter()
|
|
1563
|
+
.all(|(_, ty)| ty.push_wasm_types(types, lowered_types)),
|
|
1564
|
+
Self::Variant(v) => Self::push_variant_wasm_types(
|
|
1565
|
+
v.cases.iter().filter_map(|(_, case)| case.ty.as_ref()),
|
|
1566
|
+
types,
|
|
1567
|
+
lowered_types,
|
|
1568
|
+
),
|
|
1569
|
+
Self::List(_) | Self::Map(_, _) => {
|
|
1570
|
+
lowered_types.try_push(ValType::I32) && lowered_types.try_push(ValType::I32)
|
|
1571
|
+
}
|
|
1572
|
+
Self::FixedSizeList(ty, length) => {
|
|
1573
|
+
(0..*length).all(|_n| ty.push_wasm_types(types, lowered_types))
|
|
1574
|
+
}
|
|
1575
|
+
Self::Tuple(t) => t
|
|
1576
|
+
.types
|
|
1577
|
+
.iter()
|
|
1578
|
+
.all(|ty| ty.push_wasm_types(types, lowered_types)),
|
|
1579
|
+
Self::Flags(names) => {
|
|
1580
|
+
(0..(names.len() + 31) / 32).all(|_| lowered_types.try_push(ValType::I32))
|
|
1581
|
+
}
|
|
1582
|
+
Self::Enum(_) | Self::Own(_) | Self::Borrow(_) | Self::Future(_) | Self::Stream(_) => {
|
|
1583
|
+
lowered_types.try_push(ValType::I32)
|
|
1584
|
+
}
|
|
1585
|
+
Self::Option(ty) => {
|
|
1586
|
+
Self::push_variant_wasm_types([ty].into_iter(), types, lowered_types)
|
|
1587
|
+
}
|
|
1588
|
+
Self::Result { ok, err } => {
|
|
1589
|
+
Self::push_variant_wasm_types(ok.iter().chain(err.iter()), types, lowered_types)
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
fn push_variant_wasm_types<'a>(
|
|
1595
|
+
cases: impl Iterator<Item = &'a ComponentValType>,
|
|
1596
|
+
types: &TypeList,
|
|
1597
|
+
lowered_types: &mut LoweredTypes,
|
|
1598
|
+
) -> bool {
|
|
1599
|
+
// Push the discriminant
|
|
1600
|
+
if !lowered_types.try_push(ValType::I32) {
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
let start = lowered_types.len();
|
|
1605
|
+
|
|
1606
|
+
for ty in cases {
|
|
1607
|
+
let mut temp = LoweredTypes::new(lowered_types.max);
|
|
1608
|
+
|
|
1609
|
+
if !ty.push_wasm_types(types, &mut temp) {
|
|
1610
|
+
return false;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
for (i, ty) in temp.iter().enumerate() {
|
|
1614
|
+
match lowered_types.get_mut(start + i) {
|
|
1615
|
+
Some(prev) => *prev = Self::join_types(*prev, ty),
|
|
1616
|
+
None => {
|
|
1617
|
+
if !lowered_types.try_push(ty) {
|
|
1618
|
+
return false;
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
true
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
fn join_types(a: ValType, b: ValType) -> ValType {
|
|
1629
|
+
use ValType::*;
|
|
1630
|
+
|
|
1631
|
+
match (a, b) {
|
|
1632
|
+
(I32, I32) | (I64, I64) | (F32, F32) | (F64, F64) => a,
|
|
1633
|
+
(I32, F32) | (F32, I32) => I32,
|
|
1634
|
+
(_, I64 | F64) | (I64 | F64, _) => I64,
|
|
1635
|
+
_ => panic!("unexpected wasm type for canonical ABI"),
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
fn desc(&self) -> &'static str {
|
|
1640
|
+
match self {
|
|
1641
|
+
ComponentDefinedType::Record(_) => "record",
|
|
1642
|
+
ComponentDefinedType::Primitive(_) => "primitive",
|
|
1643
|
+
ComponentDefinedType::Variant(_) => "variant",
|
|
1644
|
+
ComponentDefinedType::Tuple(_) => "tuple",
|
|
1645
|
+
ComponentDefinedType::Enum(_) => "enum",
|
|
1646
|
+
ComponentDefinedType::Flags(_) => "flags",
|
|
1647
|
+
ComponentDefinedType::Option(_) => "option",
|
|
1648
|
+
ComponentDefinedType::List(_) => "list",
|
|
1649
|
+
ComponentDefinedType::Map(_, _) => "map",
|
|
1650
|
+
ComponentDefinedType::FixedSizeList(_, _) => "fixed size list",
|
|
1651
|
+
ComponentDefinedType::Result { .. } => "result",
|
|
1652
|
+
ComponentDefinedType::Own(_) => "own",
|
|
1653
|
+
ComponentDefinedType::Borrow(_) => "borrow",
|
|
1654
|
+
ComponentDefinedType::Future(_) => "future",
|
|
1655
|
+
ComponentDefinedType::Stream(_) => "stream",
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
fn lower_gc(
|
|
1660
|
+
&self,
|
|
1661
|
+
types: &TypeList,
|
|
1662
|
+
abi: Abi,
|
|
1663
|
+
options: &CanonicalOptions,
|
|
1664
|
+
offset: usize,
|
|
1665
|
+
core: ArgOrField,
|
|
1666
|
+
) -> Result<()> {
|
|
1667
|
+
match self {
|
|
1668
|
+
ComponentDefinedType::Primitive(ty) => ty.lower_gc(types, abi, options, offset, core),
|
|
1669
|
+
|
|
1670
|
+
ComponentDefinedType::Record(ty) => ty.lower_gc(types, abi, options, offset, core),
|
|
1671
|
+
|
|
1672
|
+
ComponentDefinedType::Variant(ty) => ty.lower_gc(types, abi, options, offset, core),
|
|
1673
|
+
|
|
1674
|
+
ComponentDefinedType::List(ty) | ComponentDefinedType::FixedSizeList(ty, _) => {
|
|
1675
|
+
let id = match core.as_concrete_ref() {
|
|
1676
|
+
Some(id) => id,
|
|
1677
|
+
None => bail!(
|
|
1678
|
+
offset,
|
|
1679
|
+
"expected to lower component `list` type into `(ref null? (array ...))`, but \
|
|
1680
|
+
found `{core}`",
|
|
1681
|
+
),
|
|
1682
|
+
};
|
|
1683
|
+
let array_ty = match types[id].composite_type.inner {
|
|
1684
|
+
CompositeInnerType::Array(ty) => ty,
|
|
1685
|
+
_ => bail!(
|
|
1686
|
+
offset,
|
|
1687
|
+
"expected to lower component `list` type into `(ref null? (array ...))`, but \
|
|
1688
|
+
found `{core}`",
|
|
1689
|
+
),
|
|
1690
|
+
};
|
|
1691
|
+
ty.lower_gc(types, abi, options, offset, array_ty.0.element_type.into())
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
ComponentDefinedType::Map(_, _) => bail!(
|
|
1695
|
+
offset,
|
|
1696
|
+
"GC lowering for component `map` type is not yet implemented"
|
|
1697
|
+
),
|
|
1698
|
+
|
|
1699
|
+
ComponentDefinedType::Tuple(ty) => ty.lower_gc(types, abi, options, offset, core),
|
|
1700
|
+
|
|
1701
|
+
ComponentDefinedType::Flags(flags) => {
|
|
1702
|
+
assert!(flags.len() <= 32, "required by validation");
|
|
1703
|
+
if core.as_val_type() == Some(ValType::I32) {
|
|
1704
|
+
Ok(())
|
|
1705
|
+
} else {
|
|
1706
|
+
bail!(
|
|
1707
|
+
offset,
|
|
1708
|
+
"expected to lower component `flags` type into core `i32` type, but \
|
|
1709
|
+
found `{core}`",
|
|
1710
|
+
)
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
ComponentDefinedType::Enum(_) => {
|
|
1715
|
+
if core.as_val_type() == Some(ValType::I32) {
|
|
1716
|
+
Ok(())
|
|
1717
|
+
} else {
|
|
1718
|
+
bail!(
|
|
1719
|
+
offset,
|
|
1720
|
+
"expected to lower component `enum` type into core `i32` type, but \
|
|
1721
|
+
found `{core}`",
|
|
1722
|
+
)
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
ComponentDefinedType::Option(_) => {
|
|
1727
|
+
lower_gc_sum_type(types, abi, options, offset, core, "option")
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
ComponentDefinedType::Result { .. } => {
|
|
1731
|
+
lower_gc_sum_type(types, abi, options, offset, core, "result")
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
ComponentDefinedType::Own(_)
|
|
1735
|
+
| ComponentDefinedType::Borrow(_)
|
|
1736
|
+
| ComponentDefinedType::Future(_)
|
|
1737
|
+
| ComponentDefinedType::Stream(_) => {
|
|
1738
|
+
if let Some(r) = core.as_ref_type() {
|
|
1739
|
+
if let HeapType::Abstract {
|
|
1740
|
+
shared: _,
|
|
1741
|
+
ty: AbstractHeapType::Extern,
|
|
1742
|
+
} = r.heap_type()
|
|
1743
|
+
{
|
|
1744
|
+
return Ok(());
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
bail!(
|
|
1748
|
+
offset,
|
|
1749
|
+
"expected to lower component `{}` type into core `(ref null? extern)` type, but \
|
|
1750
|
+
found `{core}`",
|
|
1751
|
+
self.desc()
|
|
1752
|
+
)
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
/// Shared helper for lowering component record and tuple types to core GC
|
|
1759
|
+
/// types.
|
|
1760
|
+
fn lower_gc_product_type<'a, I>(
|
|
1761
|
+
fields: I,
|
|
1762
|
+
types: &TypeList,
|
|
1763
|
+
abi: Abi,
|
|
1764
|
+
options: &CanonicalOptions,
|
|
1765
|
+
offset: usize,
|
|
1766
|
+
core: ArgOrField,
|
|
1767
|
+
kind: &str,
|
|
1768
|
+
) -> core::result::Result<(), BinaryReaderError>
|
|
1769
|
+
where
|
|
1770
|
+
I: IntoIterator<Item = &'a ComponentValType>,
|
|
1771
|
+
I::IntoIter: ExactSizeIterator,
|
|
1772
|
+
{
|
|
1773
|
+
let fields = fields.into_iter();
|
|
1774
|
+
let fields_len = fields.len();
|
|
1775
|
+
|
|
1776
|
+
if let Some(id) = core.as_concrete_ref() {
|
|
1777
|
+
if let CompositeInnerType::Struct(ty) = &types[id].composite_type.inner {
|
|
1778
|
+
ensure!(
|
|
1779
|
+
ty.fields.len() == fields_len,
|
|
1780
|
+
offset,
|
|
1781
|
+
"core `struct` has {} fields, but component `{kind}` has {fields_len} fields",
|
|
1782
|
+
ty.fields.len(),
|
|
1783
|
+
);
|
|
1784
|
+
for (core, comp) in ty.fields.iter().zip(fields) {
|
|
1785
|
+
comp.lower_gc(types, abi, options, offset, core.element_type.into())?;
|
|
1786
|
+
}
|
|
1787
|
+
return Ok(());
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
bail!(
|
|
1792
|
+
offset,
|
|
1793
|
+
"expected to lower component `{kind}` type to core `(ref null? (struct ...))`, \
|
|
1794
|
+
but found `{core}`",
|
|
1795
|
+
)
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
/// An opaque identifier intended to be used to distinguish whether two
|
|
1799
|
+
/// resource types are equivalent or not.
|
|
1800
|
+
#[derive(Debug, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Copy)]
|
|
1801
|
+
#[repr(packed(4))] // try to not waste 4 bytes in padding
|
|
1802
|
+
pub struct ResourceId {
|
|
1803
|
+
// This is a globally unique identifier which is assigned once per
|
|
1804
|
+
// `TypeAlloc`. This ensures that resource identifiers from different
|
|
1805
|
+
// instances of `Types`, for example, are considered unique.
|
|
1806
|
+
//
|
|
1807
|
+
// Technically 64-bits should be enough for all resource ids ever, but
|
|
1808
|
+
// they're allocated so often it's predicted that an atomic increment
|
|
1809
|
+
// per resource id is probably too expensive. To amortize that cost each
|
|
1810
|
+
// top-level wasm component gets a single globally unique identifier, and
|
|
1811
|
+
// then within a component contextually unique identifiers are handed out.
|
|
1812
|
+
globally_unique_id: usize,
|
|
1813
|
+
|
|
1814
|
+
// A contextually unique id within the globally unique id above. This is
|
|
1815
|
+
// allocated within a `TypeAlloc` with its own counter, and allocations of
|
|
1816
|
+
// this are cheap as nothing atomic is required.
|
|
1817
|
+
//
|
|
1818
|
+
// The 32-bit storage here should ideally be enough for any component
|
|
1819
|
+
// containing resources. If memory usage becomes an issue (this struct is
|
|
1820
|
+
// 12 bytes instead of 8 or 4) then this could get folded into the globally
|
|
1821
|
+
// unique id with everything using an atomic increment perhaps.
|
|
1822
|
+
contextually_unique_id: u32,
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
impl<'a> TypesRef<'a> {
|
|
1826
|
+
/// Gets a core WebAssembly type id from a type index.
|
|
1827
|
+
///
|
|
1828
|
+
/// Note that this is not to be confused with
|
|
1829
|
+
/// [`TypesRef::component_type_at`] which gets a component type from its
|
|
1830
|
+
/// index, nor [`TypesRef::core_type_count_in_module`] which does not work
|
|
1831
|
+
/// for components.
|
|
1832
|
+
///
|
|
1833
|
+
/// # Panics
|
|
1834
|
+
///
|
|
1835
|
+
/// This will panic if the `index` provided is out of bounds.
|
|
1836
|
+
pub fn core_type_at_in_component(&self, index: u32) -> ComponentCoreTypeId {
|
|
1837
|
+
match &self.kind {
|
|
1838
|
+
TypesRefKind::Module(_) => panic!("use `component_type_at_in_module` instead"),
|
|
1839
|
+
TypesRefKind::Component(component) => component.core_types[index as usize],
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
/// Returns the number of core types defined so far within a component.
|
|
1844
|
+
///
|
|
1845
|
+
/// This should only be used for components. For modules see
|
|
1846
|
+
/// [`TypesRef::core_type_count_in_module`].
|
|
1847
|
+
pub fn core_type_count_in_component(&self) -> u32 {
|
|
1848
|
+
match &self.kind {
|
|
1849
|
+
TypesRefKind::Module(_) => 0,
|
|
1850
|
+
TypesRefKind::Component(component) => component.core_types.len() as u32,
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
/// Gets a type id from a type index.
|
|
1855
|
+
///
|
|
1856
|
+
/// # Panics
|
|
1857
|
+
///
|
|
1858
|
+
/// Panics if `index` is not a valid type index or if this type information
|
|
1859
|
+
/// represents a core module.
|
|
1860
|
+
pub fn component_any_type_at(&self, index: u32) -> ComponentAnyTypeId {
|
|
1861
|
+
match &self.kind {
|
|
1862
|
+
TypesRefKind::Module(_) => panic!("not a component"),
|
|
1863
|
+
TypesRefKind::Component(component) => component.types[index as usize],
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
/// Gets a component type id from a type index.
|
|
1868
|
+
///
|
|
1869
|
+
/// # Panics
|
|
1870
|
+
///
|
|
1871
|
+
/// Panics if `index` is not a valid component type index or if this type
|
|
1872
|
+
/// information represents a core module.
|
|
1873
|
+
pub fn component_type_at(&self, index: u32) -> ComponentTypeId {
|
|
1874
|
+
match self.component_any_type_at(index) {
|
|
1875
|
+
ComponentAnyTypeId::Component(id) => id,
|
|
1876
|
+
_ => panic!("not a component type"),
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
/// Gets a type id from a type index.
|
|
1881
|
+
///
|
|
1882
|
+
/// # Panics
|
|
1883
|
+
///
|
|
1884
|
+
/// Panics if `index` is not a valid function index or if this type
|
|
1885
|
+
/// information represents a core module.
|
|
1886
|
+
pub fn component_defined_type_at(&self, index: u32) -> ComponentDefinedTypeId {
|
|
1887
|
+
match self.component_any_type_at(index) {
|
|
1888
|
+
ComponentAnyTypeId::Defined(id) => id,
|
|
1889
|
+
_ => panic!("not a defined type"),
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
/// Returns the number of component types defined so far.
|
|
1894
|
+
pub fn component_type_count(&self) -> u32 {
|
|
1895
|
+
match &self.kind {
|
|
1896
|
+
TypesRefKind::Module(_module) => 0,
|
|
1897
|
+
TypesRefKind::Component(component) => component.types.len() as u32,
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
/// Gets the type of a component function at the given function index.
|
|
1902
|
+
///
|
|
1903
|
+
/// # Panics
|
|
1904
|
+
///
|
|
1905
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
1906
|
+
/// information represents a core module.
|
|
1907
|
+
pub fn component_function_at(&self, index: u32) -> ComponentFuncTypeId {
|
|
1908
|
+
match &self.kind {
|
|
1909
|
+
TypesRefKind::Module(_) => panic!("not a component"),
|
|
1910
|
+
TypesRefKind::Component(component) => component.funcs[index as usize],
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
/// Returns the number of component functions defined so far.
|
|
1915
|
+
pub fn component_function_count(&self) -> u32 {
|
|
1916
|
+
match &self.kind {
|
|
1917
|
+
TypesRefKind::Module(_module) => 0,
|
|
1918
|
+
TypesRefKind::Component(component) => component.funcs.len() as u32,
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
/// Gets the type of a module at the given module index.
|
|
1923
|
+
///
|
|
1924
|
+
/// # Panics
|
|
1925
|
+
///
|
|
1926
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
1927
|
+
/// information represents a core module.
|
|
1928
|
+
pub fn module_at(&self, index: u32) -> ComponentCoreModuleTypeId {
|
|
1929
|
+
match &self.kind {
|
|
1930
|
+
TypesRefKind::Module(_) => panic!("not a component"),
|
|
1931
|
+
TypesRefKind::Component(component) => component.core_modules[index as usize],
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
/// Returns the number of core wasm modules defined so far.
|
|
1936
|
+
pub fn module_count(&self) -> u32 {
|
|
1937
|
+
match &self.kind {
|
|
1938
|
+
TypesRefKind::Module(_module) => 0,
|
|
1939
|
+
TypesRefKind::Component(component) => component.core_modules.len() as u32,
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
/// Gets the type of a module instance at the given module instance index.
|
|
1944
|
+
///
|
|
1945
|
+
/// # Panics
|
|
1946
|
+
///
|
|
1947
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
1948
|
+
/// information represents a core module.
|
|
1949
|
+
pub fn core_instance_at(&self, index: u32) -> ComponentCoreInstanceTypeId {
|
|
1950
|
+
match &self.kind {
|
|
1951
|
+
TypesRefKind::Module(_) => panic!("not a component"),
|
|
1952
|
+
TypesRefKind::Component(component) => component.core_instances[index as usize],
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
/// Returns the number of core wasm instances defined so far.
|
|
1957
|
+
pub fn core_instance_count(&self) -> u32 {
|
|
1958
|
+
match &self.kind {
|
|
1959
|
+
TypesRefKind::Module(_module) => 0,
|
|
1960
|
+
TypesRefKind::Component(component) => component.core_instances.len() as u32,
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
/// Gets the type of a component at the given component index.
|
|
1965
|
+
///
|
|
1966
|
+
/// # Panics
|
|
1967
|
+
///
|
|
1968
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
1969
|
+
/// information represents a core module.
|
|
1970
|
+
pub fn component_at(&self, index: u32) -> ComponentTypeId {
|
|
1971
|
+
match &self.kind {
|
|
1972
|
+
TypesRefKind::Module(_) => panic!("not a component"),
|
|
1973
|
+
TypesRefKind::Component(component) => component.components[index as usize],
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
/// Returns the number of components defined so far.
|
|
1978
|
+
pub fn component_count(&self) -> u32 {
|
|
1979
|
+
match &self.kind {
|
|
1980
|
+
TypesRefKind::Module(_module) => 0,
|
|
1981
|
+
TypesRefKind::Component(component) => component.components.len() as u32,
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
/// Gets the type of an component instance at the given component instance index.
|
|
1986
|
+
///
|
|
1987
|
+
/// # Panics
|
|
1988
|
+
///
|
|
1989
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
1990
|
+
/// information represents a core module.
|
|
1991
|
+
pub fn component_instance_at(&self, index: u32) -> ComponentInstanceTypeId {
|
|
1992
|
+
match &self.kind {
|
|
1993
|
+
TypesRefKind::Module(_) => panic!("not a component"),
|
|
1994
|
+
TypesRefKind::Component(component) => component.instances[index as usize],
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
/// Returns the number of component instances defined so far.
|
|
1999
|
+
pub fn component_instance_count(&self) -> u32 {
|
|
2000
|
+
match &self.kind {
|
|
2001
|
+
TypesRefKind::Module(_module) => 0,
|
|
2002
|
+
TypesRefKind::Component(component) => component.instances.len() as u32,
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
/// Gets the type of a value at the given value index.
|
|
2007
|
+
///
|
|
2008
|
+
/// # Panics
|
|
2009
|
+
///
|
|
2010
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
2011
|
+
/// information represents a core module.
|
|
2012
|
+
pub fn value_at(&self, index: u32) -> ComponentValType {
|
|
2013
|
+
match &self.kind {
|
|
2014
|
+
TypesRefKind::Module(_) => panic!("not a component"),
|
|
2015
|
+
TypesRefKind::Component(component) => component.values[index as usize].0,
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
/// Returns the number of component values defined so far.
|
|
2020
|
+
pub fn value_count(&self) -> u32 {
|
|
2021
|
+
match &self.kind {
|
|
2022
|
+
TypesRefKind::Module(_module) => 0,
|
|
2023
|
+
TypesRefKind::Component(component) => component.values.len() as u32,
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
/// Gets the component entity type for the given component import.
|
|
2028
|
+
pub fn component_entity_type_of_import(&self, name: &str) -> Option<ComponentEntityType> {
|
|
2029
|
+
match &self.kind {
|
|
2030
|
+
TypesRefKind::Module(_) => None,
|
|
2031
|
+
TypesRefKind::Component(component) => Some(*component.imports.get(name)?),
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
/// Gets the component entity type for the given component export.
|
|
2036
|
+
pub fn component_entity_type_of_export(&self, name: &str) -> Option<ComponentEntityType> {
|
|
2037
|
+
match &self.kind {
|
|
2038
|
+
TypesRefKind::Module(_) => None,
|
|
2039
|
+
TypesRefKind::Component(component) => Some(*component.exports.get(name)?),
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
/// Attempts to lookup the type id that `ty` is an alias of.
|
|
2044
|
+
///
|
|
2045
|
+
/// Returns `None` if `ty` wasn't listed as aliasing a prior type.
|
|
2046
|
+
pub fn peel_alias<T>(&self, ty: T) -> Option<T>
|
|
2047
|
+
where
|
|
2048
|
+
T: Aliasable,
|
|
2049
|
+
{
|
|
2050
|
+
self.list.peel_alias(ty)
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
impl Types {
|
|
2055
|
+
/// Gets a component WebAssembly type at the given type index.
|
|
2056
|
+
///
|
|
2057
|
+
/// Note that this is in contrast to [`TypesRef::core_type_at_in_component`]
|
|
2058
|
+
/// which gets a core type from its index.
|
|
2059
|
+
///
|
|
2060
|
+
/// # Panics
|
|
2061
|
+
///
|
|
2062
|
+
/// Panics if `index` is not a valid type index.
|
|
2063
|
+
pub fn component_any_type_at(&self, index: u32) -> ComponentAnyTypeId {
|
|
2064
|
+
self.as_ref().component_any_type_at(index)
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
/// Gets a component type at the given type index.
|
|
2068
|
+
///
|
|
2069
|
+
/// # Panics
|
|
2070
|
+
///
|
|
2071
|
+
/// Panics if `index` is not a valid component type index.
|
|
2072
|
+
pub fn component_type_at(&self, index: u32) -> ComponentTypeId {
|
|
2073
|
+
self.as_ref().component_type_at(index)
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
/// Gets a component type from the given component type index.
|
|
2077
|
+
///
|
|
2078
|
+
/// # Panics
|
|
2079
|
+
///
|
|
2080
|
+
/// Panics if `index` is not a valid defined type index or if this type
|
|
2081
|
+
/// information represents a core module.
|
|
2082
|
+
pub fn component_defined_type_at(&self, index: u32) -> ComponentDefinedTypeId {
|
|
2083
|
+
self.as_ref().component_defined_type_at(index)
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
/// Gets the type of a component function at the given function index.
|
|
2087
|
+
///
|
|
2088
|
+
/// # Panics
|
|
2089
|
+
///
|
|
2090
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
2091
|
+
/// information represents a core module.
|
|
2092
|
+
pub fn component_function_at(&self, index: u32) -> ComponentFuncTypeId {
|
|
2093
|
+
self.as_ref().component_function_at(index)
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
/// Gets the count of imported, exported, or aliased component functions.
|
|
2097
|
+
pub fn component_function_count(&self) -> u32 {
|
|
2098
|
+
self.as_ref().component_function_count()
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
/// Gets the type of a module at the given module index.
|
|
2102
|
+
///
|
|
2103
|
+
/// # Panics
|
|
2104
|
+
///
|
|
2105
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
2106
|
+
/// information represents a core module.
|
|
2107
|
+
pub fn module_at(&self, index: u32) -> ComponentCoreModuleTypeId {
|
|
2108
|
+
self.as_ref().module_at(index)
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
/// Gets the count of imported, exported, or aliased modules.
|
|
2112
|
+
pub fn module_count(&self) -> usize {
|
|
2113
|
+
match &self.kind {
|
|
2114
|
+
TypesKind::Module(_) => 0,
|
|
2115
|
+
TypesKind::Component(component) => component.core_modules.len(),
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
/// Gets the type of a module instance at the given module instance index.
|
|
2120
|
+
///
|
|
2121
|
+
/// # Panics
|
|
2122
|
+
///
|
|
2123
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
2124
|
+
/// information represents a core module.
|
|
2125
|
+
pub fn core_instance_at(&self, index: u32) -> ComponentCoreInstanceTypeId {
|
|
2126
|
+
self.as_ref().core_instance_at(index)
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
/// Gets the count of imported, exported, or aliased core module instances.
|
|
2130
|
+
pub fn core_instance_count(&self) -> usize {
|
|
2131
|
+
match &self.kind {
|
|
2132
|
+
TypesKind::Module(_) => 0,
|
|
2133
|
+
TypesKind::Component(component) => component.core_instances.len(),
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
/// Gets the type of a component at the given component index.
|
|
2138
|
+
///
|
|
2139
|
+
/// # Panics
|
|
2140
|
+
///
|
|
2141
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
2142
|
+
/// information represents a core module.
|
|
2143
|
+
pub fn component_at(&self, index: u32) -> ComponentTypeId {
|
|
2144
|
+
self.as_ref().component_at(index)
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
/// Gets the count of imported, exported, or aliased components.
|
|
2148
|
+
pub fn component_count(&self) -> usize {
|
|
2149
|
+
match &self.kind {
|
|
2150
|
+
TypesKind::Module(_) => 0,
|
|
2151
|
+
TypesKind::Component(component) => component.components.len(),
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
/// Gets the type of an component instance at the given component instance index.
|
|
2156
|
+
///
|
|
2157
|
+
/// # Panics
|
|
2158
|
+
///
|
|
2159
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
2160
|
+
/// information represents a core module.
|
|
2161
|
+
pub fn component_instance_at(&self, index: u32) -> ComponentInstanceTypeId {
|
|
2162
|
+
self.as_ref().component_instance_at(index)
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
/// Gets the count of imported, exported, or aliased component instances.
|
|
2166
|
+
pub fn component_instance_count(&self) -> usize {
|
|
2167
|
+
match &self.kind {
|
|
2168
|
+
TypesKind::Module(_) => 0,
|
|
2169
|
+
TypesKind::Component(component) => component.instances.len(),
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
/// Gets the type of a value at the given value index.
|
|
2174
|
+
///
|
|
2175
|
+
/// # Panics
|
|
2176
|
+
///
|
|
2177
|
+
/// This will panic if the `index` provided is out of bounds or if this type
|
|
2178
|
+
/// information represents a core module.
|
|
2179
|
+
pub fn value_at(&self, index: u32) -> ComponentValType {
|
|
2180
|
+
self.as_ref().value_at(index)
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
/// Gets the count of imported, exported, or aliased values.
|
|
2184
|
+
pub fn value_count(&self) -> usize {
|
|
2185
|
+
match &self.kind {
|
|
2186
|
+
TypesKind::Module(_) => 0,
|
|
2187
|
+
TypesKind::Component(component) => component.values.len(),
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
/// Gets the component entity type for the given component import name.
|
|
2192
|
+
pub fn component_entity_type_of_import(&self, name: &str) -> Option<ComponentEntityType> {
|
|
2193
|
+
self.as_ref().component_entity_type_of_import(name)
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
/// Gets the component entity type for the given component export name.
|
|
2197
|
+
pub fn component_entity_type_of_export(&self, name: &str) -> Option<ComponentEntityType> {
|
|
2198
|
+
self.as_ref().component_entity_type_of_export(name)
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
/// Attempts to lookup the type id that `ty` is an alias of.
|
|
2202
|
+
///
|
|
2203
|
+
/// Returns `None` if `ty` wasn't listed as aliasing a prior type.
|
|
2204
|
+
pub fn peel_alias<T>(&self, ty: T) -> Option<T>
|
|
2205
|
+
where
|
|
2206
|
+
T: Aliasable,
|
|
2207
|
+
{
|
|
2208
|
+
self.list.peel_alias(ty)
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
/// A snapshot list of types.
|
|
2213
|
+
#[derive(Debug, Default)]
|
|
2214
|
+
pub(crate) struct ComponentTypeList {
|
|
2215
|
+
// Keeps track of which `alias_id` is an alias of which other `alias_id`.
|
|
2216
|
+
alias_mappings: Map<u32, u32>,
|
|
2217
|
+
// Counter for generating new `alias_id`s.
|
|
2218
|
+
alias_counter: u32,
|
|
2219
|
+
// Snapshots of previously committed `TypeList`s' aliases.
|
|
2220
|
+
alias_snapshots: Vec<TypeListAliasSnapshot>,
|
|
2221
|
+
|
|
2222
|
+
// Component model types.
|
|
2223
|
+
components: SnapshotList<ComponentType>,
|
|
2224
|
+
component_defined_types: SnapshotList<ComponentDefinedType>,
|
|
2225
|
+
component_values: SnapshotList<ComponentValType>,
|
|
2226
|
+
component_instances: SnapshotList<ComponentInstanceType>,
|
|
2227
|
+
component_funcs: SnapshotList<ComponentFuncType>,
|
|
2228
|
+
core_modules: SnapshotList<ModuleType>,
|
|
2229
|
+
core_instances: SnapshotList<InstanceType>,
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
#[derive(Clone, Debug)]
|
|
2233
|
+
struct TypeListAliasSnapshot {
|
|
2234
|
+
// The `alias_counter` at the time that this snapshot was taken.
|
|
2235
|
+
alias_counter: u32,
|
|
2236
|
+
|
|
2237
|
+
// The alias mappings in this snapshot.
|
|
2238
|
+
alias_mappings: Map<u32, u32>,
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
struct TypeListCheckpoint {
|
|
2242
|
+
core_types: usize,
|
|
2243
|
+
components: usize,
|
|
2244
|
+
component_defined_types: usize,
|
|
2245
|
+
component_values: usize,
|
|
2246
|
+
component_instances: usize,
|
|
2247
|
+
component_funcs: usize,
|
|
2248
|
+
core_modules: usize,
|
|
2249
|
+
core_instances: usize,
|
|
2250
|
+
core_type_to_rec_group: usize,
|
|
2251
|
+
core_type_to_supertype: usize,
|
|
2252
|
+
core_type_to_depth: usize,
|
|
2253
|
+
rec_group_elements: usize,
|
|
2254
|
+
canonical_rec_groups: usize,
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
impl TypeList {
|
|
2258
|
+
fn checkpoint(&self) -> TypeListCheckpoint {
|
|
2259
|
+
let TypeList {
|
|
2260
|
+
component:
|
|
2261
|
+
ComponentTypeList {
|
|
2262
|
+
alias_mappings: _,
|
|
2263
|
+
alias_counter: _,
|
|
2264
|
+
alias_snapshots: _,
|
|
2265
|
+
components,
|
|
2266
|
+
component_defined_types,
|
|
2267
|
+
component_values,
|
|
2268
|
+
component_instances,
|
|
2269
|
+
component_funcs,
|
|
2270
|
+
core_modules,
|
|
2271
|
+
core_instances,
|
|
2272
|
+
},
|
|
2273
|
+
core_types,
|
|
2274
|
+
core_type_to_rec_group,
|
|
2275
|
+
core_type_to_supertype,
|
|
2276
|
+
core_type_to_depth,
|
|
2277
|
+
rec_group_elements,
|
|
2278
|
+
canonical_rec_groups,
|
|
2279
|
+
} = self;
|
|
2280
|
+
|
|
2281
|
+
TypeListCheckpoint {
|
|
2282
|
+
core_types: core_types.len(),
|
|
2283
|
+
components: components.len(),
|
|
2284
|
+
component_defined_types: component_defined_types.len(),
|
|
2285
|
+
component_values: component_values.len(),
|
|
2286
|
+
component_instances: component_instances.len(),
|
|
2287
|
+
component_funcs: component_funcs.len(),
|
|
2288
|
+
core_modules: core_modules.len(),
|
|
2289
|
+
core_instances: core_instances.len(),
|
|
2290
|
+
core_type_to_rec_group: core_type_to_rec_group.len(),
|
|
2291
|
+
core_type_to_supertype: core_type_to_supertype.len(),
|
|
2292
|
+
core_type_to_depth: core_type_to_depth.as_ref().map(|m| m.len()).unwrap_or(0),
|
|
2293
|
+
rec_group_elements: rec_group_elements.len(),
|
|
2294
|
+
canonical_rec_groups: canonical_rec_groups.as_ref().map(|m| m.len()).unwrap_or(0),
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
fn reset_to_checkpoint(&mut self, checkpoint: TypeListCheckpoint) {
|
|
2299
|
+
let TypeList {
|
|
2300
|
+
component:
|
|
2301
|
+
ComponentTypeList {
|
|
2302
|
+
alias_mappings: _,
|
|
2303
|
+
alias_counter: _,
|
|
2304
|
+
alias_snapshots: _,
|
|
2305
|
+
components,
|
|
2306
|
+
component_defined_types,
|
|
2307
|
+
component_values,
|
|
2308
|
+
component_instances,
|
|
2309
|
+
component_funcs,
|
|
2310
|
+
core_modules,
|
|
2311
|
+
core_instances,
|
|
2312
|
+
},
|
|
2313
|
+
core_types,
|
|
2314
|
+
core_type_to_rec_group,
|
|
2315
|
+
core_type_to_supertype,
|
|
2316
|
+
core_type_to_depth,
|
|
2317
|
+
rec_group_elements,
|
|
2318
|
+
canonical_rec_groups,
|
|
2319
|
+
} = self;
|
|
2320
|
+
|
|
2321
|
+
core_types.truncate(checkpoint.core_types);
|
|
2322
|
+
components.truncate(checkpoint.components);
|
|
2323
|
+
component_defined_types.truncate(checkpoint.component_defined_types);
|
|
2324
|
+
component_values.truncate(checkpoint.component_values);
|
|
2325
|
+
component_instances.truncate(checkpoint.component_instances);
|
|
2326
|
+
component_funcs.truncate(checkpoint.component_funcs);
|
|
2327
|
+
core_modules.truncate(checkpoint.core_modules);
|
|
2328
|
+
core_instances.truncate(checkpoint.core_instances);
|
|
2329
|
+
core_type_to_rec_group.truncate(checkpoint.core_type_to_rec_group);
|
|
2330
|
+
core_type_to_supertype.truncate(checkpoint.core_type_to_supertype);
|
|
2331
|
+
rec_group_elements.truncate(checkpoint.rec_group_elements);
|
|
2332
|
+
|
|
2333
|
+
if let Some(core_type_to_depth) = core_type_to_depth {
|
|
2334
|
+
assert_eq!(
|
|
2335
|
+
core_type_to_depth.len(),
|
|
2336
|
+
checkpoint.core_type_to_depth,
|
|
2337
|
+
"checkpointing does not support resetting `core_type_to_depth` (it would require a \
|
|
2338
|
+
proper immutable and persistent hash map) so adding new groups is disallowed"
|
|
2339
|
+
);
|
|
2340
|
+
}
|
|
2341
|
+
if let Some(canonical_rec_groups) = canonical_rec_groups {
|
|
2342
|
+
assert_eq!(
|
|
2343
|
+
canonical_rec_groups.len(),
|
|
2344
|
+
checkpoint.canonical_rec_groups,
|
|
2345
|
+
"checkpointing does not support resetting `canonical_rec_groups` (it would require a \
|
|
2346
|
+
proper immutable and persistent hash map) so adding new groups is disallowed"
|
|
2347
|
+
);
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
/// See `SnapshotList::with_unique`.
|
|
2352
|
+
pub fn with_unique<T>(&mut self, mut ty: T) -> T
|
|
2353
|
+
where
|
|
2354
|
+
T: Aliasable,
|
|
2355
|
+
{
|
|
2356
|
+
self.component
|
|
2357
|
+
.alias_mappings
|
|
2358
|
+
.insert(self.component.alias_counter, ty.alias_id());
|
|
2359
|
+
ty.set_alias_id(self.component.alias_counter);
|
|
2360
|
+
self.component.alias_counter += 1;
|
|
2361
|
+
ty
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
/// Attempts to lookup the type id that `ty` is an alias of.
|
|
2365
|
+
///
|
|
2366
|
+
/// Returns `None` if `ty` wasn't listed as aliasing a prior type.
|
|
2367
|
+
pub fn peel_alias<T>(&self, mut ty: T) -> Option<T>
|
|
2368
|
+
where
|
|
2369
|
+
T: Aliasable,
|
|
2370
|
+
{
|
|
2371
|
+
let alias_id = ty.alias_id();
|
|
2372
|
+
|
|
2373
|
+
// The unique counter in each snapshot is the unique counter at the
|
|
2374
|
+
// time of the snapshot so it's guaranteed to never be used, meaning
|
|
2375
|
+
// that `Ok` should never show up here. With an `Err` it's where the
|
|
2376
|
+
// index would be placed meaning that the index in question is the
|
|
2377
|
+
// smallest value over the unique id's value, meaning that slot has the
|
|
2378
|
+
// mapping we're interested in.
|
|
2379
|
+
let i = match self
|
|
2380
|
+
.component
|
|
2381
|
+
.alias_snapshots
|
|
2382
|
+
.binary_search_by_key(&alias_id, |snapshot| snapshot.alias_counter)
|
|
2383
|
+
{
|
|
2384
|
+
Ok(_) => unreachable!(),
|
|
2385
|
+
Err(i) => i,
|
|
2386
|
+
};
|
|
2387
|
+
|
|
2388
|
+
// If the `i` index is beyond the snapshot array then lookup in the
|
|
2389
|
+
// current mappings instead since it may refer to a type not snapshot
|
|
2390
|
+
// yet.
|
|
2391
|
+
ty.set_alias_id(match self.component.alias_snapshots.get(i) {
|
|
2392
|
+
Some(snapshot) => *snapshot.alias_mappings.get(&alias_id)?,
|
|
2393
|
+
None => *self.component.alias_mappings.get(&alias_id)?,
|
|
2394
|
+
});
|
|
2395
|
+
Some(ty)
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
impl ComponentTypeList {
|
|
2400
|
+
pub fn commit(&mut self) -> ComponentTypeList {
|
|
2401
|
+
// Note that the `alias_counter` is bumped here to ensure that the
|
|
2402
|
+
// previous value of the unique counter is never used for an actual type
|
|
2403
|
+
// so it's suitable for lookup via a binary search.
|
|
2404
|
+
let alias_counter = self.alias_counter;
|
|
2405
|
+
self.alias_counter += 1;
|
|
2406
|
+
|
|
2407
|
+
self.alias_snapshots.push(TypeListAliasSnapshot {
|
|
2408
|
+
alias_counter,
|
|
2409
|
+
alias_mappings: mem::take(&mut self.alias_mappings),
|
|
2410
|
+
});
|
|
2411
|
+
|
|
2412
|
+
ComponentTypeList {
|
|
2413
|
+
alias_mappings: Map::default(),
|
|
2414
|
+
alias_counter: self.alias_counter,
|
|
2415
|
+
alias_snapshots: self.alias_snapshots.clone(),
|
|
2416
|
+
components: self.components.commit(),
|
|
2417
|
+
component_defined_types: self.component_defined_types.commit(),
|
|
2418
|
+
component_values: self.component_values.commit(),
|
|
2419
|
+
component_instances: self.component_instances.commit(),
|
|
2420
|
+
component_funcs: self.component_funcs.commit(),
|
|
2421
|
+
core_modules: self.core_modules.commit(),
|
|
2422
|
+
core_instances: self.core_instances.commit(),
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
pub(crate) struct ComponentTypeAlloc {
|
|
2428
|
+
// This is assigned at creation of a `TypeAlloc` and then never changed.
|
|
2429
|
+
// It's used in one entry for all `ResourceId`s contained within.
|
|
2430
|
+
globally_unique_id: usize,
|
|
2431
|
+
|
|
2432
|
+
// This is a counter that's incremeneted each time `alloc_resource_id` is
|
|
2433
|
+
// called.
|
|
2434
|
+
next_resource_id: u32,
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
impl Default for ComponentTypeAlloc {
|
|
2438
|
+
fn default() -> ComponentTypeAlloc {
|
|
2439
|
+
static NEXT_GLOBAL_ID: AtomicUsize = AtomicUsize::new(0);
|
|
2440
|
+
ComponentTypeAlloc {
|
|
2441
|
+
globally_unique_id: {
|
|
2442
|
+
let id = NEXT_GLOBAL_ID.fetch_add(1, Ordering::Relaxed);
|
|
2443
|
+
if id > usize::MAX - 10_000 {
|
|
2444
|
+
NEXT_GLOBAL_ID.store(usize::MAX - 10_000, Ordering::Relaxed);
|
|
2445
|
+
panic!("overflow on the global id counter");
|
|
2446
|
+
}
|
|
2447
|
+
id
|
|
2448
|
+
},
|
|
2449
|
+
next_resource_id: 0,
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
impl TypeAlloc {
|
|
2455
|
+
/// Allocates a new unique resource identifier.
|
|
2456
|
+
///
|
|
2457
|
+
/// Note that uniqueness is only a property within this `TypeAlloc`.
|
|
2458
|
+
pub fn alloc_resource_id(&mut self) -> AliasableResourceId {
|
|
2459
|
+
let contextually_unique_id = self.component_alloc.next_resource_id;
|
|
2460
|
+
self.component_alloc.next_resource_id = self
|
|
2461
|
+
.component_alloc
|
|
2462
|
+
.next_resource_id
|
|
2463
|
+
.checked_add(1)
|
|
2464
|
+
.unwrap();
|
|
2465
|
+
AliasableResourceId {
|
|
2466
|
+
id: ResourceId {
|
|
2467
|
+
globally_unique_id: self.component_alloc.globally_unique_id,
|
|
2468
|
+
contextually_unique_id,
|
|
2469
|
+
},
|
|
2470
|
+
alias_id: NO_ALIAS,
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
/// Adds the set of "free variables" of the `id` provided to the `set`
|
|
2475
|
+
/// provided.
|
|
2476
|
+
///
|
|
2477
|
+
/// Free variables are defined as resources. Any resource, perhaps
|
|
2478
|
+
/// transitively, referred to but not defined by `id` is added to the `set`
|
|
2479
|
+
/// and returned.
|
|
2480
|
+
pub fn free_variables_any_type_id(
|
|
2481
|
+
&self,
|
|
2482
|
+
id: ComponentAnyTypeId,
|
|
2483
|
+
set: &mut IndexSet<ResourceId>,
|
|
2484
|
+
) {
|
|
2485
|
+
match id {
|
|
2486
|
+
ComponentAnyTypeId::Resource(r) => {
|
|
2487
|
+
set.insert(r.resource());
|
|
2488
|
+
}
|
|
2489
|
+
ComponentAnyTypeId::Defined(id) => {
|
|
2490
|
+
self.free_variables_component_defined_type_id(id, set)
|
|
2491
|
+
}
|
|
2492
|
+
ComponentAnyTypeId::Func(id) => self.free_variables_component_func_type_id(id, set),
|
|
2493
|
+
ComponentAnyTypeId::Instance(id) => {
|
|
2494
|
+
self.free_variables_component_instance_type_id(id, set)
|
|
2495
|
+
}
|
|
2496
|
+
ComponentAnyTypeId::Component(id) => self.free_variables_component_type_id(id, set),
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
pub fn free_variables_component_defined_type_id(
|
|
2501
|
+
&self,
|
|
2502
|
+
id: ComponentDefinedTypeId,
|
|
2503
|
+
set: &mut IndexSet<ResourceId>,
|
|
2504
|
+
) {
|
|
2505
|
+
match &self[id] {
|
|
2506
|
+
ComponentDefinedType::Primitive(_)
|
|
2507
|
+
| ComponentDefinedType::Flags(_)
|
|
2508
|
+
| ComponentDefinedType::Enum(_) => {}
|
|
2509
|
+
ComponentDefinedType::Record(r) => {
|
|
2510
|
+
for ty in r.fields.values() {
|
|
2511
|
+
self.free_variables_valtype(ty, set);
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
ComponentDefinedType::Tuple(r) => {
|
|
2515
|
+
for ty in r.types.iter() {
|
|
2516
|
+
self.free_variables_valtype(ty, set);
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
ComponentDefinedType::Variant(r) => {
|
|
2520
|
+
for ty in r.cases.values() {
|
|
2521
|
+
if let Some(ty) = &ty.ty {
|
|
2522
|
+
self.free_variables_valtype(ty, set);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
ComponentDefinedType::List(ty)
|
|
2527
|
+
| ComponentDefinedType::FixedSizeList(ty, _)
|
|
2528
|
+
| ComponentDefinedType::Option(ty) => {
|
|
2529
|
+
self.free_variables_valtype(ty, set);
|
|
2530
|
+
}
|
|
2531
|
+
ComponentDefinedType::Map(k, v) => {
|
|
2532
|
+
self.free_variables_valtype(k, set);
|
|
2533
|
+
self.free_variables_valtype(v, set);
|
|
2534
|
+
}
|
|
2535
|
+
ComponentDefinedType::Result { ok, err } => {
|
|
2536
|
+
if let Some(ok) = ok {
|
|
2537
|
+
self.free_variables_valtype(ok, set);
|
|
2538
|
+
}
|
|
2539
|
+
if let Some(err) = err {
|
|
2540
|
+
self.free_variables_valtype(err, set);
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
ComponentDefinedType::Own(id) | ComponentDefinedType::Borrow(id) => {
|
|
2544
|
+
set.insert(id.resource());
|
|
2545
|
+
}
|
|
2546
|
+
ComponentDefinedType::Future(ty) => {
|
|
2547
|
+
if let Some(ty) = ty {
|
|
2548
|
+
self.free_variables_valtype(ty, set);
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
ComponentDefinedType::Stream(ty) => {
|
|
2552
|
+
if let Some(ty) = ty {
|
|
2553
|
+
self.free_variables_valtype(ty, set);
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
pub fn free_variables_component_type_id(
|
|
2560
|
+
&self,
|
|
2561
|
+
id: ComponentTypeId,
|
|
2562
|
+
set: &mut IndexSet<ResourceId>,
|
|
2563
|
+
) {
|
|
2564
|
+
let i = &self[id];
|
|
2565
|
+
// Recurse on the imports/exports of components, but remove the
|
|
2566
|
+
// imported and defined resources within the component itself.
|
|
2567
|
+
//
|
|
2568
|
+
// Technically this needs to add all the free variables of the
|
|
2569
|
+
// exports, remove the defined resources, then add the free
|
|
2570
|
+
// variables of imports, then remove the imported resources. Given
|
|
2571
|
+
// prior validation of component types, however, the defined
|
|
2572
|
+
// and imported resources are disjoint and imports can't refer to
|
|
2573
|
+
// defined resources, so doing this all in one go should be
|
|
2574
|
+
// equivalent.
|
|
2575
|
+
for ty in i.imports.values().chain(i.exports.values()) {
|
|
2576
|
+
self.free_variables_component_entity(ty, set);
|
|
2577
|
+
}
|
|
2578
|
+
for (id, _path) in i.imported_resources.iter().chain(&i.defined_resources) {
|
|
2579
|
+
set.swap_remove(id);
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
pub fn free_variables_component_instance_type_id(
|
|
2584
|
+
&self,
|
|
2585
|
+
id: ComponentInstanceTypeId,
|
|
2586
|
+
set: &mut IndexSet<ResourceId>,
|
|
2587
|
+
) {
|
|
2588
|
+
let i = &self[id];
|
|
2589
|
+
// Like components, add in all the free variables of referenced
|
|
2590
|
+
// types but then remove those defined by this component instance
|
|
2591
|
+
// itself.
|
|
2592
|
+
for ty in i.exports.values() {
|
|
2593
|
+
self.free_variables_component_entity(ty, set);
|
|
2594
|
+
}
|
|
2595
|
+
for id in i.defined_resources.iter() {
|
|
2596
|
+
set.swap_remove(id);
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
pub fn free_variables_component_func_type_id(
|
|
2601
|
+
&self,
|
|
2602
|
+
id: ComponentFuncTypeId,
|
|
2603
|
+
set: &mut IndexSet<ResourceId>,
|
|
2604
|
+
) {
|
|
2605
|
+
let i = &self[id];
|
|
2606
|
+
for ty in i.params.iter().map(|(_, ty)| ty).chain(&i.result) {
|
|
2607
|
+
self.free_variables_valtype(ty, set);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
/// Same as `free_variables_type_id`, but for `ComponentEntityType`.
|
|
2612
|
+
pub fn free_variables_component_entity(
|
|
2613
|
+
&self,
|
|
2614
|
+
ty: &ComponentEntityType,
|
|
2615
|
+
set: &mut IndexSet<ResourceId>,
|
|
2616
|
+
) {
|
|
2617
|
+
match ty {
|
|
2618
|
+
ComponentEntityType::Module(_) => {}
|
|
2619
|
+
ComponentEntityType::Func(id) => self.free_variables_component_func_type_id(*id, set),
|
|
2620
|
+
ComponentEntityType::Instance(id) => {
|
|
2621
|
+
self.free_variables_component_instance_type_id(*id, set)
|
|
2622
|
+
}
|
|
2623
|
+
ComponentEntityType::Component(id) => self.free_variables_component_type_id(*id, set),
|
|
2624
|
+
ComponentEntityType::Type { created, .. } => {
|
|
2625
|
+
self.free_variables_any_type_id(*created, set);
|
|
2626
|
+
}
|
|
2627
|
+
ComponentEntityType::Value(ty) => self.free_variables_valtype(ty, set),
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
/// Same as `free_variables_type_id`, but for `ComponentValType`.
|
|
2632
|
+
fn free_variables_valtype(&self, ty: &ComponentValType, set: &mut IndexSet<ResourceId>) {
|
|
2633
|
+
match ty {
|
|
2634
|
+
ComponentValType::Primitive(_) => {}
|
|
2635
|
+
ComponentValType::Type(id) => self.free_variables_component_defined_type_id(*id, set),
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
/// Returns whether the type `id` is "named" where named types are presented
|
|
2640
|
+
/// via the provided `set`.
|
|
2641
|
+
///
|
|
2642
|
+
/// This requires that `id` is a `Defined` type.
|
|
2643
|
+
pub(crate) fn type_named_type_id(
|
|
2644
|
+
&self,
|
|
2645
|
+
id: ComponentDefinedTypeId,
|
|
2646
|
+
set: &Set<ComponentAnyTypeId>,
|
|
2647
|
+
) -> bool {
|
|
2648
|
+
let ty = &self[id];
|
|
2649
|
+
match ty {
|
|
2650
|
+
// Primitives are always considered named
|
|
2651
|
+
ComponentDefinedType::Primitive(_) => true,
|
|
2652
|
+
|
|
2653
|
+
// These structures are never allowed to be anonymous, so they
|
|
2654
|
+
// themselves must be named.
|
|
2655
|
+
ComponentDefinedType::Flags(_)
|
|
2656
|
+
| ComponentDefinedType::Enum(_)
|
|
2657
|
+
| ComponentDefinedType::Record(_)
|
|
2658
|
+
| ComponentDefinedType::Variant(_) => set.contains(&ComponentAnyTypeId::from(id)),
|
|
2659
|
+
|
|
2660
|
+
// All types below here are allowed to be anonymous, but their
|
|
2661
|
+
// own components must be appropriately named.
|
|
2662
|
+
ComponentDefinedType::Tuple(r) => {
|
|
2663
|
+
r.types.iter().all(|t| self.type_named_valtype(t, set))
|
|
2664
|
+
}
|
|
2665
|
+
ComponentDefinedType::Result { ok, err } => {
|
|
2666
|
+
ok.as_ref()
|
|
2667
|
+
.map(|t| self.type_named_valtype(t, set))
|
|
2668
|
+
.unwrap_or(true)
|
|
2669
|
+
&& err
|
|
2670
|
+
.as_ref()
|
|
2671
|
+
.map(|t| self.type_named_valtype(t, set))
|
|
2672
|
+
.unwrap_or(true)
|
|
2673
|
+
}
|
|
2674
|
+
ComponentDefinedType::List(ty)
|
|
2675
|
+
| ComponentDefinedType::FixedSizeList(ty, _)
|
|
2676
|
+
| ComponentDefinedType::Option(ty) => self.type_named_valtype(ty, set),
|
|
2677
|
+
ComponentDefinedType::Map(k, v) => {
|
|
2678
|
+
self.type_named_valtype(k, set) && self.type_named_valtype(v, set)
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
// own/borrow themselves don't have to be named, but the resource
|
|
2682
|
+
// they refer to must be named.
|
|
2683
|
+
ComponentDefinedType::Own(id) | ComponentDefinedType::Borrow(id) => {
|
|
2684
|
+
set.contains(&ComponentAnyTypeId::from(*id))
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
ComponentDefinedType::Future(ty) => ty
|
|
2688
|
+
.as_ref()
|
|
2689
|
+
.map(|ty| self.type_named_valtype(ty, set))
|
|
2690
|
+
.unwrap_or(true),
|
|
2691
|
+
|
|
2692
|
+
ComponentDefinedType::Stream(ty) => ty
|
|
2693
|
+
.as_ref()
|
|
2694
|
+
.map(|ty| self.type_named_valtype(ty, set))
|
|
2695
|
+
.unwrap_or(true),
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
pub(crate) fn type_named_valtype(
|
|
2700
|
+
&self,
|
|
2701
|
+
ty: &ComponentValType,
|
|
2702
|
+
set: &Set<ComponentAnyTypeId>,
|
|
2703
|
+
) -> bool {
|
|
2704
|
+
match ty {
|
|
2705
|
+
ComponentValType::Primitive(_) => true,
|
|
2706
|
+
ComponentValType::Type(id) => self.type_named_type_id(*id, set),
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
/// A helper trait to provide the functionality necessary to resources within a
|
|
2712
|
+
/// type.
|
|
2713
|
+
///
|
|
2714
|
+
/// This currently exists to abstract over `TypeAlloc` and `SubtypeArena` which
|
|
2715
|
+
/// both need to perform remapping operations.
|
|
2716
|
+
pub trait Remap
|
|
2717
|
+
where
|
|
2718
|
+
Self: Index<ComponentTypeId, Output = ComponentType>,
|
|
2719
|
+
Self: Index<ComponentDefinedTypeId, Output = ComponentDefinedType>,
|
|
2720
|
+
Self: Index<ComponentInstanceTypeId, Output = ComponentInstanceType>,
|
|
2721
|
+
Self: Index<ComponentFuncTypeId, Output = ComponentFuncType>,
|
|
2722
|
+
{
|
|
2723
|
+
/// Pushes a new anonymous type within this object, returning an identifier
|
|
2724
|
+
/// which can be used to refer to it.
|
|
2725
|
+
///
|
|
2726
|
+
/// For internal use only!
|
|
2727
|
+
#[doc(hidden)]
|
|
2728
|
+
fn push_ty<T>(&mut self, ty: T) -> T::Id
|
|
2729
|
+
where
|
|
2730
|
+
T: TypeData;
|
|
2731
|
+
|
|
2732
|
+
/// Apply `map` to the keys of `tmp`, setting `*any_changed = true` if any
|
|
2733
|
+
/// keys were remapped.
|
|
2734
|
+
fn map_map(
|
|
2735
|
+
tmp: &mut IndexMap<ResourceId, Vec<usize>>,
|
|
2736
|
+
any_changed: &mut bool,
|
|
2737
|
+
map: &Remapping,
|
|
2738
|
+
) {
|
|
2739
|
+
for (id, path) in mem::take(tmp) {
|
|
2740
|
+
let id = match map.resources.get(&id) {
|
|
2741
|
+
Some(id) => {
|
|
2742
|
+
*any_changed = true;
|
|
2743
|
+
*id
|
|
2744
|
+
}
|
|
2745
|
+
None => id,
|
|
2746
|
+
};
|
|
2747
|
+
tmp.insert(id, path);
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
/// If `any_changed` is true, push `ty`, update `map` to point `id` to the
|
|
2752
|
+
/// new type ID, set `id` equal to the new type ID, and return `true`.
|
|
2753
|
+
/// Otherwise, update `map` to point `id` to itself and return `false`.
|
|
2754
|
+
fn insert_if_any_changed<T>(
|
|
2755
|
+
&mut self,
|
|
2756
|
+
map: &mut Remapping,
|
|
2757
|
+
any_changed: bool,
|
|
2758
|
+
id: &mut T::Id,
|
|
2759
|
+
ty: T,
|
|
2760
|
+
) -> bool
|
|
2761
|
+
where
|
|
2762
|
+
T: TypeData,
|
|
2763
|
+
T::Id: Into<ComponentAnyTypeId>,
|
|
2764
|
+
{
|
|
2765
|
+
let new = if any_changed { self.push_ty(ty) } else { *id };
|
|
2766
|
+
map.types.insert((*id).into(), new.into());
|
|
2767
|
+
let changed = *id != new;
|
|
2768
|
+
*id = new;
|
|
2769
|
+
changed
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
/// Recursively search for any resource types reachable from `id`, updating
|
|
2773
|
+
/// it and `map` if any are found and remapped, returning `true` iff at last
|
|
2774
|
+
/// one is remapped.
|
|
2775
|
+
fn remap_component_any_type_id(
|
|
2776
|
+
&mut self,
|
|
2777
|
+
id: &mut ComponentAnyTypeId,
|
|
2778
|
+
map: &mut Remapping,
|
|
2779
|
+
) -> bool {
|
|
2780
|
+
match id {
|
|
2781
|
+
ComponentAnyTypeId::Resource(id) => self.remap_resource_id(id, map),
|
|
2782
|
+
ComponentAnyTypeId::Defined(id) => self.remap_component_defined_type_id(id, map),
|
|
2783
|
+
ComponentAnyTypeId::Func(id) => self.remap_component_func_type_id(id, map),
|
|
2784
|
+
ComponentAnyTypeId::Instance(id) => self.remap_component_instance_type_id(id, map),
|
|
2785
|
+
ComponentAnyTypeId::Component(id) => self.remap_component_type_id(id, map),
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
/// If `map` indicates `id` should be remapped, update it and return `true`.
|
|
2790
|
+
/// Otherwise, do nothing and return `false`.
|
|
2791
|
+
fn remap_resource_id(&mut self, id: &mut AliasableResourceId, map: &Remapping) -> bool {
|
|
2792
|
+
if let Some(changed) = map.remap_id(id) {
|
|
2793
|
+
return changed;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
match map.resources.get(&id.resource()) {
|
|
2797
|
+
None => false,
|
|
2798
|
+
Some(new_id) => {
|
|
2799
|
+
*id.resource_mut() = *new_id;
|
|
2800
|
+
true
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
/// Recursively search for any resource types reachable from `id`, updating
|
|
2806
|
+
/// it and `map` if any are found and remapped, returning `true` iff at last
|
|
2807
|
+
/// one is remapped.
|
|
2808
|
+
fn remap_component_type_id(&mut self, id: &mut ComponentTypeId, map: &mut Remapping) -> bool {
|
|
2809
|
+
if let Some(changed) = map.remap_id(id) {
|
|
2810
|
+
return changed;
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
let mut any_changed = false;
|
|
2814
|
+
let mut ty = self[*id].clone();
|
|
2815
|
+
for ty in ty.imports.values_mut().chain(ty.exports.values_mut()) {
|
|
2816
|
+
any_changed |= self.remap_component_entity(ty, map);
|
|
2817
|
+
}
|
|
2818
|
+
for (id, _) in ty
|
|
2819
|
+
.imported_resources
|
|
2820
|
+
.iter_mut()
|
|
2821
|
+
.chain(&mut ty.defined_resources)
|
|
2822
|
+
{
|
|
2823
|
+
if let Some(new) = map.resources.get(id) {
|
|
2824
|
+
*id = *new;
|
|
2825
|
+
any_changed = true;
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
Self::map_map(&mut ty.explicit_resources, &mut any_changed, map);
|
|
2829
|
+
self.insert_if_any_changed(map, any_changed, id, ty)
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
/// Recursively search for any resource types reachable from `id`, updating
|
|
2833
|
+
/// it and `map` if any are found and remapped, returning `true` iff at last
|
|
2834
|
+
/// one is remapped.
|
|
2835
|
+
fn remap_component_defined_type_id(
|
|
2836
|
+
&mut self,
|
|
2837
|
+
id: &mut ComponentDefinedTypeId,
|
|
2838
|
+
map: &mut Remapping,
|
|
2839
|
+
) -> bool {
|
|
2840
|
+
if let Some(changed) = map.remap_id(id) {
|
|
2841
|
+
return changed;
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
let mut any_changed = false;
|
|
2845
|
+
let mut tmp = self[*id].clone();
|
|
2846
|
+
match &mut tmp {
|
|
2847
|
+
ComponentDefinedType::Primitive(_)
|
|
2848
|
+
| ComponentDefinedType::Flags(_)
|
|
2849
|
+
| ComponentDefinedType::Enum(_) => {}
|
|
2850
|
+
ComponentDefinedType::Record(r) => {
|
|
2851
|
+
for ty in r.fields.values_mut() {
|
|
2852
|
+
any_changed |= self.remap_valtype(ty, map);
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
ComponentDefinedType::Tuple(r) => {
|
|
2856
|
+
for ty in r.types.iter_mut() {
|
|
2857
|
+
any_changed |= self.remap_valtype(ty, map);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
ComponentDefinedType::Variant(r) => {
|
|
2861
|
+
for ty in r.cases.values_mut() {
|
|
2862
|
+
if let Some(ty) = &mut ty.ty {
|
|
2863
|
+
any_changed |= self.remap_valtype(ty, map);
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
ComponentDefinedType::List(ty)
|
|
2868
|
+
| ComponentDefinedType::FixedSizeList(ty, _)
|
|
2869
|
+
| ComponentDefinedType::Option(ty) => {
|
|
2870
|
+
any_changed |= self.remap_valtype(ty, map);
|
|
2871
|
+
}
|
|
2872
|
+
ComponentDefinedType::Map(k, v) => {
|
|
2873
|
+
any_changed |= self.remap_valtype(k, map);
|
|
2874
|
+
any_changed |= self.remap_valtype(v, map);
|
|
2875
|
+
}
|
|
2876
|
+
ComponentDefinedType::Result { ok, err } => {
|
|
2877
|
+
if let Some(ok) = ok {
|
|
2878
|
+
any_changed |= self.remap_valtype(ok, map);
|
|
2879
|
+
}
|
|
2880
|
+
if let Some(err) = err {
|
|
2881
|
+
any_changed |= self.remap_valtype(err, map);
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
ComponentDefinedType::Own(id) | ComponentDefinedType::Borrow(id) => {
|
|
2885
|
+
any_changed |= self.remap_resource_id(id, map);
|
|
2886
|
+
}
|
|
2887
|
+
ComponentDefinedType::Future(ty) | ComponentDefinedType::Stream(ty) => {
|
|
2888
|
+
if let Some(ty) = ty {
|
|
2889
|
+
any_changed |= self.remap_valtype(ty, map);
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
self.insert_if_any_changed(map, any_changed, id, tmp)
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
/// Recursively search for any resource types reachable from `id`, updating
|
|
2897
|
+
/// it and `map` if any are found and remapped, returning `true` iff at last
|
|
2898
|
+
/// one is remapped.
|
|
2899
|
+
fn remap_component_instance_type_id(
|
|
2900
|
+
&mut self,
|
|
2901
|
+
id: &mut ComponentInstanceTypeId,
|
|
2902
|
+
map: &mut Remapping,
|
|
2903
|
+
) -> bool {
|
|
2904
|
+
if let Some(changed) = map.remap_id(id) {
|
|
2905
|
+
return changed;
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
let mut any_changed = false;
|
|
2909
|
+
let mut tmp = self[*id].clone();
|
|
2910
|
+
for ty in tmp.exports.values_mut() {
|
|
2911
|
+
any_changed |= self.remap_component_entity(ty, map);
|
|
2912
|
+
}
|
|
2913
|
+
for id in tmp.defined_resources.iter_mut() {
|
|
2914
|
+
if let Some(new) = map.resources.get(id) {
|
|
2915
|
+
*id = *new;
|
|
2916
|
+
any_changed = true;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
Self::map_map(&mut tmp.explicit_resources, &mut any_changed, map);
|
|
2920
|
+
self.insert_if_any_changed(map, any_changed, id, tmp)
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
/// Recursively search for any resource types reachable from `id`, updating
|
|
2924
|
+
/// it and `map` if any are found and remapped, returning `true` iff at last
|
|
2925
|
+
/// one is remapped.
|
|
2926
|
+
fn remap_component_func_type_id(
|
|
2927
|
+
&mut self,
|
|
2928
|
+
id: &mut ComponentFuncTypeId,
|
|
2929
|
+
map: &mut Remapping,
|
|
2930
|
+
) -> bool {
|
|
2931
|
+
if let Some(changed) = map.remap_id(id) {
|
|
2932
|
+
return changed;
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
let mut any_changed = false;
|
|
2936
|
+
let mut tmp = self[*id].clone();
|
|
2937
|
+
for ty in tmp
|
|
2938
|
+
.params
|
|
2939
|
+
.iter_mut()
|
|
2940
|
+
.map(|(_, ty)| ty)
|
|
2941
|
+
.chain(&mut tmp.result)
|
|
2942
|
+
{
|
|
2943
|
+
any_changed |= self.remap_valtype(ty, map);
|
|
2944
|
+
}
|
|
2945
|
+
self.insert_if_any_changed(map, any_changed, id, tmp)
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
/// Same as `remap_type_id`, but works with `ComponentEntityType`.
|
|
2949
|
+
fn remap_component_entity(
|
|
2950
|
+
&mut self,
|
|
2951
|
+
ty: &mut ComponentEntityType,
|
|
2952
|
+
map: &mut Remapping,
|
|
2953
|
+
) -> bool {
|
|
2954
|
+
match ty {
|
|
2955
|
+
ComponentEntityType::Module(_) => {
|
|
2956
|
+
// Can't reference resources.
|
|
2957
|
+
false
|
|
2958
|
+
}
|
|
2959
|
+
ComponentEntityType::Func(id) => self.remap_component_func_type_id(id, map),
|
|
2960
|
+
ComponentEntityType::Instance(id) => self.remap_component_instance_type_id(id, map),
|
|
2961
|
+
ComponentEntityType::Component(id) => self.remap_component_type_id(id, map),
|
|
2962
|
+
ComponentEntityType::Type {
|
|
2963
|
+
referenced,
|
|
2964
|
+
created,
|
|
2965
|
+
} => {
|
|
2966
|
+
let mut changed = self.remap_component_any_type_id(referenced, map);
|
|
2967
|
+
if *referenced == *created {
|
|
2968
|
+
*created = *referenced;
|
|
2969
|
+
} else {
|
|
2970
|
+
changed |= self.remap_component_any_type_id(created, map);
|
|
2971
|
+
}
|
|
2972
|
+
changed
|
|
2973
|
+
}
|
|
2974
|
+
ComponentEntityType::Value(ty) => self.remap_valtype(ty, map),
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
/// Same as `remap_type_id`, but works with `ComponentValType`.
|
|
2979
|
+
fn remap_valtype(&mut self, ty: &mut ComponentValType, map: &mut Remapping) -> bool {
|
|
2980
|
+
match ty {
|
|
2981
|
+
ComponentValType::Primitive(_) => false,
|
|
2982
|
+
ComponentValType::Type(id) => self.remap_component_defined_type_id(id, map),
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
/// Utility for mapping equivalent `ResourceId`s to each other and (when paired with the `Remap` trait)
|
|
2988
|
+
/// non-destructively edit type lists to reflect those mappings.
|
|
2989
|
+
#[derive(Debug, Default)]
|
|
2990
|
+
pub struct Remapping {
|
|
2991
|
+
/// A mapping from old resource ID to new resource ID.
|
|
2992
|
+
pub(crate) resources: Map<ResourceId, ResourceId>,
|
|
2993
|
+
|
|
2994
|
+
/// A mapping filled in during the remapping process which records how a
|
|
2995
|
+
/// type was remapped, if applicable. This avoids remapping multiple
|
|
2996
|
+
/// references to the same type and instead only processing it once.
|
|
2997
|
+
types: Map<ComponentAnyTypeId, ComponentAnyTypeId>,
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
impl Remap for TypeAlloc {
|
|
3001
|
+
fn push_ty<T>(&mut self, ty: T) -> T::Id
|
|
3002
|
+
where
|
|
3003
|
+
T: TypeData,
|
|
3004
|
+
{
|
|
3005
|
+
<TypeList>::push(self, ty)
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
impl Remapping {
|
|
3010
|
+
/// Add a mapping from the specified old resource ID to the new resource ID
|
|
3011
|
+
pub fn add(&mut self, old: ResourceId, new: ResourceId) {
|
|
3012
|
+
self.resources.insert(old, new);
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
/// Clear the type cache while leaving the resource mappings intact.
|
|
3016
|
+
pub fn reset_type_cache(&mut self) {
|
|
3017
|
+
self.types.clear()
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
fn remap_id<T>(&self, id: &mut T) -> Option<bool>
|
|
3021
|
+
where
|
|
3022
|
+
T: Copy + Into<ComponentAnyTypeId> + TryFrom<ComponentAnyTypeId>,
|
|
3023
|
+
T::Error: core::fmt::Debug,
|
|
3024
|
+
{
|
|
3025
|
+
let old: ComponentAnyTypeId = (*id).into();
|
|
3026
|
+
let new = self.types.get(&old)?;
|
|
3027
|
+
if *new == old {
|
|
3028
|
+
Some(false)
|
|
3029
|
+
} else {
|
|
3030
|
+
*id = T::try_from(*new).expect("should never remap across different kinds");
|
|
3031
|
+
Some(true)
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
/// Helper structure used to perform subtyping computations.
|
|
3037
|
+
///
|
|
3038
|
+
/// This type is used whenever a subtype needs to be tested in one direction or
|
|
3039
|
+
/// the other. The methods of this type are the various entry points for
|
|
3040
|
+
/// subtyping.
|
|
3041
|
+
///
|
|
3042
|
+
/// Internally this contains arenas for two lists of types. The `a` arena is
|
|
3043
|
+
/// intended to be used for lookup of the first argument to all of the methods
|
|
3044
|
+
/// below, and the `b` arena is used for lookup of the second argument.
|
|
3045
|
+
///
|
|
3046
|
+
/// Arenas here are used specifically for component-based subtyping queries. In
|
|
3047
|
+
/// these situations new types must be created based on substitution mappings,
|
|
3048
|
+
/// but the types all have temporary lifetimes. Everything in these arenas is
|
|
3049
|
+
/// thrown away once the subtyping computation has finished.
|
|
3050
|
+
///
|
|
3051
|
+
/// Note that this subtyping context also explicitly supports being created
|
|
3052
|
+
/// from to different lists `a` and `b` originally, for testing subtyping
|
|
3053
|
+
/// between two different components for example.
|
|
3054
|
+
pub struct SubtypeCx<'a> {
|
|
3055
|
+
/// Lookup arena for first type argument
|
|
3056
|
+
pub a: SubtypeArena<'a>,
|
|
3057
|
+
/// Lookup arena for second type argument
|
|
3058
|
+
pub b: SubtypeArena<'a>,
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
macro_rules! limits_match {
|
|
3062
|
+
($a:expr, $b:expr) => {{
|
|
3063
|
+
let a = $a;
|
|
3064
|
+
let b = $b;
|
|
3065
|
+
a.initial >= b.initial
|
|
3066
|
+
&& match b.maximum {
|
|
3067
|
+
Some(b_max) => match a.maximum {
|
|
3068
|
+
Some(a_max) => a_max <= b_max,
|
|
3069
|
+
None => false,
|
|
3070
|
+
},
|
|
3071
|
+
None => true,
|
|
3072
|
+
}
|
|
3073
|
+
}};
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
impl<'a> SubtypeCx<'a> {
|
|
3077
|
+
/// Create a new instance with the specified type lists
|
|
3078
|
+
///
|
|
3079
|
+
/// # Panics
|
|
3080
|
+
///
|
|
3081
|
+
/// Panics if the two given `TypesRef`s are not associated with the same
|
|
3082
|
+
/// `Validator`.
|
|
3083
|
+
pub fn new_with_refs(a: TypesRef<'a>, b: TypesRef<'a>) -> SubtypeCx<'a> {
|
|
3084
|
+
assert_eq!(a.id(), b.id());
|
|
3085
|
+
Self::new(a.list, b.list)
|
|
3086
|
+
}
|
|
3087
|
+
|
|
3088
|
+
pub(crate) fn new(a: &'a TypeList, b: &'a TypeList) -> SubtypeCx<'a> {
|
|
3089
|
+
SubtypeCx {
|
|
3090
|
+
a: SubtypeArena::new(a),
|
|
3091
|
+
b: SubtypeArena::new(b),
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
/// Swap the type lists
|
|
3096
|
+
pub fn swap(&mut self) {
|
|
3097
|
+
mem::swap(&mut self.a, &mut self.b);
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
/// Executes the closure `f`, resetting the internal arenas to their
|
|
3101
|
+
/// original size after the closure finishes.
|
|
3102
|
+
///
|
|
3103
|
+
/// This enables `f` to modify the internal arenas while relying on all
|
|
3104
|
+
/// changes being discarded after the closure finishes.
|
|
3105
|
+
fn with_checkpoint<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T {
|
|
3106
|
+
let a = self.a.list.checkpoint();
|
|
3107
|
+
let b = self.b.list.checkpoint();
|
|
3108
|
+
let result = f(self);
|
|
3109
|
+
self.a.list.reset_to_checkpoint(a);
|
|
3110
|
+
self.b.list.reset_to_checkpoint(b);
|
|
3111
|
+
result
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
/// Tests whether `a` is a subtype of `b`.
|
|
3115
|
+
///
|
|
3116
|
+
/// Errors are reported at the `offset` specified.
|
|
3117
|
+
pub fn component_entity_type(
|
|
3118
|
+
&mut self,
|
|
3119
|
+
a: &ComponentEntityType,
|
|
3120
|
+
b: &ComponentEntityType,
|
|
3121
|
+
offset: usize,
|
|
3122
|
+
) -> Result<()> {
|
|
3123
|
+
use ComponentEntityType::*;
|
|
3124
|
+
|
|
3125
|
+
match (a, b) {
|
|
3126
|
+
(Module(a), Module(b)) => self.module_type(*a, *b, offset),
|
|
3127
|
+
(Module(_), b) => bail!(offset, "expected {}, found module", b.desc()),
|
|
3128
|
+
|
|
3129
|
+
(Func(a), Func(b)) => self.component_func_type(*a, *b, offset),
|
|
3130
|
+
(Func(_), b) => bail!(offset, "expected {}, found func", b.desc()),
|
|
3131
|
+
|
|
3132
|
+
(Value(a), Value(b)) => self.component_val_type(a, b, offset),
|
|
3133
|
+
(Value(_), b) => bail!(offset, "expected {}, found value", b.desc()),
|
|
3134
|
+
|
|
3135
|
+
(Type { referenced: a, .. }, Type { referenced: b, .. }) => {
|
|
3136
|
+
self.component_any_type_id(*a, *b, offset)
|
|
3137
|
+
}
|
|
3138
|
+
(Type { .. }, b) => bail!(offset, "expected {}, found type", b.desc()),
|
|
3139
|
+
|
|
3140
|
+
(Instance(a), Instance(b)) => self.component_instance_type(*a, *b, offset),
|
|
3141
|
+
(Instance(_), b) => bail!(offset, "expected {}, found instance", b.desc()),
|
|
3142
|
+
|
|
3143
|
+
(Component(a), Component(b)) => self.component_type(*a, *b, offset),
|
|
3144
|
+
(Component(_), b) => bail!(offset, "expected {}, found component", b.desc()),
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
/// Tests whether `a` is a subtype of `b`.
|
|
3149
|
+
///
|
|
3150
|
+
/// Errors are reported at the `offset` specified.
|
|
3151
|
+
pub fn component_type(
|
|
3152
|
+
&mut self,
|
|
3153
|
+
a: ComponentTypeId,
|
|
3154
|
+
b: ComponentTypeId,
|
|
3155
|
+
offset: usize,
|
|
3156
|
+
) -> Result<()> {
|
|
3157
|
+
// Components are ... tricky. They follow the same basic
|
|
3158
|
+
// structure as core wasm modules, but they also have extra
|
|
3159
|
+
// logic to handle resource types. Resources are effectively
|
|
3160
|
+
// abstract types so this is sort of where an ML module system
|
|
3161
|
+
// in the component model becomes a reality.
|
|
3162
|
+
//
|
|
3163
|
+
// This also leverages the `open_instance_type` method below
|
|
3164
|
+
// heavily which internally has its own quite large suite of
|
|
3165
|
+
// logic. More-or-less what's happening here is:
|
|
3166
|
+
//
|
|
3167
|
+
// 1. Pretend that the imports of B are given as values to the
|
|
3168
|
+
// imports of A. If A didn't import anything, for example,
|
|
3169
|
+
// that's great and the subtyping definitely passes there.
|
|
3170
|
+
// This operation produces a mapping of all the resources of
|
|
3171
|
+
// A's imports to resources in B's imports.
|
|
3172
|
+
//
|
|
3173
|
+
// 2. This mapping is applied to all of A's exports. This means
|
|
3174
|
+
// that all exports of A referring to A's imported resources
|
|
3175
|
+
// now instead refer to B's. Note, though that A's exports
|
|
3176
|
+
// still refer to its own defined resources.
|
|
3177
|
+
//
|
|
3178
|
+
// 3. The same `open_instance_type` method used during the
|
|
3179
|
+
// first step is used again, but this time on the exports
|
|
3180
|
+
// in the reverse direction. This performs a similar
|
|
3181
|
+
// operation, though, by creating a mapping from B's
|
|
3182
|
+
// defined resources to A's defined resources. The map
|
|
3183
|
+
// itself is discarded as it's not needed.
|
|
3184
|
+
//
|
|
3185
|
+
// The order that everything passed here is intentional, but
|
|
3186
|
+
// also subtle. I personally think of it as
|
|
3187
|
+
// `open_instance_type` takes a list of things to satisfy a
|
|
3188
|
+
// signature and produces a mapping of resources in the
|
|
3189
|
+
// signature to those provided in the list of things. The
|
|
3190
|
+
// order of operations then goes:
|
|
3191
|
+
//
|
|
3192
|
+
// * Someone thinks they have a component of type B, but they
|
|
3193
|
+
// actually have a component of type A (e.g. due to this
|
|
3194
|
+
// subtype check passing).
|
|
3195
|
+
// * This person provides the imports of B and that must be
|
|
3196
|
+
// sufficient to satisfy the imports of A. This is the first
|
|
3197
|
+
// `open_instance_type` check.
|
|
3198
|
+
// * Now though the resources provided by B are substituted
|
|
3199
|
+
// into A's exports since that's what was provided.
|
|
3200
|
+
// * A's exports are then handed back to the original person,
|
|
3201
|
+
// and these exports must satisfy the signature required by B
|
|
3202
|
+
// since that's what they're expecting.
|
|
3203
|
+
// * This is the second `open_instance_type` which, to get
|
|
3204
|
+
// resource types to line up, will map from A's defined
|
|
3205
|
+
// resources to B's defined resources.
|
|
3206
|
+
//
|
|
3207
|
+
// If all that passes then the resources should all line up
|
|
3208
|
+
// perfectly. Any misalignment is reported as a subtyping
|
|
3209
|
+
// error.
|
|
3210
|
+
let b_imports = self.b[b]
|
|
3211
|
+
.imports
|
|
3212
|
+
.iter()
|
|
3213
|
+
.map(|(name, ty)| (name.clone(), *ty))
|
|
3214
|
+
.collect();
|
|
3215
|
+
self.swap();
|
|
3216
|
+
let mut import_mapping =
|
|
3217
|
+
self.open_instance_type(&b_imports, a, ExternKind::Import, offset)?;
|
|
3218
|
+
self.swap();
|
|
3219
|
+
self.with_checkpoint(|this| {
|
|
3220
|
+
let mut a_exports = this.a[a]
|
|
3221
|
+
.exports
|
|
3222
|
+
.iter()
|
|
3223
|
+
.map(|(name, ty)| (name.clone(), *ty))
|
|
3224
|
+
.collect::<IndexMap<_, _>>();
|
|
3225
|
+
for ty in a_exports.values_mut() {
|
|
3226
|
+
this.a.remap_component_entity(ty, &mut import_mapping);
|
|
3227
|
+
}
|
|
3228
|
+
this.open_instance_type(&a_exports, b, ExternKind::Export, offset)?;
|
|
3229
|
+
Ok(())
|
|
3230
|
+
})
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
/// Tests whether `a` is a subtype of `b`.
|
|
3234
|
+
///
|
|
3235
|
+
/// Errors are reported at the `offset` specified.
|
|
3236
|
+
pub fn component_instance_type(
|
|
3237
|
+
&mut self,
|
|
3238
|
+
a_id: ComponentInstanceTypeId,
|
|
3239
|
+
b_id: ComponentInstanceTypeId,
|
|
3240
|
+
offset: usize,
|
|
3241
|
+
) -> Result<()> {
|
|
3242
|
+
// For instance type subtyping, all exports in the other
|
|
3243
|
+
// instance type must be present in this instance type's
|
|
3244
|
+
// exports (i.e. it can export *more* than what this instance
|
|
3245
|
+
// type needs).
|
|
3246
|
+
let a = &self.a[a_id];
|
|
3247
|
+
let b = &self.b[b_id];
|
|
3248
|
+
|
|
3249
|
+
let mut exports = Vec::with_capacity(b.exports.len());
|
|
3250
|
+
for (k, b) in b.exports.iter() {
|
|
3251
|
+
match a.exports.get(k) {
|
|
3252
|
+
Some(a) => exports.push((*a, *b)),
|
|
3253
|
+
None => bail!(offset, "missing expected export `{k}`"),
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
for (i, (a, b)) in exports.iter().enumerate() {
|
|
3257
|
+
let err = match self.component_entity_type(a, b, offset) {
|
|
3258
|
+
Ok(()) => continue,
|
|
3259
|
+
Err(e) => e,
|
|
3260
|
+
};
|
|
3261
|
+
// On failure attach the name of this export as context to
|
|
3262
|
+
// the error message to leave a breadcrumb trail.
|
|
3263
|
+
let (name, _) = self.b[b_id].exports.get_index(i).unwrap();
|
|
3264
|
+
return Err(err.with_context(|| format!("type mismatch in instance export `{name}`")));
|
|
3265
|
+
}
|
|
3266
|
+
Ok(())
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
/// Tests whether `a` is a subtype of `b`.
|
|
3270
|
+
///
|
|
3271
|
+
/// Errors are reported at the `offset` specified.
|
|
3272
|
+
pub fn component_func_type(
|
|
3273
|
+
&mut self,
|
|
3274
|
+
a: ComponentFuncTypeId,
|
|
3275
|
+
b: ComponentFuncTypeId,
|
|
3276
|
+
offset: usize,
|
|
3277
|
+
) -> Result<()> {
|
|
3278
|
+
let a = &self.a[a];
|
|
3279
|
+
let b = &self.b[b];
|
|
3280
|
+
|
|
3281
|
+
if a.async_ != b.async_ {
|
|
3282
|
+
let a_desc = if a.async_ { "async" } else { "sync" };
|
|
3283
|
+
let b_desc = if b.async_ { "async" } else { "sync" };
|
|
3284
|
+
bail!(
|
|
3285
|
+
offset,
|
|
3286
|
+
"expected {a_desc} function, found {b_desc} function",
|
|
3287
|
+
);
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3290
|
+
// Note that this intentionally diverges from the upstream
|
|
3291
|
+
// specification in terms of subtyping. This is a full
|
|
3292
|
+
// type-equality check which ensures that the structure of `a`
|
|
3293
|
+
// exactly matches the structure of `b`. The rationale for this
|
|
3294
|
+
// is:
|
|
3295
|
+
//
|
|
3296
|
+
// * Primarily in Wasmtime subtyping based on function types is
|
|
3297
|
+
// not implemented. This includes both subtyping a host
|
|
3298
|
+
// import and additionally handling subtyping as functions
|
|
3299
|
+
// cross component boundaries. The host import subtyping (or
|
|
3300
|
+
// component export subtyping) is not clear how to handle at
|
|
3301
|
+
// all at this time. The subtyping of functions between
|
|
3302
|
+
// components can more easily be handled by extending the
|
|
3303
|
+
// `fact` compiler, but that hasn't been done yet.
|
|
3304
|
+
//
|
|
3305
|
+
// * The upstream specification is currently pretty
|
|
3306
|
+
// intentionally vague precisely what subtyping is allowed.
|
|
3307
|
+
// Implementing a strict check here is intended to be a
|
|
3308
|
+
// conservative starting point for the component model which
|
|
3309
|
+
// can be extended in the future if necessary.
|
|
3310
|
+
//
|
|
3311
|
+
// * The interaction with subtyping on bindings generation, for
|
|
3312
|
+
// example, is a tricky problem that doesn't have a clear
|
|
3313
|
+
// answer at this time. Effectively this is more rationale
|
|
3314
|
+
// for being conservative in the first pass of the component
|
|
3315
|
+
// model.
|
|
3316
|
+
//
|
|
3317
|
+
// So, in conclusion, the test here (and other places that
|
|
3318
|
+
// reference this comment) is for exact type equality with no
|
|
3319
|
+
// differences.
|
|
3320
|
+
if a.params.len() != b.params.len() {
|
|
3321
|
+
bail!(
|
|
3322
|
+
offset,
|
|
3323
|
+
"expected {} parameters, found {}",
|
|
3324
|
+
b.params.len(),
|
|
3325
|
+
a.params.len(),
|
|
3326
|
+
);
|
|
3327
|
+
}
|
|
3328
|
+
for ((an, a), (bn, b)) in a.params.iter().zip(b.params.iter()) {
|
|
3329
|
+
if an != bn {
|
|
3330
|
+
bail!(offset, "expected parameter named `{bn}`, found `{an}`");
|
|
3331
|
+
}
|
|
3332
|
+
self.component_val_type(a, b, offset)
|
|
3333
|
+
.with_context(|| format!("type mismatch in function parameter `{an}`"))?;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
match (&a.result, &b.result) {
|
|
3337
|
+
(Some(a), Some(b)) => self
|
|
3338
|
+
.component_val_type(a, b, offset)
|
|
3339
|
+
.with_context(|| "type mismatch with result type")?,
|
|
3340
|
+
(None, None) => {}
|
|
3341
|
+
|
|
3342
|
+
(Some(_), None) => bail!(offset, "expected a result, found none"),
|
|
3343
|
+
(None, Some(_)) => bail!(offset, "expected no result, found one"),
|
|
3344
|
+
}
|
|
3345
|
+
Ok(())
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
/// Tests whether `a` is a subtype of `b`.
|
|
3349
|
+
///
|
|
3350
|
+
/// Errors are reported at the `offset` specified.
|
|
3351
|
+
pub fn module_type(
|
|
3352
|
+
&mut self,
|
|
3353
|
+
a: ComponentCoreModuleTypeId,
|
|
3354
|
+
b: ComponentCoreModuleTypeId,
|
|
3355
|
+
offset: usize,
|
|
3356
|
+
) -> Result<()> {
|
|
3357
|
+
// For module type subtyping, all exports in the other module
|
|
3358
|
+
// type must be present in this module type's exports (i.e. it
|
|
3359
|
+
// can export *more* than what this module type needs).
|
|
3360
|
+
// However, for imports, the check is reversed (i.e. it is okay
|
|
3361
|
+
// to import *less* than what this module type needs).
|
|
3362
|
+
self.swap();
|
|
3363
|
+
let a_imports = &self.b[a].imports;
|
|
3364
|
+
let b_imports = &self.a[b].imports;
|
|
3365
|
+
for (k, a) in a_imports {
|
|
3366
|
+
match b_imports.get(k) {
|
|
3367
|
+
Some(b) => self
|
|
3368
|
+
.entity_type(b, a, offset)
|
|
3369
|
+
.with_context(|| format!("type mismatch in import `{}::{}`", k.0, k.1))?,
|
|
3370
|
+
None => bail!(offset, "missing expected import `{}::{}`", k.0, k.1),
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
self.swap();
|
|
3374
|
+
let a = &self.a[a];
|
|
3375
|
+
let b = &self.b[b];
|
|
3376
|
+
for (k, b) in b.exports.iter() {
|
|
3377
|
+
match a.exports.get(k) {
|
|
3378
|
+
Some(a) => self
|
|
3379
|
+
.entity_type(a, b, offset)
|
|
3380
|
+
.with_context(|| format!("type mismatch in export `{k}`"))?,
|
|
3381
|
+
None => bail!(offset, "missing expected export `{k}`"),
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
Ok(())
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
/// Tests whether `a` is a subtype of `b`.
|
|
3388
|
+
///
|
|
3389
|
+
/// Errors are reported at the `offset` specified.
|
|
3390
|
+
pub fn component_any_type_id(
|
|
3391
|
+
&mut self,
|
|
3392
|
+
a: ComponentAnyTypeId,
|
|
3393
|
+
b: ComponentAnyTypeId,
|
|
3394
|
+
offset: usize,
|
|
3395
|
+
) -> Result<()> {
|
|
3396
|
+
match (a, b) {
|
|
3397
|
+
(ComponentAnyTypeId::Resource(a), ComponentAnyTypeId::Resource(b)) => {
|
|
3398
|
+
if a.resource() == b.resource() {
|
|
3399
|
+
Ok(())
|
|
3400
|
+
} else {
|
|
3401
|
+
bail!(
|
|
3402
|
+
offset,
|
|
3403
|
+
"resource types are not the same ({:?} vs. {:?})",
|
|
3404
|
+
a.resource(),
|
|
3405
|
+
b.resource()
|
|
3406
|
+
)
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
(ComponentAnyTypeId::Resource(_), b) => {
|
|
3410
|
+
bail!(offset, "expected {}, found resource", b.desc())
|
|
3411
|
+
}
|
|
3412
|
+
(ComponentAnyTypeId::Defined(a), ComponentAnyTypeId::Defined(b)) => {
|
|
3413
|
+
self.component_defined_type(a, b, offset)
|
|
3414
|
+
}
|
|
3415
|
+
(ComponentAnyTypeId::Defined(_), b) => {
|
|
3416
|
+
bail!(offset, "expected {}, found defined type", b.desc())
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
(ComponentAnyTypeId::Func(a), ComponentAnyTypeId::Func(b)) => {
|
|
3420
|
+
self.component_func_type(a, b, offset)
|
|
3421
|
+
}
|
|
3422
|
+
(ComponentAnyTypeId::Func(_), b) => {
|
|
3423
|
+
bail!(offset, "expected {}, found func type", b.desc())
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
(ComponentAnyTypeId::Instance(a), ComponentAnyTypeId::Instance(b)) => {
|
|
3427
|
+
self.component_instance_type(a, b, offset)
|
|
3428
|
+
}
|
|
3429
|
+
(ComponentAnyTypeId::Instance(_), b) => {
|
|
3430
|
+
bail!(offset, "expected {}, found instance type", b.desc())
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3433
|
+
(ComponentAnyTypeId::Component(a), ComponentAnyTypeId::Component(b)) => {
|
|
3434
|
+
self.component_type(a, b, offset)
|
|
3435
|
+
}
|
|
3436
|
+
(ComponentAnyTypeId::Component(_), b) => {
|
|
3437
|
+
bail!(offset, "expected {}, found component type", b.desc())
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
/// The building block for subtyping checks when components are
|
|
3443
|
+
/// instantiated and when components are tested if they're subtypes of each
|
|
3444
|
+
/// other.
|
|
3445
|
+
///
|
|
3446
|
+
/// This method takes a number of arguments:
|
|
3447
|
+
///
|
|
3448
|
+
/// * `a` - this is a list of typed items which can be thought of as
|
|
3449
|
+
/// concrete values to test against `b`.
|
|
3450
|
+
/// * `b` - this `TypeId` must point to `Type::Component`.
|
|
3451
|
+
/// * `kind` - indicates whether the `imports` or `exports` of `b` are
|
|
3452
|
+
/// being tested against for the values in `a`.
|
|
3453
|
+
/// * `offset` - the binary offset at which to report errors if one happens.
|
|
3454
|
+
///
|
|
3455
|
+
/// This will attempt to determine if the items in `a` satisfy the
|
|
3456
|
+
/// signature required by the `kind` items of `b`. For example component
|
|
3457
|
+
/// instantiation will have `a` as the list of arguments provided to
|
|
3458
|
+
/// instantiation, `b` is the component being instantiated, and `kind` is
|
|
3459
|
+
/// `ExternKind::Import`.
|
|
3460
|
+
///
|
|
3461
|
+
/// This function, if successful, will return a mapping of the resources in
|
|
3462
|
+
/// `b` to the resources in `a` provided. This mapping is guaranteed to
|
|
3463
|
+
/// contain all the resources for `b` (all imported resources for
|
|
3464
|
+
/// `ExternKind::Import` or all defined resources for `ExternKind::Export`).
|
|
3465
|
+
pub fn open_instance_type(
|
|
3466
|
+
&mut self,
|
|
3467
|
+
a: &IndexMap<String, ComponentEntityType>,
|
|
3468
|
+
b: ComponentTypeId,
|
|
3469
|
+
kind: ExternKind,
|
|
3470
|
+
offset: usize,
|
|
3471
|
+
) -> Result<Remapping> {
|
|
3472
|
+
// First, determine the mapping from resources in `b` to those supplied
|
|
3473
|
+
// by arguments in `a`.
|
|
3474
|
+
//
|
|
3475
|
+
// This loop will iterate over all the appropriate resources in `b`
|
|
3476
|
+
// and find the corresponding resource in `args`. The exact lists
|
|
3477
|
+
// in use here depend on the `kind` provided. This necessarily requires
|
|
3478
|
+
// a sequence of string lookups to find the corresponding items in each
|
|
3479
|
+
// list.
|
|
3480
|
+
//
|
|
3481
|
+
// The path to each resource in `resources` is precomputed as a list of
|
|
3482
|
+
// indexes. The first index is into `b`'s list of `entities`, and gives
|
|
3483
|
+
// the name that `b` assigns to the resource. Each subsequent index,
|
|
3484
|
+
// if present, means that this resource was present through a layer of
|
|
3485
|
+
// an instance type, and the index is into the instance type's exports.
|
|
3486
|
+
// More information about this can be found on
|
|
3487
|
+
// `ComponentState::imported_resources`.
|
|
3488
|
+
//
|
|
3489
|
+
// This loop will follow the list of indices for each resource and, at
|
|
3490
|
+
// the same time, walk through the arguments supplied to instantiating
|
|
3491
|
+
// the `component_type`. This means that within `component_type`
|
|
3492
|
+
// index-based lookups are performed while in `args` name-based
|
|
3493
|
+
// lookups are performed.
|
|
3494
|
+
//
|
|
3495
|
+
// Note that here it's possible that `args` doesn't actually supply the
|
|
3496
|
+
// correct type of import for each item since argument checking has
|
|
3497
|
+
// not proceeded yet. These type errors, however, aren't handled by
|
|
3498
|
+
// this loop and are deferred below to the main subtyping check. That
|
|
3499
|
+
// means that `mapping` won't necessarily have a mapping for all
|
|
3500
|
+
// imported resources into `component_type`, but that should be ok.
|
|
3501
|
+
let component_type = &self.b[b];
|
|
3502
|
+
let entities = match kind {
|
|
3503
|
+
ExternKind::Import => &component_type.imports,
|
|
3504
|
+
ExternKind::Export => &component_type.exports,
|
|
3505
|
+
};
|
|
3506
|
+
let resources = match kind {
|
|
3507
|
+
ExternKind::Import => &component_type.imported_resources,
|
|
3508
|
+
ExternKind::Export => &component_type.defined_resources,
|
|
3509
|
+
};
|
|
3510
|
+
let mut mapping = Remapping::default();
|
|
3511
|
+
'outer: for (resource, path) in resources.iter() {
|
|
3512
|
+
// Lookup the first path item in `imports` and the corresponding
|
|
3513
|
+
// entry in `args` by name.
|
|
3514
|
+
let (name, ty) = entities.get_index(path[0]).unwrap();
|
|
3515
|
+
let mut ty = *ty;
|
|
3516
|
+
let mut arg = a.get(name);
|
|
3517
|
+
|
|
3518
|
+
// Lookup all the subsequent `path` entries, if any, by index in
|
|
3519
|
+
// `ty` and by name in `arg`. Type errors in `arg` are skipped over
|
|
3520
|
+
// entirely.
|
|
3521
|
+
for i in path.iter().skip(1).copied() {
|
|
3522
|
+
let id = match ty {
|
|
3523
|
+
ComponentEntityType::Instance(id) => id,
|
|
3524
|
+
_ => unreachable!(),
|
|
3525
|
+
};
|
|
3526
|
+
let (name, next_ty) = self.b[id].exports.get_index(i).unwrap();
|
|
3527
|
+
ty = *next_ty;
|
|
3528
|
+
arg = match arg {
|
|
3529
|
+
Some(ComponentEntityType::Instance(id)) => self.a[*id].exports.get(name),
|
|
3530
|
+
_ => continue 'outer,
|
|
3531
|
+
};
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
// Double-check that `ty`, the leaf type of `component_type`, is
|
|
3535
|
+
// indeed the expected resource.
|
|
3536
|
+
if cfg!(debug_assertions) {
|
|
3537
|
+
let id = match ty {
|
|
3538
|
+
ComponentEntityType::Type { created, .. } => match created {
|
|
3539
|
+
ComponentAnyTypeId::Resource(id) => id.resource(),
|
|
3540
|
+
_ => unreachable!(),
|
|
3541
|
+
},
|
|
3542
|
+
_ => unreachable!(),
|
|
3543
|
+
};
|
|
3544
|
+
assert_eq!(id, *resource);
|
|
3545
|
+
}
|
|
3546
|
+
|
|
3547
|
+
// The leaf of `arg` should be a type which is a resource. If not
|
|
3548
|
+
// it's skipped and this'll wind up generating an error later on in
|
|
3549
|
+
// subtype checking below.
|
|
3550
|
+
if let Some(ComponentEntityType::Type { created, .. }) = arg {
|
|
3551
|
+
if let ComponentAnyTypeId::Resource(r) = created {
|
|
3552
|
+
mapping.resources.insert(*resource, r.resource());
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3557
|
+
// Now that a mapping from the resources in `b` to the resources in `a`
|
|
3558
|
+
// has been determined it's possible to perform the actual subtype
|
|
3559
|
+
// check.
|
|
3560
|
+
//
|
|
3561
|
+
// This subtype check notably needs to ensure that all resource types
|
|
3562
|
+
// line up. To achieve this the `mapping` previously calculated is used
|
|
3563
|
+
// to perform a substitution on each component entity type.
|
|
3564
|
+
//
|
|
3565
|
+
// The first loop here performs a name lookup to create a list of
|
|
3566
|
+
// values from `a` to expected items in `b`. Once the list is created
|
|
3567
|
+
// the substitution check is performed on each element.
|
|
3568
|
+
let mut to_typecheck = Vec::new();
|
|
3569
|
+
for (name, expected) in entities.iter() {
|
|
3570
|
+
match a.get(name) {
|
|
3571
|
+
Some(arg) => to_typecheck.push((*arg, *expected)),
|
|
3572
|
+
None => bail!(offset, "missing {} named `{name}`", kind.desc()),
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
let mut type_map = Map::default();
|
|
3576
|
+
for (i, (actual, expected)) in to_typecheck.into_iter().enumerate() {
|
|
3577
|
+
let result = self.with_checkpoint(|this| {
|
|
3578
|
+
let mut expected = expected;
|
|
3579
|
+
this.b.remap_component_entity(&mut expected, &mut mapping);
|
|
3580
|
+
mapping.types.clear();
|
|
3581
|
+
this.component_entity_type(&actual, &expected, offset)
|
|
3582
|
+
});
|
|
3583
|
+
let err = match result {
|
|
3584
|
+
Ok(()) => {
|
|
3585
|
+
// On a successful type-check record a mapping of
|
|
3586
|
+
// type-to-type in `type_map` for any type imports that were
|
|
3587
|
+
// satisfied. This is then used afterwards when performing
|
|
3588
|
+
// type substitution to remap all component-local types to
|
|
3589
|
+
// those that were provided in the imports.
|
|
3590
|
+
self.register_type_renamings(actual, expected, &mut type_map);
|
|
3591
|
+
continue;
|
|
3592
|
+
}
|
|
3593
|
+
Err(e) => e,
|
|
3594
|
+
};
|
|
3595
|
+
|
|
3596
|
+
// If an error happens then attach the name of the entity to the
|
|
3597
|
+
// error message using the `i` iteration counter.
|
|
3598
|
+
let component_type = &self.b[b];
|
|
3599
|
+
let entities = match kind {
|
|
3600
|
+
ExternKind::Import => &component_type.imports,
|
|
3601
|
+
ExternKind::Export => &component_type.exports,
|
|
3602
|
+
};
|
|
3603
|
+
let (name, _) = entities.get_index(i).unwrap();
|
|
3604
|
+
return Err(err.with_context(|| format!("type mismatch for {} `{name}`", kind.desc())));
|
|
3605
|
+
}
|
|
3606
|
+
mapping.types = type_map;
|
|
3607
|
+
Ok(mapping)
|
|
3608
|
+
}
|
|
3609
|
+
|
|
3610
|
+
pub(crate) fn entity_type(&self, a: &EntityType, b: &EntityType, offset: usize) -> Result<()> {
|
|
3611
|
+
match (a, b) {
|
|
3612
|
+
(EntityType::Func(a), EntityType::Func(b))
|
|
3613
|
+
| (EntityType::FuncExact(a), EntityType::Func(b)) => {
|
|
3614
|
+
self.core_func_type(*a, *b, offset)
|
|
3615
|
+
}
|
|
3616
|
+
(EntityType::Func(_), b) => bail!(offset, "expected {}, found func", b.desc()),
|
|
3617
|
+
(EntityType::FuncExact(a), EntityType::FuncExact(b)) => {
|
|
3618
|
+
self.core_func_type(*b, *a, offset)?;
|
|
3619
|
+
self.core_func_type(*a, *b, offset)
|
|
3620
|
+
}
|
|
3621
|
+
(EntityType::FuncExact(_), b) => {
|
|
3622
|
+
bail!(offset, "expected {}, found func_exact", b.desc())
|
|
3623
|
+
}
|
|
3624
|
+
(EntityType::Table(a), EntityType::Table(b)) => Self::table_type(a, b, offset),
|
|
3625
|
+
(EntityType::Table(_), b) => bail!(offset, "expected {}, found table", b.desc()),
|
|
3626
|
+
(EntityType::Memory(a), EntityType::Memory(b)) => Self::memory_type(a, b, offset),
|
|
3627
|
+
(EntityType::Memory(_), b) => bail!(offset, "expected {}, found memory", b.desc()),
|
|
3628
|
+
(EntityType::Global(a), EntityType::Global(b)) => {
|
|
3629
|
+
if a.mutable != b.mutable {
|
|
3630
|
+
bail!(offset, "global types differ in mutability")
|
|
3631
|
+
}
|
|
3632
|
+
if a.content_type == b.content_type {
|
|
3633
|
+
Ok(())
|
|
3634
|
+
} else {
|
|
3635
|
+
bail!(
|
|
3636
|
+
offset,
|
|
3637
|
+
"expected global type {}, found {}",
|
|
3638
|
+
b.content_type,
|
|
3639
|
+
a.content_type,
|
|
3640
|
+
)
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
(EntityType::Global(_), b) => bail!(offset, "expected {}, found global", b.desc()),
|
|
3644
|
+
(EntityType::Tag(a), EntityType::Tag(b)) => self.core_func_type(*a, *b, offset),
|
|
3645
|
+
(EntityType::Tag(_), b) => bail!(offset, "expected {}, found tag", b.desc()),
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3649
|
+
pub(crate) fn table_type(a: &TableType, b: &TableType, offset: usize) -> Result<()> {
|
|
3650
|
+
if a.element_type != b.element_type {
|
|
3651
|
+
bail!(
|
|
3652
|
+
offset,
|
|
3653
|
+
"expected table element type {}, found {}",
|
|
3654
|
+
b.element_type,
|
|
3655
|
+
a.element_type,
|
|
3656
|
+
)
|
|
3657
|
+
}
|
|
3658
|
+
if a.shared != b.shared {
|
|
3659
|
+
bail!(offset, "mismatch in the shared flag for tables")
|
|
3660
|
+
}
|
|
3661
|
+
if limits_match!(a, b) {
|
|
3662
|
+
Ok(())
|
|
3663
|
+
} else {
|
|
3664
|
+
bail!(offset, "mismatch in table limits")
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
pub(crate) fn memory_type(a: &MemoryType, b: &MemoryType, offset: usize) -> Result<()> {
|
|
3669
|
+
if a.shared != b.shared {
|
|
3670
|
+
bail!(offset, "mismatch in the shared flag for memories")
|
|
3671
|
+
}
|
|
3672
|
+
if a.memory64 != b.memory64 {
|
|
3673
|
+
bail!(offset, "mismatch in index type used for memories")
|
|
3674
|
+
}
|
|
3675
|
+
if limits_match!(a, b) {
|
|
3676
|
+
Ok(())
|
|
3677
|
+
} else {
|
|
3678
|
+
bail!(offset, "mismatch in memory limits")
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
fn core_func_type(&self, a: CoreTypeId, b: CoreTypeId, offset: usize) -> Result<()> {
|
|
3683
|
+
debug_assert!(self.a.get(a).is_some());
|
|
3684
|
+
debug_assert!(self.b.get(b).is_some());
|
|
3685
|
+
if self.a.id_is_subtype(a, b) {
|
|
3686
|
+
debug_assert!(self.a.get(b).is_some());
|
|
3687
|
+
debug_assert!(self.b.get(a).is_some());
|
|
3688
|
+
Ok(())
|
|
3689
|
+
} else {
|
|
3690
|
+
bail!(
|
|
3691
|
+
offset,
|
|
3692
|
+
"expected: {}\n\
|
|
3693
|
+
found: {}",
|
|
3694
|
+
self.b[b],
|
|
3695
|
+
self.a[a],
|
|
3696
|
+
)
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
pub(crate) fn component_val_type(
|
|
3701
|
+
&self,
|
|
3702
|
+
a: &ComponentValType,
|
|
3703
|
+
b: &ComponentValType,
|
|
3704
|
+
offset: usize,
|
|
3705
|
+
) -> Result<()> {
|
|
3706
|
+
match (a, b) {
|
|
3707
|
+
(ComponentValType::Primitive(a), ComponentValType::Primitive(b)) => {
|
|
3708
|
+
self.primitive_val_type(*a, *b, offset)
|
|
3709
|
+
}
|
|
3710
|
+
(ComponentValType::Type(a), ComponentValType::Type(b)) => {
|
|
3711
|
+
self.component_defined_type(*a, *b, offset)
|
|
3712
|
+
}
|
|
3713
|
+
(ComponentValType::Primitive(a), ComponentValType::Type(b)) => match &self.b[*b] {
|
|
3714
|
+
ComponentDefinedType::Primitive(b) => self.primitive_val_type(*a, *b, offset),
|
|
3715
|
+
b => bail!(offset, "expected {}, found {a}", b.desc()),
|
|
3716
|
+
},
|
|
3717
|
+
(ComponentValType::Type(a), ComponentValType::Primitive(b)) => match &self.a[*a] {
|
|
3718
|
+
ComponentDefinedType::Primitive(a) => self.primitive_val_type(*a, *b, offset),
|
|
3719
|
+
a => bail!(offset, "expected {b}, found {}", a.desc()),
|
|
3720
|
+
},
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3724
|
+
fn component_defined_type(
|
|
3725
|
+
&self,
|
|
3726
|
+
a: ComponentDefinedTypeId,
|
|
3727
|
+
b: ComponentDefinedTypeId,
|
|
3728
|
+
offset: usize,
|
|
3729
|
+
) -> Result<()> {
|
|
3730
|
+
use ComponentDefinedType::*;
|
|
3731
|
+
|
|
3732
|
+
// Note that the implementation of subtyping here diverges from the
|
|
3733
|
+
// upstream specification intentionally, see the documentation on
|
|
3734
|
+
// function subtyping for more information.
|
|
3735
|
+
match (&self.a[a], &self.b[b]) {
|
|
3736
|
+
(Primitive(a), Primitive(b)) => self.primitive_val_type(*a, *b, offset),
|
|
3737
|
+
(Primitive(a), b) => bail!(offset, "expected {}, found {a}", b.desc()),
|
|
3738
|
+
(Record(a), Record(b)) => {
|
|
3739
|
+
if a.fields.len() != b.fields.len() {
|
|
3740
|
+
bail!(
|
|
3741
|
+
offset,
|
|
3742
|
+
"expected {} fields, found {}",
|
|
3743
|
+
b.fields.len(),
|
|
3744
|
+
a.fields.len(),
|
|
3745
|
+
);
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3748
|
+
for ((aname, a), (bname, b)) in a.fields.iter().zip(b.fields.iter()) {
|
|
3749
|
+
if aname != bname {
|
|
3750
|
+
bail!(offset, "expected field name `{bname}`, found `{aname}`");
|
|
3751
|
+
}
|
|
3752
|
+
self.component_val_type(a, b, offset)
|
|
3753
|
+
.with_context(|| format!("type mismatch in record field `{aname}`"))?;
|
|
3754
|
+
}
|
|
3755
|
+
Ok(())
|
|
3756
|
+
}
|
|
3757
|
+
(Record(_), b) => bail!(offset, "expected {}, found record", b.desc()),
|
|
3758
|
+
(Variant(a), Variant(b)) => {
|
|
3759
|
+
if a.cases.len() != b.cases.len() {
|
|
3760
|
+
bail!(
|
|
3761
|
+
offset,
|
|
3762
|
+
"expected {} cases, found {}",
|
|
3763
|
+
b.cases.len(),
|
|
3764
|
+
a.cases.len(),
|
|
3765
|
+
);
|
|
3766
|
+
}
|
|
3767
|
+
for ((aname, a), (bname, b)) in a.cases.iter().zip(b.cases.iter()) {
|
|
3768
|
+
if aname != bname {
|
|
3769
|
+
bail!(offset, "expected case named `{bname}`, found `{aname}`");
|
|
3770
|
+
}
|
|
3771
|
+
match (&a.ty, &b.ty) {
|
|
3772
|
+
(Some(a), Some(b)) => self
|
|
3773
|
+
.component_val_type(a, b, offset)
|
|
3774
|
+
.with_context(|| format!("type mismatch in variant case `{aname}`"))?,
|
|
3775
|
+
(None, None) => {}
|
|
3776
|
+
(None, Some(_)) => {
|
|
3777
|
+
bail!(offset, "expected case `{aname}` to have a type, found none")
|
|
3778
|
+
}
|
|
3779
|
+
(Some(_), None) => bail!(offset, "expected case `{aname}` to have no type"),
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
Ok(())
|
|
3783
|
+
}
|
|
3784
|
+
(Variant(_), b) => bail!(offset, "expected {}, found variant", b.desc()),
|
|
3785
|
+
(List(a), List(b)) | (Option(a), Option(b)) => self.component_val_type(a, b, offset),
|
|
3786
|
+
(List(_), b) => bail!(offset, "expected {}, found list", b.desc()),
|
|
3787
|
+
(Map(ak, av), Map(bk, bv)) => {
|
|
3788
|
+
self.component_val_type(ak, bk, offset)
|
|
3789
|
+
.with_context(|| "type mismatch in map key")?;
|
|
3790
|
+
self.component_val_type(av, bv, offset)
|
|
3791
|
+
.with_context(|| "type mismatch in map value")
|
|
3792
|
+
}
|
|
3793
|
+
(Map(_, _), b) => bail!(offset, "expected {}, found map", b.desc()),
|
|
3794
|
+
(FixedSizeList(a, asize), FixedSizeList(b, bsize)) => {
|
|
3795
|
+
if asize != bsize {
|
|
3796
|
+
bail!(offset, "expected fixed size {bsize}, found size {asize}")
|
|
3797
|
+
} else {
|
|
3798
|
+
self.component_val_type(a, b, offset)
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
(FixedSizeList(_, _), b) => bail!(offset, "expected {}, found list", b.desc()),
|
|
3802
|
+
(Option(_), b) => bail!(offset, "expected {}, found option", b.desc()),
|
|
3803
|
+
(Tuple(a), Tuple(b)) => {
|
|
3804
|
+
if a.types.len() != b.types.len() {
|
|
3805
|
+
bail!(
|
|
3806
|
+
offset,
|
|
3807
|
+
"expected {} types, found {}",
|
|
3808
|
+
b.types.len(),
|
|
3809
|
+
a.types.len(),
|
|
3810
|
+
);
|
|
3811
|
+
}
|
|
3812
|
+
for (i, (a, b)) in a.types.iter().zip(b.types.iter()).enumerate() {
|
|
3813
|
+
self.component_val_type(a, b, offset)
|
|
3814
|
+
.with_context(|| format!("type mismatch in tuple field {i}"))?;
|
|
3815
|
+
}
|
|
3816
|
+
Ok(())
|
|
3817
|
+
}
|
|
3818
|
+
(Tuple(_), b) => bail!(offset, "expected {}, found tuple", b.desc()),
|
|
3819
|
+
(at @ Flags(a), Flags(b)) | (at @ Enum(a), Enum(b)) => {
|
|
3820
|
+
let desc = match at {
|
|
3821
|
+
Flags(_) => "flags",
|
|
3822
|
+
_ => "enum",
|
|
3823
|
+
};
|
|
3824
|
+
if a.len() == b.len() && a.iter().eq(b.iter()) {
|
|
3825
|
+
Ok(())
|
|
3826
|
+
} else {
|
|
3827
|
+
bail!(offset, "mismatch in {desc} elements")
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
(Flags(_), b) => bail!(offset, "expected {}, found flags", b.desc()),
|
|
3831
|
+
(Enum(_), b) => bail!(offset, "expected {}, found enum", b.desc()),
|
|
3832
|
+
(Result { ok: ao, err: ae }, Result { ok: bo, err: be }) => {
|
|
3833
|
+
match (ao, bo) {
|
|
3834
|
+
(None, None) => {}
|
|
3835
|
+
(Some(a), Some(b)) => self
|
|
3836
|
+
.component_val_type(a, b, offset)
|
|
3837
|
+
.with_context(|| "type mismatch in ok variant")?,
|
|
3838
|
+
(None, Some(_)) => bail!(offset, "expected ok type, but found none"),
|
|
3839
|
+
(Some(_), None) => bail!(offset, "expected ok type to not be present"),
|
|
3840
|
+
}
|
|
3841
|
+
match (ae, be) {
|
|
3842
|
+
(None, None) => {}
|
|
3843
|
+
(Some(a), Some(b)) => self
|
|
3844
|
+
.component_val_type(a, b, offset)
|
|
3845
|
+
.with_context(|| "type mismatch in err variant")?,
|
|
3846
|
+
(None, Some(_)) => bail!(offset, "expected err type, but found none"),
|
|
3847
|
+
(Some(_), None) => bail!(offset, "expected err type to not be present"),
|
|
3848
|
+
}
|
|
3849
|
+
Ok(())
|
|
3850
|
+
}
|
|
3851
|
+
(Result { .. }, b) => bail!(offset, "expected {}, found result", b.desc()),
|
|
3852
|
+
(Own(a), Own(b)) | (Borrow(a), Borrow(b)) => {
|
|
3853
|
+
if a.resource() == b.resource() {
|
|
3854
|
+
Ok(())
|
|
3855
|
+
} else {
|
|
3856
|
+
bail!(offset, "resource types are not the same")
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
(Own(_), b) => bail!(offset, "expected {}, found own", b.desc()),
|
|
3860
|
+
(Borrow(_), b) => bail!(offset, "expected {}, found borrow", b.desc()),
|
|
3861
|
+
(Future(a), Future(b)) => match (a, b) {
|
|
3862
|
+
(None, None) => Ok(()),
|
|
3863
|
+
(Some(a), Some(b)) => self
|
|
3864
|
+
.component_val_type(a, b, offset)
|
|
3865
|
+
.with_context(|| "type mismatch in future"),
|
|
3866
|
+
(None, Some(_)) => bail!(offset, "expected future type, but found none"),
|
|
3867
|
+
(Some(_), None) => bail!(offset, "expected future type to not be present"),
|
|
3868
|
+
},
|
|
3869
|
+
(Future(_), b) => bail!(offset, "expected {}, found future", b.desc()),
|
|
3870
|
+
(Stream(a), Stream(b)) => match (a, b) {
|
|
3871
|
+
(None, None) => Ok(()),
|
|
3872
|
+
(Some(a), Some(b)) => self
|
|
3873
|
+
.component_val_type(a, b, offset)
|
|
3874
|
+
.with_context(|| "type mismatch in stream"),
|
|
3875
|
+
(None, Some(_)) => bail!(offset, "expected stream type, but found none"),
|
|
3876
|
+
(Some(_), None) => bail!(offset, "expected stream type to not be present"),
|
|
3877
|
+
},
|
|
3878
|
+
(Stream(_), b) => bail!(offset, "expected {}, found stream", b.desc()),
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3882
|
+
fn primitive_val_type(
|
|
3883
|
+
&self,
|
|
3884
|
+
a: PrimitiveValType,
|
|
3885
|
+
b: PrimitiveValType,
|
|
3886
|
+
offset: usize,
|
|
3887
|
+
) -> Result<()> {
|
|
3888
|
+
// Note that this intentionally diverges from the upstream specification
|
|
3889
|
+
// at this time and only considers exact equality for subtyping
|
|
3890
|
+
// relationships.
|
|
3891
|
+
//
|
|
3892
|
+
// More information can be found in the subtyping implementation for
|
|
3893
|
+
// component functions.
|
|
3894
|
+
if a == b {
|
|
3895
|
+
Ok(())
|
|
3896
|
+
} else {
|
|
3897
|
+
bail!(offset, "expected primitive `{b}` found primitive `{a}`")
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
|
|
3901
|
+
fn register_type_renamings(
|
|
3902
|
+
&self,
|
|
3903
|
+
actual: ComponentEntityType,
|
|
3904
|
+
expected: ComponentEntityType,
|
|
3905
|
+
type_map: &mut Map<ComponentAnyTypeId, ComponentAnyTypeId>,
|
|
3906
|
+
) {
|
|
3907
|
+
match (expected, actual) {
|
|
3908
|
+
(
|
|
3909
|
+
ComponentEntityType::Type {
|
|
3910
|
+
created: expected, ..
|
|
3911
|
+
},
|
|
3912
|
+
ComponentEntityType::Type {
|
|
3913
|
+
created: actual, ..
|
|
3914
|
+
},
|
|
3915
|
+
) => {
|
|
3916
|
+
let prev = type_map.insert(expected, actual);
|
|
3917
|
+
assert!(prev.is_none());
|
|
3918
|
+
}
|
|
3919
|
+
(ComponentEntityType::Instance(expected), ComponentEntityType::Instance(actual)) => {
|
|
3920
|
+
let actual = &self.a[actual];
|
|
3921
|
+
for (name, expected) in self.b[expected].exports.iter() {
|
|
3922
|
+
let actual = actual.exports[name];
|
|
3923
|
+
self.register_type_renamings(actual, *expected, type_map);
|
|
3924
|
+
}
|
|
3925
|
+
}
|
|
3926
|
+
_ => {}
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
|
|
3931
|
+
/// A helper typed used purely during subtyping as part of `SubtypeCx`.
|
|
3932
|
+
///
|
|
3933
|
+
/// This takes a `types` list as input which is the "base" of the ids that can
|
|
3934
|
+
/// be indexed through this arena. All future types pushed into this, if any,
|
|
3935
|
+
/// are stored in `self.list`.
|
|
3936
|
+
///
|
|
3937
|
+
/// This is intended to have arena-like behavior where everything pushed onto
|
|
3938
|
+
/// `self.list` is thrown away after a subtyping computation is performed. All
|
|
3939
|
+
/// new types pushed into this arena are purely temporary.
|
|
3940
|
+
pub struct SubtypeArena<'a> {
|
|
3941
|
+
types: &'a TypeList,
|
|
3942
|
+
list: TypeList,
|
|
3943
|
+
}
|
|
3944
|
+
|
|
3945
|
+
impl<'a> SubtypeArena<'a> {
|
|
3946
|
+
fn new(types: &'a TypeList) -> SubtypeArena<'a> {
|
|
3947
|
+
SubtypeArena {
|
|
3948
|
+
types,
|
|
3949
|
+
list: TypeList::default(),
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
|
|
3953
|
+
fn get<T>(&self, id: T) -> Option<&T::Data>
|
|
3954
|
+
where
|
|
3955
|
+
T: TypeIdentifier,
|
|
3956
|
+
{
|
|
3957
|
+
let index = id.index();
|
|
3958
|
+
if index < T::list(self.types).len() {
|
|
3959
|
+
self.types.get(id)
|
|
3960
|
+
} else {
|
|
3961
|
+
let temp_index = index - T::list(self.types).len();
|
|
3962
|
+
let temp_index = u32::try_from(temp_index).unwrap();
|
|
3963
|
+
let temp_id = T::from_index(temp_index);
|
|
3964
|
+
self.list.get(temp_id)
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
|
|
3968
|
+
/// Is `a == b` or was `a` declared (potentially transitively) to be a
|
|
3969
|
+
/// subtype of `b`?
|
|
3970
|
+
fn id_is_subtype(&self, a: CoreTypeId, b: CoreTypeId) -> bool {
|
|
3971
|
+
self.get(a).is_some() && self.get(b).is_some() && {
|
|
3972
|
+
// NB: we can query `self.types.id_is_subtype` directly, and ignore
|
|
3973
|
+
// `self.list`, because `self.list` should never contain core types.
|
|
3974
|
+
debug_assert!(a.index() < CoreTypeId::list(self.types).len());
|
|
3975
|
+
debug_assert!(b.index() < CoreTypeId::list(self.types).len());
|
|
3976
|
+
self.types.id_is_subtype(a, b)
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
|
|
3981
|
+
impl<T> Index<T> for SubtypeArena<'_>
|
|
3982
|
+
where
|
|
3983
|
+
T: TypeIdentifier,
|
|
3984
|
+
{
|
|
3985
|
+
type Output = T::Data;
|
|
3986
|
+
|
|
3987
|
+
fn index(&self, id: T) -> &T::Data {
|
|
3988
|
+
self.get(id).unwrap()
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3992
|
+
impl Remap for SubtypeArena<'_> {
|
|
3993
|
+
fn push_ty<T>(&mut self, ty: T) -> T::Id
|
|
3994
|
+
where
|
|
3995
|
+
T: TypeData,
|
|
3996
|
+
{
|
|
3997
|
+
assert!(
|
|
3998
|
+
!T::IS_CORE_SUB_TYPE,
|
|
3999
|
+
"cannot push core sub types into `SubtypeArena`s, that would break type canonicalization"
|
|
4000
|
+
);
|
|
4001
|
+
let index = T::Id::list(&self.list).len() + T::Id::list(self.types).len();
|
|
4002
|
+
let index = u32::try_from(index).unwrap();
|
|
4003
|
+
self.list.push(ty);
|
|
4004
|
+
T::Id::from_index(index)
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
|
|
4008
|
+
/// Helper trait for adding contextual information to an error, modeled after
|
|
4009
|
+
/// `anyhow::Context`.
|
|
4010
|
+
pub(crate) trait Context {
|
|
4011
|
+
fn with_context<S>(self, context: impl FnOnce() -> S) -> Self
|
|
4012
|
+
where
|
|
4013
|
+
S: Into<String>;
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
impl<T> Context for Result<T> {
|
|
4017
|
+
fn with_context<S>(self, context: impl FnOnce() -> S) -> Self
|
|
4018
|
+
where
|
|
4019
|
+
S: Into<String>,
|
|
4020
|
+
{
|
|
4021
|
+
match self {
|
|
4022
|
+
Ok(val) => Ok(val),
|
|
4023
|
+
Err(e) => Err(e.with_context(context)),
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
impl Context for BinaryReaderError {
|
|
4029
|
+
fn with_context<S>(mut self, context: impl FnOnce() -> S) -> Self
|
|
4030
|
+
where
|
|
4031
|
+
S: Into<String>,
|
|
4032
|
+
{
|
|
4033
|
+
self.add_context(context().into());
|
|
4034
|
+
self
|
|
4035
|
+
}
|
|
4036
|
+
}
|