-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
compile-time internal error on passing &Function to js #1373
Labels
Comments
alexcrichton
added a commit
to alexcrichton/wasm-bindgen
that referenced
this issue
Mar 21, 2019
Ended up helping diagnose the problem in the end!
alexcrichton
added a commit
to alexcrichton/wasm-bindgen
that referenced
this issue
Mar 21, 2019
This commit moves our `links` annotation in the `wasm-bindgen` crate to the `wasm-bindgen-shared` crate. The `links` annotation is used to ensure that there's only one version of `wasm-bindgen` in a crate graph because if there are multiple versions then a CLI surely cannot actually process the wasm binary (as the multiple versions likely have different formats in their custom sections). Discovered in rustwasm#1373 it looks like the usage in `wasm-bindgen` isn't quite sufficient to cause this deduplication. It turns out that `wasm-bindgen-shared`, a very core dependency, is actually the most critical to be deduplicated since its the one that defines the format of the custom section. In rustwasm#1373 a case came up where `wasm-bindgen` was deduplciated but there were two versions of `wasm-bindgen-shared` in the crate graph, meaning that a `[patch]` for only `wasm-bindgen` wasn't sufficient, but rather `web-sys` and/or `js-sys` also needed a `[patch]` annotation to ensure everyone used the right dependencies. This commit won't actually fix rustwasm#1373 to the point where it "just works", but what it does do is present a better error message than an internal panic of `wasm-bindgen`. The hope is that by moving the `links` annotation we can catch more errors of this crate graph duplication, leading to more `[patch]` annotations locally. Closes rustwasm#1373
Thanks for the report and for the reproduction! I think this should be "fixed" in #1377 where "fixed" here means "produces a better error message". The real fix though for this is to add |
alexcrichton
added a commit
that referenced
this issue
Mar 21, 2019
Add some logging useful in debugging #1373
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I encountered
internal error: entered unreachable code
with wasm-bindgen when I tried the git master version at merge of #1353 (and still there at the merge of #1372, not sure how far ago when the bug appear. But the bug is not in 0.2.39 release)You can see the minimal code that produce the error here. In words, I have a library
wb-lib
that wraps aroundFoo
infoo.js
.Foo
is a JS class that need a callback that the Rust code will pass a&js_sys::Function
to it. An appwb-app
depends onwb-lib
, it initialize aFoo
object.Compile the provided repo (using a matched version of wasm-bindgen-cli) will cause the compile time error as shown in the
backtrace
file (also in repo). Note that I runwasm-bindgen --web
.No error if arguments not include a
js_sys::Function
. No error with v0.2.39.The text was updated successfully, but these errors were encountered: