Wasm-pack: Non compilable toy example code

Created on 3 Oct 2019  路  1Comment  路  Source: rustwasm/wasm-pack

馃悰 Bug description

I followed the steps of the documentation to build the toy library to wasm. The code doesn't compile as shown below:

xxxx:hello-wasm:% rustup --version                                                                                                                                                                      
rustup 1.19.0 (2019-09-09)
xxxx:hello-wasm:% rustup show                                                                                                                                                                           
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/xxxx/rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
nightly-2019-08-09-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.35.0 (3c235d560 2019-05-20)

xxxx:hello-wasm:% wasm-pack -V                                                                                                                                                                          
wasm-pack 0.8.1
xxxx:hello-wasm:% wasm-pack build                                                                                                                                                                       
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
   Compiling wasm-bindgen-backend v0.2.51
error[E0721]: `await` is a keyword in the 2018 edition
   --> /home/xxxx/cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-backend-0.2.51/src/codegen.rs:454:79
    |
454 |                         wasm_bindgen::__rt::IntoJsResult::into_js_result(#ret.await)
    |                                                                               ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0721`.
error: Could not compile `wasm-bindgen-backend`.

To learn more, run the command again with --verbose.
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit code: 101

馃 Expected Behavior

The code should compile without any error.

馃憻 Steps to reproduce

Follow the documentation.

馃實 Your environment

More info in the snippet above. Cargo.toml:

[package]
name = "hello-wasm"
version = "0.1.0"
authors = ["nalos"]
edition = "2018"
description = "A sample project with wasm-pack"
license = "MIT/Apache-2.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "0.2"

Most helpful comment

A simple rustup update did the trick :)
Might be worth mentionning that command somewhere in the doc !

>All comments

A simple rustup update did the trick :)
Might be worth mentionning that command somewhere in the doc !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gliheng picture gliheng  路  3Comments

pablosichert picture pablosichert  路  4Comments

netgusto picture netgusto  路  4Comments

marcoscaceres picture marcoscaceres  路  3Comments

xtuc picture xtuc  路  5Comments