internal error: unexpected way of calling JS shims
Yesterday I upgraded rust-nightly (last install was ~1-2 weeks old), now I get the following compilation error with cargo-web (latest version):
$ RUST_BACKTRACE=1 cargo web build --bin ce-ui --features ui
warning: debug builds on the wasm32-unknown-unknown are currently totally broken
forcing a release build
Finished release [optimized] target(s) in 0.09s
Garbage collecting "ce-ui.wasm"...
Processing "ce-ui.wasm"...
thread 'main' panicked at 'internal error: unexpected way of calling JS shims; please report this!', src/wasm_inline_js.rs:75:38
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:70
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:58
at src/libstd/panicking.rs:200
3: std::panicking::default_hook
at src/libstd/panicking.rs:215
4: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:478
5: std::panicking::begin_panic
6: cargo_web::wasm_inline_js::process_and_extract
7: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
8: cargo_web::cargo_shim::BuildConfig::build_internal
9: cargo_web::cargo_shim::BuildConfig::build
10: cargo_web::build::Project::build_or_check
11: cargo_web::cmd_build::command_build_or_check
12: cargo_web::main
13: std::rt::lang_start::{{closure}}
14: std::panicking::try::do_call
at src/libstd/rt.rs:49
at src/libstd/panicking.rs:297
15: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:87
16: std::rt::lang_start_internal
at src/libstd/panicking.rs:276
at src/libstd/panic.rs:388
at src/libstd/rt.rs:48
17: main
18: __libc_start_main
19: _start
Content of my Web.toml:
default-target="wasm32-unknown-unknown"
[cargo-web]
minimum-version = "0.6.9"
As my project is quite large and I haven't done any source code changes since the last successful compilation, I do not know how I would create a minimal example for this.
This is interesting! Unfortunately I'm not really sure how I could reproduce it.
Could you try a few of these things?
- Nuke the whole
targetdirectory and do a clean rebuild. - Try to build with the Emscripten targets and see if it works.
- Try to maybe bisect from which nightly exactly it stopped working? (If it's only two weeks worth of nightlies this should only take a few tries.)
- Send me (in private if you don't want to share it) the
.wasmfile generated by the nightly on which this problem reproduce.
Hi,
I am seeing the same error on my project. I manually bisected the nightly versions and it first broke with 1.33.0-nightly (20c2cba61 2019-01-26) the previous nightly rustc 1.33.0-nightly (bf669d1e3 2019-01-25) works fine.
Here are the rustc changes: https://github.com/rust-lang/rust/compare/bf669d1e3...20c2cba61
If you like I can send you my .wasm via email.
It looks like there were some LLVM updates between those commits, which makes sense.
Yes, @dsander if you can I'd appreciate if you could send me a .wasm file from a project on which this reproduces.
Thanks for the .wasm file @dsander.
Okay, I know what's the issue here. @dsander it looks like you're using an old version of stdweb (0.4.10) which still uses the non-procedural version of the js! macro. The implementation of that was a little hacky, which made it somewhat brittle and it didn't really support non-release builds. Since stdweb 0.4.11 a new version of the js! macro was introduced which shouldn't have this problem.
Could you delete the Cargo.lock in your project and try to rebuild?
Sorry for the delay and thanks @koute!
Going from stdweb 0.4.10 to 0.4.15 fixed the issue for me.