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

Not compiling with newest version of dependencies #427

Open
bobbobbio opened this issue May 24, 2023 · 4 comments · May be fixed by #429
Open

Not compiling with newest version of dependencies #427

bobbobbio opened this issue May 24, 2023 · 4 comments · May be fixed by #429

Comments

@bobbobbio
Copy link

After updating wasm-bindgen to 0.2.86 (I think) I get a compilation error when trying to compile with wasm
This was with rustc 1.71.0-nightly (5ea3f0ae0 2023-05-23) but fails on stable also

error[E0433]: failed to resolve: unresolved import
  --> src/webcore/ffi/wasm_bindgen.rs:67:32
   |
67 |             alloc: &Closure< Fn( usize ) -> *mut u8 >,
   |                                ^ unresolved import

error[E0425]: cannot find function `wasm_bindgen_initialize` in this scope
  --> src/webcore/ffi/wasm_bindgen.rs:77:22
   |
77 |         let module = wasm_bindgen_initialize( memory, table, &alloc, &free );
   |                      ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
@eduardvercaemer
Copy link

For anyone trying to get around this you can try this in your Cargo.toml

wasm-bindgen = "=0.2.84"

@rdbisme
Copy link

rdbisme commented Sep 4, 2023

Hello, downgrading wasm-bindgen is a no-go for me since I need to use the latest version of the Cloudflare workers rust runtime, and they pin to wasm-bindgen=0.2.86.

Is there another way of fixing this?

@sdasda7777
Copy link

Jeez, I'm not pinned to a higher version, but why did I have to waste three hours debugging this?

@Dampfwalze
Copy link

The suggestion by @eduardvercaemer does fix the compile error, but pinning wasm-bindgen has other undesired impacts for me and really should not be the solution to the problem.

I think I found the issue! It is within these lines (Exactly where the error points to):

extern "C" {
fn wasm_bindgen_initialize(
memory: JsValue,
table: JsValue,
alloc: &Closure< Fn( usize ) -> *mut u8 >,
free: &Closure< Fn( *mut u8, usize ) >
) -> JsValue;
}

I couldn't make sense of the error, but I looked at the docs of the Closure struct. Interestingly, in the examples, it is always used with the dyn keyword, which makes sense. The fix looks like this:

Closure<dyn Fn(...) -> ...>

On line 75 and 76 there is a warning: trait objects without an explicit 'dyn' are deprecated. I guess historically, rust implicitly added the dyn keyword, but at some point that feature got removed... Probably for the better. But since this package does not receive any updates (for 5 years, FIVE YEARS!!!), it is full of similar deprecation warnings that are never fixed. This is just the first instance where it broke. I am not sure why it works when pinning wasm_bindgen though.

This crate really needs a general overhaul to fix all the warnings! It has thousands of dependents, it is crucial that this crate does not brake! @koute

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

Successfully merging a pull request may close this issue.

5 participants