bytecodealliance / bytecodealliance/wit-bindgen

rust: Panic dropping a future outside of an async context

Open
#1,456 0 comments 0 reactions 0 assignees View on GitHub
gen-rust
Dominant language
Rust
Stars
1.5k
Forks
286
Avg merge
6h 32m
Merged PRs (30d)
19

Description

Code such as this:

```rust
fn main() {
let (tx, rx) = wit_future::new(|| Ok(None));
drop(tx);
drop(rx);
}
```

will currently fail with:

```
thread 'main' (1) panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wit-bindgen-0.48.1/src/rt/async_support/waitable.rs:193:13:
assertion failed: !task.is_null()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

(more context/discussion [are here](https://bytecodealliance.zulipchat.com/#narrow/channel/219900-wasi/topic/wasi-testsuite.20update.20for.20wasip3/near/562474600))

I'm not sure how best to handle this myself. It's not clear how frequently this will come up and if this means we basically need more libc integration or what.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.