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

game_of_life panic with wasm32-unknown-unknown target #227

Closed
huangjj27 opened this issue May 9, 2018 · 2 comments
Closed

game_of_life panic with wasm32-unknown-unknown target #227

huangjj27 opened this issue May 9, 2018 · 2 comments

Comments

@huangjj27
Copy link
Contributor

Description

I'm submitting a question

As I didn't install emscripten tools, I Add a Web.toml to the example(cloned with the yew git repo) to change the default target to rustup's wasm32-unknown-unknown, then build.

Expected Results

the game should be shown and the buttons shoud work

Actual Results

Encounter a panic

Error loading Rust wasm module 'game_of_life': 
RuntimeError: unreachable executed
Stack trace:
__rust_start_panic@http://localhost:8000/js/app.js:209947:1
rust_panic@http://localhost:8000/js/app.js:183360:1
std::panicking::rust_panic_with_hook::hf4ad10abe765e9ff@http://localhost:8000/js/app.js:182671:1
std::panicking::begin_panic::ha5da3b9a0ddd8a9c@http://localhost:8000/js/app.js:120745:1
rand::jitter::platform::get_nstime::h4cc03776153f98ea@http://localhost:8000/js/app.js:127147:1
rand::jitter::JitterRng::new::hfac017917be80b30@http://localhost:8000/js/app.js:120988:1
rand::StdRng::new::h1afb735546c910f1@http://localhost:8000/js/app.js:126336:1
rand::thread_rng::had3d49e398e9a8e1@http://localhost:8000/js/app.js:126671:1
game_of_life::GameOfLife::random_mutate::h8281d6d903d3b176@http://localhost:8000/js/app.js:118907:1
<game_of_life::GameOfLife as yew::html::Component<CTX>>::update::hdc61c8ae6698d50f@http://localhost:8000/js/app.js:47402:1
<yew::html::ScopeRunnable<CTX, COMP> as yew::scheduler::Runnable<CTX>>::run::h3f76b29a1fa234bf@http://localhost:8000/js/app.js:110844:1
<yew::scheduler::Scheduler<CTX>>::put_and_try_run::hb8d7905369887aaa@http://localhost:8000/js/app.js:32972:1
game_of_life::main::h824f031b0ddc5e23@http://localhost:8000/js/app.js:47720:1
std::rt::lang_start::{{closure}}::h44a175b82135c044@http://localhost:8000/js/app.js:48527:1
std::sys_common::backtrace::__rust_begin_short_backtrace::hd5da1a247f4ba467@http://localhost:8000/js/app.js:186903:1
std::panicking::try::do_call::h897e358b832c26f7@http://localhost:8000/js/app.js:182015:1
__rust_maybe_catch_panic@http://localhost:8000/js/app.js:209939:1
std::rt::lang_start_internal::h5bf01d0092e63ea4@http://localhost:8000/js/app.js:191982:1
main@http://localhost:8000/js/app.js:48095:1
__instantiate@http://localhost:8000/js/app.js:608:9
__initialize/<@http://localhost:8000/js/app.js:614:17

default

Context (Environment)

  • Rust: 1.27.0-nightly (e82261dfb 2018-05-03)
  • target: wasm32-unknown-unknown
  • cargo-web: v0.6.10

  • browser if relevant: Firefox Quantum 58

@huangjj27 huangjj27 changed the title game_of_life error with wasm32-unknown-unknown target game_of_life panic with wasm32-unknown-unknown target May 9, 2018
@dhardy
Copy link

dhardy commented May 9, 2018

Looks like you tried executing unreachable!(). Try building Rand with the stdweb feature.

@huangjj27
Copy link
Contributor Author

huangjj27 commented May 10, 2018

@dhardy thanks! it fixed the issue

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

No branches or pull requests

2 participants