chinedufn / percy

Build frontend browser apps with Rust + WebAssembly. Supports server side rendering.
https://chinedufn.github.io/percy/
Apache License 2.0
2.26k stars 84 forks source link

"Should never destroy FnMut" error when running readme example #101

Closed timsueberkrueb closed 5 years ago

timsueberkrueb commented 5 years ago

When trying to run the readme example, I get the following error in Firefox and Chromium:

RuntimeError: unreachable executed browser.js line 458 > WebAssembly.instantiate:602073:1

    __rust_start_panic http://127.0.0.1:8081/browser.js line 458 > WebAssembly.instantiate:602073 rust_panic http://127.0.0.1:8081/browser.js line 458 > WebAssembly.instantiate:597020 h1b6eb5fa7979eb5f http://127.0.0.1:8081/browser.js line 458 > WebAssembly.instantiate:396087 h36250f1cb97666c2 http://127.0.0.1:8081/browser.js line 458 > WebAssembly.instantiate:513274 rust_begin_unwind http://127.0.0.1:8081/browser.js line 458 > WebAssembly.instantiate:601925 h2165a0a4134a5a6d http://127.0.0.1:8081/browser.js line 458 > WebAssembly.instantiate:577223 hea8b65335b1105e7 http://127.0.0.1:8081/browser.js line 458 > WebAssembly.instantiate:533574 <(dyn core::ops::function::FnMut(A) .> R + 'static) as wasm_bindgen::closure::WasmClosure>::describe::destroy::h4fd713a35daa4801 http://127.0.0.1:8081/browser.js line 458 > WebAssembly.instantiate:420344 cb http://127.0.0.1:8081/browser.js:420 cb self-hosted:974

Using console_error_panic_hook::set_once();

panicked at 'should never destroy a FnMut whose pointer is 0', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-0.2.38/src/closure.rs:679:1

Stack:

__exports.__wbg_new_a99726b0abef495b@http://127.0.0.1:8080/browser.js:60:34
console_error_panic_hook::Error::new::h5791488df7219e2a@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[1188]:0x7e7be
console_error_panic_hook::hook_impl::ha7525a8b41a78c1d@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[401]:0x56fe8
console_error_panic_hook::hook::hd4fcf55b70b42397@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[2166]:0x93f69
core::ops::function::Fn::call::hdcb36739c628e612@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[2089]:0x92ca0
std::panicking::rust_panic_with_hook::h1b6eb5fa7979eb5f@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[560]:0x63882
std::panicking::continue_panic_fmt::h36250f1cb97666c2@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[1342]:0x82e21
rust_begin_unwind@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[2734]:0x99f85
core::panicking::panic_fmt::h2165a0a4134a5a6d@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[2136]:0x9387c
core::panicking::panic::hea8b65335b1105e7@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[1554]:0x883c4
<(dyn core::ops::function::FnMut(A) .> R + 'static) as wasm_bindgen::closure::WasmClosure>::describe::destroy::h4fd713a35daa4801@http://127.0.0.1:8080/browser.js line 496 > WebAssembly.instantiate:wasm-function[667]:0x6a004
cb@http://127.0.0.1:8080/browser.js:458:34
 browser.js:32:13
rustc 1.35.0-nightly (a9da8fc9c 2019-03-04)
wasm-pack 0.6.0
cargo 1.34.0-nightly (5c6aa46e6 2019-02-22)

I tried to follow the readme instructions 1:1, but it's possible that I'm missing something :)

chinedufn commented 5 years ago

Thanks for the report! This was totally broken due to some recent changes. Unfortunately the README example is currently untested.. In the future we'll want the README example to be imported from a real, tested example.. or something..

At any rate - fixed! df99590

Let me know if you have any other issues!

timsueberkrueb commented 5 years ago

Wow, thank you very much for the quick fix. It is working now as expected. Just one minor finding: there is a duplicated

<script>
</script>

in the readme now.

chinedufn commented 5 years ago

Bleh thanks for noticing! Feel free to PR a fix if you’re interested - otherwise I’ll get that cleaned up soon!

chinedufn commented 5 years ago

Fixed! Thanks! baa54c6