wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

Are the examples in the guide/docs supposed to run live

Open greggman opened this issue 1 year ago • 2 comments

Describe the Bug

if I go to the docs/guide like say "Hello, world"

https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html

And click the run button ▶, I get

   Compiling playground v0.0.1 (/playground)
error[E0433]: failed to resolve: maybe a missing crate `wasm_bindgen`?
 --> src/main.rs:4:5
  |
4 | use wasm_bindgen::prelude::*;
  |     ^^^^^^^^^^^^ maybe a missing crate `wasm_bindgen`?
  |
  = help: consider adding `extern crate wasm_bindgen` to use the `wasm_bindgen` crate

error: cannot find attribute `wasm_bindgen` in this scope
  --> src/main.rs:11:3
   |
11 | #[wasm_bindgen]
   |   ^^^^^^^^^^^^

error: cannot find attribute `wasm_bindgen` in this scope
 --> src/main.rs:6:3
  |
6 | #[wasm_bindgen]
  |   ^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0433`.
error: could not compile `playground` (bin "playground") due to 3 previous errors

Are the supposed to run?

Steps to Reproduce

  1. Go to https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html
  2. Click on ▶
  3. See error

If applicable, add a link to a test case (as a zip file or link to a repository we can clone).

Expected Behavior

Clicking ▶ should successfully run the example

Actual Behavior

Clicking ▶ prints errors about missing wasm_bindgen Screenshot 2023-12-28 at 08 24 13

Additional Context

I'm running Chrome v120 on M1 Mac.

greggman avatar Dec 28 '23 16:12 greggman

This is quite unfortunate, I'm not sure how this worked in the past but the Rust playground doesn't include wasm-bindgen. Looking at their policy I don't think there is anything we can do here.

In any case, the documentation has to be adjusted to either remove the play button entirely or find an alternative.

daxpedda avatar Dec 30 '23 10:12 daxpedda

I asked over on that repo about the policy.

https://github.com/rust-lang/rust-playground/issues/101#issuecomment-1875729447

greggman avatar Jan 03 '24 17:01 greggman