wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

Assertion failure in `post_return()` for functions returning `error-context`

Open kavoc-brown opened this issue 1 month ago • 1 comments

Summary

wit-bindgen panics with "assertion failed: sig.retptr" when generating bindings for a WIT world that exports a function returning error-context.

Environment

  • wit-bindgen version: 0.47.0
  • Affected generator: Rust
  • OS: Ubuntu 22.04, x86-64

Steps to Reproduce

  1. Create a minimal WIT file

    Save the following as test.wit:

    package poc:demo;
    
    world retptr-bug {
      export get-error: func() -> error-context;
    }
    
  2. Run wit-bindgen

    wit-bindgen rust --out-dir /tmp/test test.wit
    
  3. Observe the panic

    thread 'main' panicked at /home/runner/work/wit-bindgen/wit-bindgen/crates/core/src/abi.rs:1316:9
    assertion failed: sig.retptr
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

kavoc-brown avatar Nov 09 '25 15:11 kavoc-brown

Thanks! I'd recommend avoiding the error-context type as it's not ready for general use yet. Good to still have this on file though.

alexcrichton avatar Nov 10 '25 16:11 alexcrichton