rustwasm / wasm-bindgen

Facilitating high-level interactions between Wasm modules and JavaScript
https://rustwasm.github.io/docs/wasm-bindgen/
Apache License 2.0
7.66k stars 1.06k forks source link

Updating the nightly version of rust gives error on module path: #4115

Open amiyatulu opened 1 week ago

amiyatulu commented 1 week ago

While importing the module it now gives following error:

#[wasm_bindgen(module = "/src/package.js")]
extern "C" {
    #[wasm_bindgen]
    pub fn helloworld();
error: constant evaluation is taking a long time
   --> /home/amiya/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/mod.rs:118:9
    |
118 |         ptr::metadata(self)
    |         ^^^^^^^^^^^^^^^^^^^
    |
    = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
            If your compilation actually takes a long time, you can safely allow the lint.
help: the constant being evaluated
   --> src/js_extension_binding.rs:5:1
    |
5   | #[wasm_bindgen(module = "/src/package.js")]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: `#[deny(long_running_const_eval)]` on by default
    = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

note: erroneous constant encountered
 --> src/js_extension_binding.rs:5:1
  |
5 | #[wasm_bindgen(module = "/src/package.js")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this note originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
lucasmerlin commented 2 days ago

I'm having the same problem, but for me it came after updating wasm_bindgen from 0.2.92 to 0.2.93. So I guess it's a combination of wasm_bindgen 0.2.93 and a recent rust nightly version (I'm using 1.82.0-nightly (2c93fabd9 2024-08-15))? @amiyatulu do you know which nightly version you were updating from?