Closed
Description
When trying to use wasm-bindgen
on a .wasm file built with -C link-arg=--shared
, it panics when using closures.
Steps to Reproduce
$ rustup default beta (or nightly)
$ cargo init --lib
$ cat src/lib.rs
use wasm_bindgen::prelude::*;
#[no_mangle]
pub extern "C" fn foo() {
Closure::wrap(Box::new(move || { }) as Box<dyn FnMut()>);
}
$ cat .cargo/config
[target.wasm32-unknown-unknown]
rustflags = [
"-C", "link-arg=--shared",
]
$ cargo build --target=wasm32-unknown-unknown
$ wasm-bindgen target/wasm32-unknown-unknown/debug/file.wasm --out-dir out
thread 'main' panicked at 'out of bounds read of function table', src/libcore/option.rs:1038:5
Additional Context
Using the latest wasm-bindgen from github also panics, but at a different location.