linebender / linebender/druid

Game of Life web example not working

Open
#2,138 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

Hello! Great work on Druid! It's really fun to use and very portable.

Trying to run the `game of life` example in a web browser yields the following error in the javascript console:

```
Panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:13:9

Stack:

Error
at http://localhost:8000/pkg/druid_web_examples.js:546:19
at logError (http://localhost:8000/pkg/druid_web_examples.js:230:18)
at imports.wbg.__wbg_new_59cb74e423758ede (http://localhost:8000/pkg/druid_web_examples.js:545:66)
at console_error_panic_hook::Error::new::h2b214e3b0207e48b (http://localhost:8000/pkg/druid_web_examples_bg.wasm:wasm-function[55939]:0x190b47a)
at console_error_panic_hook::hook_impl::hc41ff54987f5ee4c (http://localhost:8000/pkg/druid_web_examples_bg.wasm:wasm-function[10299]:0x127e13b)
at console_error_panic_hook::hook::h126545eb1cc05067 (http://localhost:8000/pkg/druid_web_examples_bg.wasm:wasm-function[60596]:0x194af37)
at core::ops::function::Fn::call::h84dc32ea5da66069 (http://localhost:8000/pkg/druid_web_examples_bg.wasm:wasm-function[52918]:0x18dbc53)
at std::panicking::rust_panic_with_hook::he9bfe03219d715ba (http://localhost:8000/pkg/druid_web_examples_bg.wasm:wasm-function[18770]:0x14f5d8f)
at std::panicking::begin_panic::{{closure}}::h29d8e4472f2e2dbe (http://localhost:8000/pkg/druid_web_examples_bg.wasm:wasm-function[64624]:0x1979a0f)
at std::sys_common::backtrace::__rust_end_short_backtrace::h07554449d90848f3 (http://localhost:8000/pkg/druid_web_examples_bg.wasm:wasm-function[62796]:0x1966277)

(anonymous) @ druid_web_examples.js:540
logError @ druid_web_examples.js:230
imports.wbg.__wbg_error_4bb6c2a97407129a @ druid_web_examples.js:538
$console_error_panic_hook::error::hae6c3eae4d1d18ab @ druid_web_examples_bg.wasm:0x15fd072
$console_error_panic_hook::hook_impl::hc41ff54987f5ee4c @ druid_web_examples_bg.wasm:0x127e238
$console_error_panic_hook::hook::h126545eb1cc05067 @ druid_web_examples_bg.wasm:0x194af37
$core::ops::function::Fn::call::h84dc32ea5da66069 @ druid_web_examples_bg.wasm:0x18dbc53
$std::panicking::rust_panic_with_hook::he9bfe03219d715ba @ druid_web_examples_bg.wasm:0x14f5d8f
$std::panicking::begin_panic::{{closure}}::h29d8e4472f2e2dbe @ druid_web_examples_bg.wasm:0x1979a0f
$std::sys_common::backtrace::__rust_end_short_backtrace::h07554449d90848f3 @ druid_web_examples_bg.wasm:0x1966277
$std::panicking::begin_panic::h7867d4da632f3661 @ druid_web_examples_bg.wasm:0x19799e1
$std::sys::wasm::time::Instant::now::h301019f3e66af852 @ druid_web_examples_bg.wasm:0x1993a39
$std::time::Instant::now::h4e5f28084bc792e8 @ druid_web_examples_bg.wasm:0x19941d3
$druid_web_examples::examples::game_of_life::make_widget::h9f3a830da4690ea3 @ druid_web_examples_bg.wasm:0xca2906
$druid_web_examples::examples::game_of_life::main::h88461766875a962e @ druid_web_examples_bg.wasm:0xecde89
$druid_web_examples::game_of_life::hdbc630ad673779e9 @ druid_web_examples_bg.wasm:0x1979bd1
$game_of_life @ druid_web_examples_bg.wasm:0x1959dfe
game_of_life @ druid_web_examples.js:324
run @ game_of_life.html:25
await in run (async)
(anonymous) @ game_of_life.html:28
druid_web_examples_bg.wasm:0x19943ae Uncaught (in promise) RuntimeError: unreachable
at __rust_start_panic (druid_web_examples_bg.wasm:0x19943ae)
at rust_panic (druid_web_examples_bg.wasm:0x197a365)
at std::panicking::rust_panic_with_hook::he9bfe03219d715ba (druid_web_examples_bg.wasm:0x14f5db6)
at std::panicking::begin_panic::{{closure}}::h29d8e4472f2e2dbe (druid_web_examples_bg.wasm:0x1979a0f)
at std::sys_common::backtrace::__rust_end_short_backtrace::h07554449d90848f3 (druid_web_examples_bg.wasm:0x1966277)
at std::panicking::begin_panic::h7867d4da632f3661 (druid_web_examples_bg.wasm:0x19799e1)
at std::sys::wasm::time::Instant::now::h301019f3e66af852 (druid_web_examples_bg.wasm:0x1993a39)
at std::time::Instant::now::h4e5f28084bc792e8 (druid_web_examples_bg.wasm:0x19941d3)
at druid_web_examples::examples::game_of_life::make_widget::h9f3a830da4690ea3 (druid_web_examples_bg.wasm:0xca2906)
at druid_web_examples::examples::game_of_life::main::h88461766875a962e (druid_web_examples_bg.wasm:0xecde89)
$__rust_start_panic @ druid_web_examples_bg.wasm:0x19943ae
$rust_panic @ druid_web_examples_bg.wasm:0x197a365
$std::panicking::rust_panic_with_hook::he9bfe03219d715ba @ druid_web_examples_bg.wasm:0x14f5db6
$std::panicking::begin_panic::{{closure}}::h29d8e4472f2e2dbe @ druid_web_examples_bg.wasm:0x1979a0f
$std::sys_common::backtrace::__rust_end_short_backtrace::h07554449d90848f3 @ druid_web_examples_bg.wasm:0x1966277
$std::panicking::begin_panic::h7867d4da632f3661 @ druid_web_examples_bg.wasm:0x19799e1
$std::sys::wasm::time::Instant::now::h301019f3e66af852 @ druid_web_examples_bg.wasm:0x1993a39
$std::time::Instant::now::h4e5f28084bc792e8 @ druid_web_examples_bg.wasm:0x19941d3
$druid_web_examples::examples::game_of_life::make_widget::h9f3a830da4690ea3 @ druid_web_examples_bg.wasm:0xca2906
$druid_web_examples::examples::game_of_life::main::h88461766875a962e @ druid_web_examples_bg.wasm:0xecde89
$druid_web_examples::game_of_life::hdbc630ad673779e9 @ druid_web_examples_bg.wasm:0x1979bd1
$game_of_life @ druid_web_examples_bg.wasm:0x1959dfe
game_of_life @ druid_web_examples.js:324
run @ game_of_life.html:25
await in run (async)
(anonymous) @ game_of_life.html:28
```

Wasm-pack - 0.10.1
os - Mac OS X - 11.6.2
rustc - 1.55.0
druid - hash 9bfdaf8
server - http
browser - Chrome (same result with Safari, BTW).

LMK if I can help fix it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the game_of_life::make_widget entry point shown in the stack trace and inspect the use of std::time::Instant::now. Run game_of_life.html in a browser through the reported HTTP setup and confirm the example no longer panics with the unsupported wasm time error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.