Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trouble using with wasm-pack: non-i32 constant #16

Open
0rphon opened this issue Mar 29, 2023 · 0 comments
Open

trouble using with wasm-pack: non-i32 constant #16

0rphon opened this issue Mar 29, 2023 · 0 comments

Comments

@0rphon
Copy link
Contributor

0rphon commented Mar 29, 2023

hopefully I'm just missing something obvious here, but attempting to use minicov in wasm-pack's hello-wasm example leads to the following:

use wasm_bindgen::prelude::*;

// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen]
extern "C" {
    fn alert(s: &str);
}

#[wasm_bindgen]
pub fn greet() {
    alert("Hello, hello-wasm!");
    let mut coverage = vec![];
    unsafe {
        // Note that this function is not thread-safe! Use a lock if needed.
        minicov::capture_coverage(&mut coverage).unwrap();
    }
    alert(&format!("coverage: {coverage:?}"));
}
0rphon@iPhone:/mnt/5406d0e6-37e3-4679-9dc2-24193550d990/Work/LeakSignal/tmp/hello-wasm$ RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime" rustup run nightly wasm-pack build
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
   Compiling hello-wasm v0.1.0 (/mnt/5406d0e6-37e3-4679-9dc2-24193550d990/Work/LeakSignal/tmp/hello-wasm)
    Finished release [optimized] target(s) in 0.24s
[INFO]: ⬇️  Installing wasm-bindgen...
thread 'main' panicked at 'non-i32 constant', crates/wasm-interpreter/src/lib.rs:266:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Running the wasm-bindgen CLI
Caused by: Running the wasm-bindgen CLI
Caused by: failed to execute `wasm-bindgen`: exited with exit status: 101
  full command: "/home/0rphon/.cache/.wasm-pack/wasm-bindgen-5f26acfc988649a3/wasm-bindgen" "/mnt/5406d0e6-37e3-4679-9dc2-24193550d990/Work/LeakSignal/tmp/hello-wasm/target/wasm32-unknown-unknown/release/hello_wasm.wasm" "--out-dir" "/mnt/5406d0e6-37e3-4679-9dc2-24193550d990/Work/LeakSignal/tmp/hello-wasm/pkg" "--typescript" "--target" "bundler"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant