Closed
Description
Following code seems correct though will always panic when compiled to wasm32-wasi
:
fn main() { std::thread::sleep(std::time::Duration::new(0,5)); }
compiled with nightly rust 1.40:
>cargo +nightly build --target wasm32-wasi
It fails at least in wasmtime and wasmer-js VMs (example https://github.com/dunnock/wabench/tree/master/poll_oneoff_test):
> wasmtime target/wasm32-wasi/debug/poll_oneoff_test.wasm
thread 'main' panicked at 'thread::sleep(): unexpected result of poll_oneoff', src/libstd/sys/wasi/thread.rs:61:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace.
error: failed to process main module target/wasm32-wasi/debug/poll_oneoff_test.wasm
caused by: Instantiation error: Trap occurred while invoking start function: wasm trap: unreachable, source location: @8f01
rustup show:
active toolchain
nightly-x86_64-apple-darwin (default)
rustc 1.40.0-nightly (0e8a4b441 2019-10-16)