rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.75k stars 211 forks source link

Name doesn't appear in the alert from hello world exercise #163

Closed jimmycuadra closed 5 years ago

jimmycuadra commented 5 years ago

Describe the bug I'm going through the tutorial and just came to the end of the "hello world" page. At the bottom there is an "exercises" section that asks you to modify the greet function to take a name. When running the code exactly as shown, the browser alert does not include the name passed to the function. It simply displays Hello, !. I made sure that my code is identical to what is shown in the answer section, re-ran wasm-pack build from the root of the project, and even restarted the webpack development server just to be sure. Same result.

To Reproduce Steps to reproduce the behavior:

  1. Follow the hello world tutorial exactly.

Expected behavior The alert should say Hello, Your Name!.

Additional context Software used: rustc 1.35.0-nightly (3750348da 2019-04-08) wasm-bindgen 0.2.41 npm 6.9.0 Firefox 66.0.2

mddizon commented 5 years ago

Hi Friend, I ran into the same problem. It looks like there might be an issue with the latest version of wasm-bindgen. In the meantime I removed the Cargo.lock file, then downgraded and forced the the version in Cargo.toml from wasm-bindgen = "0.2" to wasm-bindgen = "=0.2.40". Hope this helps!

jimmycuadra commented 5 years ago

I wonder if it would make sense to add some regression testing to the book's examples. Having a hello world example at the very beginning of a tutorial fail is not a good first impression for users. I realize this whole thing is super new so we shouldn't expect things to be nice and polished at this point, though. Just thinking out loud.

alexcrichton commented 5 years ago

I suspect that this is https://github.com/rustwasm/wasm-bindgen/issues/1436 if 0.2.40 works and 0.2.41 doesn't. That just means it's basically a 17-hour-old regression (and this issue is 13 hours old!) so we should have this fixed soon :)

alexcrichton commented 5 years ago

Closing now that the fix had landed and I'll publish a new version soon.