Update to latest TinyGo and Rust (#2368)

Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
This commit is contained in:
Anuraag (Rag) Agrawal
2025-01-22 00:42:05 +09:00
committed by GitHub
parent c6e819e6af
commit 8358482d4a
24 changed files with 133 additions and 185 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ on:
env: env:
EMSDK_VERSION: "3.1.40" EMSDK_VERSION: "3.1.40"
TINYGO_VERSION: "0.33.0" TINYGO_VERSION: "0.35.0"
ZIG_VERSION: "0.11.0" ZIG_VERSION: "0.11.0"
concurrency: concurrency:
@@ -80,7 +80,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable toolchain: stable
targets: wasm32-unknown-unknown, wasm32-wasi targets: wasm32-unknown-unknown, wasm32-wasip1
- name: Build TinyGo examples - name: Build TinyGo examples
run: make build.examples.tinygo run: make build.examples.tinygo
+1 -1
View File
@@ -19,7 +19,7 @@ defaults:
env: # Update this prior to requiring a higher minor version in go.mod env: # Update this prior to requiring a higher minor version in go.mod
GO_VERSION: "1.23" GO_VERSION: "1.23"
TINYGO_VERSION: "0.33.0" TINYGO_VERSION: "0.35.0"
ZIG_VERSION: "0.11.0" ZIG_VERSION: "0.11.0"
BINARYEN_VERSION: "116" BINARYEN_VERSION: "116"
STDLIB_TESTS: "internal/integration_test/stdlibs" STDLIB_TESTS: "internal/integration_test/stdlibs"
+20 -10
View File
@@ -36,14 +36,24 @@ build.examples.as:
build.examples.zig: examples/allocation/zig/testdata/greet.wasm imports/wasi_snapshot_preview1/example/testdata/zig/cat.wasm imports/wasi_snapshot_preview1/testdata/zig/wasi.wasm build.examples.zig: examples/allocation/zig/testdata/greet.wasm imports/wasi_snapshot_preview1/example/testdata/zig/cat.wasm imports/wasi_snapshot_preview1/testdata/zig/wasi.wasm
@cd internal/testing/dwarftestdata/testdata/zig; zig build; mv zig-out/*/main.wasm ./ # Need DWARF custom sections. @cd internal/testing/dwarftestdata/testdata/zig; zig build; mv zig-out/*/main.wasm ./ # Need DWARF custom sections.
tinygo_sources := examples/basic/testdata/add.go examples/allocation/tinygo/testdata/greet.go examples/cli/testdata/cli.go imports/wasi_snapshot_preview1/example/testdata/tinygo/cat.go imports/wasi_snapshot_preview1/testdata/tinygo/wasi.go cmd/wazero/testdata/cat/cat.go tinygo_reactor_sources_reactor := examples/basic/testdata/add.go examples/allocation/tinygo/testdata/greet.go
.PHONY: build.examples.tinygo .PHONY: build.examples.tinygo_reactor
build.examples.tinygo: $(tinygo_sources) build.examples.tinygo_reactor: $(tinygo_sources_reactor)
@for f in $^; do \ @for f in $^; do \
tinygo build -o $$(echo $$f | sed -e 's/\.go/\.wasm/') -scheduler=none --no-debug --target=wasi $$f; \ tinygo build -o $$(echo $$f | sed -e 's/\.go/\.wasm/') -scheduler=none --no-debug --target=wasip1 -buildmode=c-shared $$f; \
done
tinygo_sources_clis := examples/cli/testdata/cli.go imports/wasi_snapshot_preview1/example/testdata/tinygo/cat.go imports/wasi_snapshot_preview1/testdata/tinygo/wasi.go cmd/wazero/testdata/cat/cat.go
.PHONY: build.examples.tinygo_clis
build.examples.tinygo_clis: $(tinygo_sources_clis)
@for f in $^; do \
tinygo build -o $$(echo $$f | sed -e 's/\.go/\.wasm/') -scheduler=none --no-debug --target=wasip1 $$f; \
done done
@mv cmd/wazero/testdata/cat/cat.wasm cmd/wazero/testdata/cat/cat-tinygo.wasm @mv cmd/wazero/testdata/cat/cat.wasm cmd/wazero/testdata/cat/cat-tinygo.wasm
.PHONY: build.examples.tinygo
build.examples.tinygo: build.examples.tinygo_reactor build.examples.tinygo_clis
# We use zig to build C as it is easy to install and embeds a copy of zig-cc. # We use zig to build C as it is easy to install and embeds a copy of zig-cc.
# Note: Don't use "-Oz" as that breaks our wasi sock example. # Note: Don't use "-Oz" as that breaks our wasi sock example.
c_sources := imports/wasi_snapshot_preview1/example/testdata/zig-cc/cat.c imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.c internal/testing/dwarftestdata/testdata/zig-cc/main.c c_sources := imports/wasi_snapshot_preview1/example/testdata/zig-cc/cat.c imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.c internal/testing/dwarftestdata/testdata/zig-cc/main.c
@@ -80,21 +90,21 @@ build.examples.emscripten: $(emscripten_sources)
done done
%/greet.wasm : cargo_target := wasm32-unknown-unknown %/greet.wasm : cargo_target := wasm32-unknown-unknown
%/cat.wasm : cargo_target := wasm32-wasi %/cat.wasm : cargo_target := wasm32-wasip1
%/wasi.wasm : cargo_target := wasm32-wasi %/wasi.wasm : cargo_target := wasm32-wasip1
.PHONY: build.examples.rust .PHONY: build.examples.rust
build.examples.rust: examples/allocation/rust/testdata/greet.wasm imports/wasi_snapshot_preview1/example/testdata/cargo-wasi/cat.wasm imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.wasm internal/testing/dwarftestdata/testdata/rust/main.wasm.xz build.examples.rust: examples/allocation/rust/testdata/greet.wasm imports/wasi_snapshot_preview1/example/testdata/cargo-wasi/cat.wasm imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.wasm internal/testing/dwarftestdata/testdata/rust/main.wasm.xz
# Normally, we build release because it is smaller. Testing dwarf requires the debug build. # Normally, we build release because it is smaller. Testing dwarf requires the debug build.
internal/testing/dwarftestdata/testdata/rust/main.wasm.xz: internal/testing/dwarftestdata/testdata/rust/main.wasm.xz:
cd $(@D) && cargo wasi build cd $(@D) && cargo build --target wasm32-wasip1
mv $(@D)/target/wasm32-wasi/debug/main.wasm $(@D) mv $(@D)/target/wasm32-wasip1/debug/main.wasm $(@D)
cd $(@D) && xz -k -f ./main.wasm # Rust's DWARF section is huge, so compress it. cd $(@D) && xz -k -f ./main.wasm # Rust's DWARF section is huge, so compress it.
# Builds rust using cargo normally, or cargo-wasi. # Builds rust using cargo normally
%.wasm: %.rs %.wasm: %.rs
@(cd $(@D); cargo $(if $(findstring wasi,$(cargo_target)),wasi build,build --target $(cargo_target)) --release) @(cd $(@D); cargo build --target $(cargo_target) --release)
@mv $(@D)/target/$(cargo_target)/release/$(@F) $(@D) @mv $(@D)/target/$(cargo_target)/release/$(@F) $(@D)
spectest_base_dir := internal/integration_test/spectest spectest_base_dir := internal/integration_test/spectest
Vendored Executable → Regular
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -337,9 +337,9 @@ func TestRun(t *testing.T) {
<== (opened_fd=4,errno=ESUCCESS) <== (opened_fd=4,errno=ESUCCESS)
==> wasi_snapshot_preview1.fd_filestat_get(fd=4) ==> wasi_snapshot_preview1.fd_filestat_get(fd=4)
<== (filestat={filetype=REGULAR_FILE,size=5,mtim=%d},errno=ESUCCESS) <== (filestat={filetype=REGULAR_FILE,size=5,mtim=%d},errno=ESUCCESS)
==> wasi_snapshot_preview1.fd_read(fd=4,iovs=64744,iovs_len=1) ==> wasi_snapshot_preview1.fd_read(fd=4,iovs=64664,iovs_len=1)
<== (nread=5,errno=ESUCCESS) <== (nread=5,errno=ESUCCESS)
==> wasi_snapshot_preview1.fd_read(fd=4,iovs=64744,iovs_len=1) ==> wasi_snapshot_preview1.fd_read(fd=4,iovs=64664,iovs_len=1)
<== (nread=0,errno=ESUCCESS) <== (nread=0,errno=ESUCCESS)
==> wasi_snapshot_preview1.fd_close(fd=4) ==> wasi_snapshot_preview1.fd_close(fd=4)
<== errno=ESUCCESS <== errno=ESUCCESS
+1 -1
View File
@@ -39,7 +39,7 @@ func Example() {
// Instantiate the guest Wasm into the same runtime. It exports the `add` // Instantiate the guest Wasm into the same runtime. It exports the `add`
// function, implemented in WebAssembly. // function, implemented in WebAssembly.
mod, err := r.Instantiate(ctx, addWasm) mod, err := r.InstantiateWithConfig(ctx, addWasm, wazero.NewModuleConfig().WithStartFunctions("_initialize"))
if err != nil { if err != nil {
log.Panicln(err) log.Panicln(err)
} }
Binary file not shown.
+5 -1
View File
@@ -1,7 +1,11 @@
## TinyGo allocation example ## TinyGo allocation example
This example shows how to pass strings in and out of a Wasm function defined This example shows how to pass strings in and out of a Wasm function defined
in TinyGo, built with `tinygo build -o greet.wasm -scheduler=none -target=wasi greet.go` in TinyGo, built with
```bash
(cd testdata; tinygo build -scheduler=none -target=wasip1 -buildmode=c-shared -o greet.wasm greet.go)
```
```bash ```bash
$ go run greet.go wazero $ go run greet.go wazero
+1 -1
View File
@@ -44,7 +44,7 @@ func main() {
// Instantiate a WebAssembly module that imports the "log" function defined // Instantiate a WebAssembly module that imports the "log" function defined
// in "env" and exports "memory" and functions we'll use in this example. // in "env" and exports "memory" and functions we'll use in this example.
mod, err := r.Instantiate(ctx, greetWasm) mod, err := r.InstantiateWithConfig(ctx, greetWasm, wazero.NewModuleConfig().WithStartFunctions("_initialize"))
if err != nil { if err != nil {
log.Panicln(err) log.Panicln(err)
} }
+2 -2
View File
@@ -38,7 +38,7 @@ func greeting(name string) string {
// _greet is a WebAssembly export that accepts a string pointer (linear memory // _greet is a WebAssembly export that accepts a string pointer (linear memory
// offset) and calls greet. // offset) and calls greet.
// //
//export greet //go:wasmexport greet
func _greet(ptr, size uint32) { func _greet(ptr, size uint32) {
name := ptrToString(ptr, size) name := ptrToString(ptr, size)
greet(name) greet(name)
@@ -50,7 +50,7 @@ func _greet(ptr, size uint32) {
// Note: This uses a uint64 instead of two result values for compatibility with // Note: This uses a uint64 instead of two result values for compatibility with
// WebAssembly 1.0. // WebAssembly 1.0.
// //
//export greeting //go:wasmexport greeting
func _greeting(ptr, size uint32) (ptrSize uint64) { func _greeting(ptr, size uint32) (ptrSize uint64) {
name := ptrToString(ptr, size) name := ptrToString(ptr, size)
g := greeting(name) g := greeting(name)
Vendored Executable → Regular
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -19,7 +19,7 @@ typically a `%.wasm` file.
the minimal command to build a `%.wasm` binary. the minimal command to build a `%.wasm` binary.
```bash ```bash
cd testdata; tinygo build -o add.wasm -target=wasi add.go (cd testdata; tinygo build -buildmode=c-shared -target=wasip1 -o add.wasm add.go)
``` ```
### Notes ### Notes
+1 -1
View File
@@ -42,7 +42,7 @@ func main() {
// Instantiate the guest Wasm into the same runtime. It exports the `add` // Instantiate the guest Wasm into the same runtime. It exports the `add`
// function, implemented in WebAssembly. // function, implemented in WebAssembly.
mod, err := r.Instantiate(ctx, addWasm) mod, err := r.InstantiateWithConfig(ctx, addWasm, wazero.NewModuleConfig().WithStartFunctions("_initialize"))
if err != nil { if err != nil {
log.Panicf("failed to instantiate module: %v", err) log.Panicf("failed to instantiate module: %v", err)
} }
+1 -1
View File
@@ -1,6 +1,6 @@
package main package main
//export add //go:wasmexport add
func add(x, y uint32) uint32 { func add(x, y uint32) uint32 {
return x + y return x + y
} }
Vendored Executable → Regular
BIN
View File
Binary file not shown.
Vendored Executable → Regular
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+41 -70
View File
@@ -85,77 +85,48 @@ wasm stack trace:
} }
func testRustDWARF(t *testing.T, r wazero.Runtime) { func testRustDWARF(t *testing.T, r wazero.Runtime) {
runDWARFTest(t, r, dwarftestdata.RustWasm, `module[] function[_start] failed: wasm error: unreachable runDWARFTest(t, r, dwarftestdata.RustWasm, `module[main-144f120e836a09da.wasm] function[_start] failed: wasm error: unreachable
wasm stack trace: wasm stack trace:
.__rust_start_panic(i32) i32 main-144f120e836a09da.wasm.__rust_start_panic(i32,i32) i32
0xc474: /index.rs:286:39 (inlined) 0x3276: /lib.rs:100:17 (inlined)
/const_ptr.rs:870:18 (inlined) /lib.rs:43:5
/index.rs:286:39 (inlined) main-144f120e836a09da.wasm.rust_panic(i32,i32)
/mod.rs:1630:46 (inlined) 0x31c8: /panicking.rs:862:25
/mod.rs:405:20 (inlined) main-144f120e836a09da.wasm._ZN3std9panicking20rust_panic_with_hook17hf4c55e90d4731159E(i32,i32,i32,i32,i32)
/mod.rs:1630:46 (inlined) 0x319b: /panicking.rs:826:5
/mod.rs:1548:18 (inlined) main-144f120e836a09da.wasm._ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17h9e9ba254d816924bE(i32)
/iter.rs:1478:30 (inlined) 0x25e2: /panicking.rs:667:13
/count.rs:74:18 main-144f120e836a09da.wasm._ZN3std3sys9backtrace26__rust_end_short_backtrace17h5fb21e191bc452e3E(i32)
.rust_panic(i32,i32) 0x251c: /backtrace.rs:170:18
0xa3f8: /validations.rs:57:19 (inlined) main-144f120e836a09da.wasm.rust_begin_unwind(i32)
/validations.rs:57:19 (inlined) 0x2b2f: /panicking.rs:665:5
/iter.rs:140:15 (inlined) main-144f120e836a09da.wasm._ZN4core9panicking9panic_fmt17hfe24bec0337a4754E(i32,i32)
/iter.rs:140:15 (inlined) 0x798a: /panicking.rs:76:14
/iterator.rs:330:13 (inlined) main-144f120e836a09da.wasm._ZN4main4main17hef810e4bf58d9cdfE()
/iterator.rs:377:9 (inlined) 0x373: /main.rs:12:5 (inlined)
/mod.rs:1455:35 /main.rs:7:5 (inlined)
.std::panicking::rust_panic_with_hook::h93e119628869d575(i32,i32,i32,i32,i32) /main.rs:2:5
0x42df: /alloc.rs:244:22 (inlined) main-144f120e836a09da.wasm._ZN4core3ops8function6FnOnce9call_once17hb3419529f8e10fb1E(i32)
/alloc.rs:244:22 (inlined) 0x124: /function.rs:250:5
/alloc.rs:342:9 (inlined) main-144f120e836a09da.wasm._ZN3std3sys9backtrace28__rust_begin_short_backtrace17h6b7139fa671fb72eE(i32)
/mod.rs:487:1 (inlined) 0x289: /backtrace.rs:154:18
/mod.rs:487:1 (inlined) main-144f120e836a09da.wasm._ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hefb60d097516fc9fE(i32) i32
/mod.rs:487:1 (inlined) 0x20c: /rt.rs:195:18
/mod.rs:487:1 (inlined) main-144f120e836a09da.wasm._ZN3std2rt19lang_start_internal17h1fceb22bbe5297a1E(i32,i32,i32,i32,i32) i32
/mod.rs:487:1 (inlined) 0x1780: /function.rs:284:13 (inlined)
/panicking.rs:292:17 (inlined) /panicking.rs:557:40 (inlined)
/panicking.rs:292:17 /panicking.rs:520:19 (inlined)
.std::panicking::begin_panic_handler::{{closure}}::h2b8c0798e533b227(i32,i32,i32) /panic.rs:358:14 (inlined)
0xaa8c: /mod.rs:362:12 (inlined) /rt.rs:174:48 (inlined)
/mod.rs:1257:22 (inlined) /panicking.rs:557:40 (inlined)
/mod.rs:1235:21 (inlined) /panicking.rs:520:19 (inlined)
/mod.rs:1214:26 /panic.rs:358:14 (inlined)
.std::sys_common::backtrace::__rust_end_short_backtrace::h030a533bc034da65(i32) /rt.rs:174:20
0xc144: /mod.rs:188:26 main-144f120e836a09da.wasm._ZN3std2rt10lang_start17he470b12ea6d4e370E(i32,i32,i32,i32) i32
.rust_begin_unwind(i32) 0x1a8: /rt.rs:194:17
0xb7df: /mod.rs:1629:9 (inlined) main-144f120e836a09da.wasm.__main_void() i32
/builders.rs:199:17 (inlined) main-144f120e836a09da.wasm._start()
/result.rs:1352:22 (inlined) 0x37: wasisdk:/crt1-command.c:43:13`)
/builders.rs:187:23
.core::panicking::panic_fmt::hb1bfc4175f838eff(i32,i32)
0xbd3d: /mod.rs:1384:17
.main::main::hfd44f54575e6bfdf()
0xad2c: /memchr.rs
.core::ops::function::FnOnce::call_once::h87e5f77996df3e28(i32)
0xbd61: /mod.rs
.std::sys_common::backtrace::__rust_begin_short_backtrace::h7ca17eb6aa97f768(i32)
0xbd95: /mod.rs:1504:35 (inlined)
/mod.rs:1407:36
.std::rt::lang_start::{{closure}}::he4aa401e76315dfe(i32) i32
0xae9a: /location.rs:196:6
.std::rt::lang_start_internal::h3c39e5d3c278a90f(i32,i32,i32,i32) i32
.std::rt::lang_start::h779801844bd22a3c(i32,i32,i32) i32
0xab94: /mod.rs:1226:2
.__original_main() i32
0xc0ae: /methods.rs:1677:13 (inlined)
/mod.rs:165:24 (inlined)
/mod.rs:165:24
._start()
0xc10f: /mod.rs:187
._start.command_export()
0xc3de: /iterator.rs:2414:21 (inlined)
/map.rs:124:9 (inlined)
/accum.rs:42:17 (inlined)
/iterator.rs:3347:9 (inlined)
/count.rs:135:5 (inlined)
/count.rs:135:5 (inlined)
/count.rs:71:21`)
} }
func runDWARFTest(t *testing.T, r wazero.Runtime, bin []byte, exp string) { func runDWARFTest(t *testing.T, r wazero.Runtime, bin []byte, exp string) {
+1 -1
View File
@@ -133,7 +133,7 @@ build.tinygo:
@mkdir -p $(tinygo_bin) @mkdir -p $(tinygo_bin)
for value in $(tinygo_tests); do\ for value in $(tinygo_tests); do\
echo Building $${value}... ;\ echo Building $${value}... ;\
tinygo test -target wasi -c -o $(tinygo_bin)/$$(echo $$value | sed -e 's/\//_/g').test $${value} 2>&1 >/dev/null ;\ tinygo test -target wasip1 -c -o $(tinygo_bin)/$$(echo $$value | sed -e 's/\//_/g').test $${value} 2>&1 >/dev/null ;\
done done
.PHONY: build.gowasip1 .PHONY: build.gowasip1
BIN
View File
Binary file not shown.
+54 -91
View File
@@ -82,7 +82,7 @@ func TestDWARFLines_Line_Rust(t *testing.T) {
// codeSecStart is the beginning of the code section in the Wasm binary. // codeSecStart is the beginning of the code section in the Wasm binary.
// If dwarftestdata.RustWasm has been changed, we need to inspect by `wasm-tools objdump`. // If dwarftestdata.RustWasm has been changed, we need to inspect by `wasm-tools objdump`.
const codeSecStart = 0x309 const codeSecStart = 0x20d
// These cases are crafted by matching the stack trace result from wasmtime. To verify, run: // These cases are crafted by matching the stack trace result from wasmtime. To verify, run:
// //
@@ -90,101 +90,64 @@ func TestDWARFLines_Line_Rust(t *testing.T) {
// //
// And this should produce the output as: // And this should produce the output as:
// Caused by: // Caused by:
// 0: failed to invoke command default // 0: failed to invoke command default
// 1: error while executing at wasm backtrace: // 1: error while executing at wasm backtrace:
// 0: 0xc77d - core::ptr::const_ptr::<impl *const T>::offset::ha55096d7e14d75d8 // 0: 0x3483 - panic_abort::__rust_start_panic::abort::hd05f7e510a9bfacb
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/slice/index.rs:286:39 - core::ptr::const_ptr::<impl *const T>::add::h089d5a72f68a4291 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/panic_abort/src/lib.rs:100:17 - __rust_start_panic
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/ptr/const_ptr.rs:870:18 - <core::ops::range::Range<usize> as core::slice::index::SliceIndex<[T]>>::get_unchecked::h29ddcf1882fa0f66 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/panic_abort/src/lib.rs:43:5
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/slice/index.rs:286:39 - <core::ops::range::RangeFrom<usize> as core::slice::index::SliceIndex<[T]>>::get_unchecked::h75ebc890f16858ff // 1: 0x33d5 - rust_panic
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/slice/mod.rs:1630:46 - core::slice::<impl [T]>::get_unchecked::h6278e5a065ea078a // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:862:25
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/slice/mod.rs:405:20 - core::slice::<impl [T]>::split_at_unchecked::h88a6f1e7c576a79c // 2: 0x33a8 - std::panicking::rust_panic_with_hook::hf4c55e90d4731159
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/slice/mod.rs:1630:46 - core::slice::<impl [T]>::split_at::h68e6904057100aef // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:826:5
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/slice/mod.rs:1548:18 - <core::slice::iter::Chunks<T> as core::iter::traits::iterator::Iterator>::next::h9e3ea1e50ad1cfcf // 3: 0x27ef - std::panicking::begin_panic_handler::{{closure}}::h9e9ba254d816924b
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/slice/iter.rs:1478:30 - core::str::count::do_count_chars::h124622240ac1fb8b // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:667:13
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/str/count.rs:74:18 // 4: 0x2729 - std::sys::backtrace::__rust_end_short_backtrace::h5fb21e191bc452e3
// 1: 0xa701 - core::str::validations::utf8_acc_cont_byte::hb47c34b8c4cbf06b // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/sys/backtrace.rs:170:18
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/str/validations.rs:57:19 - core::str::validations::next_code_point::hbb42fe8b8fcbddc3 // 5: 0x2d3c - rust_begin_unwind
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/str/validations.rs:57:19 - <core::str::iter::Chars as core::iter::traits::iterator::Iterator>::next::h2dc4678e3c0bda18 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:665:5
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/str/iter.rs:140:15 - <core::str::iter::CharIndices as core::iter::traits::iterator::Iterator>::next::h430b9a1b0d2fcfcd // 6: 0x7b97 - core::panicking::panic_fmt::hfe24bec0337a4754
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/str/iter.rs:140:15 - core::iter::traits::iterator::Iterator::advance_by::hadbf2e62b9ea873e // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:76:14
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/iter/traits/iterator.rs:330:13 - core::iter::traits::iterator::Iterator::nth::h68978ac344a2c26f // 7: 0x580 - main::b::h7fe25a8329542864
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/iter/traits/iterator.rs:377:9 - core::fmt::Formatter::pad::hc91f9fb3fb51f81f // at /Users/anuraag/git/wazero/internal/testing/dwarftestdata/testdata/rust/main.rs:12:5 - main::a::hf5dc043bad87cf46
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1455:35 // at /Users/anuraag/git/wazero/internal/testing/dwarftestdata/testdata/rust/main.rs:7:5 - main::main::hef810e4bf58d9cdf
// 2: 0x45e8 - alloc::alloc::dealloc::hde3d57428722ee9b // at /Users/anuraag/git/wazero/internal/testing/dwarftestdata/testdata/rust/main.rs:2:5
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/alloc/src/alloc.rs:244:22 - <alloc::alloc::Global as core::alloc::Allocator>::deallocate::h9c672f23742d6fbc // 8: 0x331 - core::ops::function::FnOnce::call_once::hb3419529f8e10fb1
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/alloc/src/alloc.rs:244:22 - alloc::alloc::box_free::hd090040c59659308 // at /Users/anuraag/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/alloc/src/alloc.rs:342:9 - core::ptr::drop_in_place<alloc::boxed::Box<std::io::error::Custom>>::h3d2c76e2b4a26668 // 9: 0x496 - std::sys::backtrace::__rust_begin_short_backtrace::h6b7139fa671fb72e
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/ptr/mod.rs:487:1 - core::ptr::drop_in_place<std::io::error::ErrorData<alloc::boxed::Box<std::io::error::Custom>>>::hcaa143fc963fdc85 // at /Users/anuraag/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:154:18
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/ptr/mod.rs:487:1 - core::ptr::drop_in_place<std::io::error::repr_unpacked::Repr>::hf8eda15dbd953cd1 // 10: 0x419 - std::rt::lang_start::{{closure}}::hefb60d097516fc9f
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/ptr/mod.rs:487:1 - core::ptr::drop_in_place<std::io::error::Error>::ha50d906acd95a768 // at /Users/anuraag/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:195:18
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/ptr/mod.rs:487:1 - core::ptr::drop_in_place<core::result::Result<(),std::io::error::Error>>::h1a246d5cbc0481cf // 11: 0x198d - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h13726548ebbd9f5e
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/ptr/mod.rs:487:1 - core::mem::drop::h37b541d3c993930c // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/ops/function.rs:284:13 - std::panicking::try::do_call::h486344993a14f2c0
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/std/src/panicking.rs:292:17 - std::panicking::default_hook::{{closure}}::h78d75d30689791e7 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:557:40 - std::panicking::try::hedadb8cd413b03f6
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/std/src/panicking.rs:292:17 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:520:19 - std::panic::catch_unwind::hc1f7f9244b2fb00b
// 3: 0xad95 - core::fmt::ArgumentV1::as_usize::h1da6b057d1a7dc54 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panic.rs:358:14 - std::rt::lang_start_internal::{{closure}}::hfb0e2b398e86f6de
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:362:12 - core::fmt::getcount::h8c5d6b3aea75a2d3 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/rt.rs:174:48 - std::panicking::try::do_call::hebcae3b56ebbc340
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1257:22 - core::fmt::run::h78a98448d78ecec3 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:557:40 - std::panicking::try::h8850f6913d04c130
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1235:21 - core::fmt::write::h5471a2341ce22f17 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:520:19 - std::panic::catch_unwind::hf3726b3a12c06aad
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1214:26 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panic.rs:358:14 - std::rt::lang_start_internal::h1fceb22bbe5297a1
// 4: 0xc44d - core::fmt::Write::write_fmt::h4a7e084f8beacf08 // at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/rt.rs:174:20
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:188:26 // 12: 0x3b5 - std::rt::lang_start::he470b12ea6d4e370
// 5: 0xbae8 - core::fmt::Formatter::write_str::hc634aaecc183d175 // at /Users/anuraag/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:194:17
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1629:9 - core::fmt::builders::DebugStruct::finish_non_exhaustive::{{closure}}::h51dc89dce87b7120 // 13: 0x5a4 - main-144f120e836a09da.wasm!__main_void
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/builders.rs:199:17 - core::result::Result<T,E>::and_then::hea34a5d4dd616ad6 // 14: 0x244 - _start
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/result.rs:1352:22 - core::fmt::builders::DebugStruct::finish_non_exhaustive::h87daf5524c71dda9 // at wasisdk://v23.0/build/sysroot/wasi-libc-wasm32-wasip1/libc-bottom-half/crt/crt1-command.c:43:13
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/builders.rs:187:23 // 2: wasm trap: wasm `unreachable` instruction executed
// 6: 0xc046 - core::fmt::Formatter::pad_integral::ha8bb3db77298fecc
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1384:17
// 7: 0xb035 - core::slice::memchr::memchr_general_case::hb481b2edf3b1871e
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/slice/memchr.rs
// 8: 0xc06a - core::fmt::Formatter::pad_integral::ha8bb3db77298fecc
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs
// 9: 0xc09e - core::fmt::Formatter::padding::h4b882ffb39d00a12
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1504:35 - core::fmt::Formatter::pad_integral::ha8bb3db77298fecc
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1407:36
// 10: 0xb1a3 - <core::panic::location::Location as core::fmt::Display>::fmt::hf3870c0af6a67fac
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/panic/location.rs:196:6
// 11: 0x8ee0 - <unknown>!std::rt::lang_start_internal::h3c39e5d3c278a90f
// 12: 0xae9d - core::fmt::write::h5471a2341ce22f17
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:1226:2
// 13: 0xc3b7 - core::char::methods::encode_utf8_raw::h700e7a293d6eb2b7
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/char/methods.rs:1677:13 - core::char::methods::<impl char>::encode_utf8::h641f2d1d001008d5
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:165:24 - core::fmt::Write::write_char::ha951e2975b9730c3
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:165:24
// 14: 0xc418 - core::fmt::Write::write_fmt::h4a7e084f8beacf08
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/fmt/mod.rs:187
// 15: 0xc6e7 - core::iter::traits::iterator::Iterator::fold::h99ed29c108afc948
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/iter/traits/iterator.rs:2414:21 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::ha5be3bb1eeeaf8fe
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/iter/adapters/map.rs:124:9 - <usize as core::iter::traits::accum::Sum>::sum::h00b4d0c0300e94a9
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/iter/traits/accum.rs:42:17 - core::iter::traits::iterator::Iterator::sum::h04374b17d4abbea5
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/iter/traits/iterator.rs:3347:9 - <core::iter::adapters::filter::Filter<I,P> as core::iter::traits::iterator::Iterator>::count::h5c8b4c5e67e6831c
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/str/count.rs:135:5 - core::str::count::char_count_general_case::hfffa06842344b9fe
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/str/count.rs:135:5 - core::str::count::do_count_chars::h124622240ac1fb8b
// at /rustc/c396bb3b8a16b1f2762b7c6078dc3e023f6a2493/library/core/src/str/count.rs:71:21
for _, tc := range []struct { for _, tc := range []struct {
offset uint64 offset uint64
exp []string exp []string
}{ }{
{offset: 0xc77d - codeSecStart, exp: []string{ {offset: 0x3483 - codeSecStart, exp: []string{
"/library/core/src/slice/index.rs:286:39", "/library/panic_abort/src/lib.rs:100:17",
"/library/core/src/ptr/const_ptr.rs:870:18", "/library/panic_abort/src/lib.rs:43:5",
"/library/core/src/slice/index.rs:286:39",
"/library/core/src/slice/mod.rs:1630:46",
"/library/core/src/slice/mod.rs:405:20",
"/library/core/src/slice/mod.rs:1630:46",
"/library/core/src/slice/mod.rs:1548:18",
"/library/core/src/slice/iter.rs:1478:30",
"/library/core/src/str/count.rs:74:18",
}}, }},
{offset: 0xc06a - codeSecStart, exp: []string{"/library/core/src/fmt/mod.rs"}}, {offset: 0x580 - codeSecStart, exp: []string{
{offset: 0xc6e7 - codeSecStart, exp: []string{ "/wazero/internal/testing/dwarftestdata/testdata/rust/main.rs:12:5",
"/library/core/src/iter/traits/iterator.rs:2414:21", "/wazero/internal/testing/dwarftestdata/testdata/rust/main.rs:7:5",
"/library/core/src/iter/adapters/map.rs:124:9", "/wazero/internal/testing/dwarftestdata/testdata/rust/main.rs:2:5",
"/library/core/src/iter/traits/accum.rs:42:17", }},
"/library/core/src/iter/traits/iterator.rs:3347:9", {offset: 0x496 - codeSecStart, exp: []string{
"/library/core/src/str/count.rs:135:5", "/library/std/src/sys/backtrace.rs:154:18",
"/library/core/src/str/count.rs:135:5",
"/library/core/src/str/count.rs:71:21",
}}, }},
} { } {
tc := tc tc := tc