question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error[E0277]: the trait bound `&mut syn::Field: quote::ToTokens` is not satisfied

See original GitHub issue

The Rust code is failing to compile in my fresh install of this template. I’m using rustc 1.31.0-nightly (5af0bb830 2018-10-10) and wasm-pack 0.5.1. I first did npm init rust-webpack, then npm i, and now I’m getting this when running npm start:

attila@Attila-Pentium:/c/0/rust-webassembly/my-app (master) $ npm startnpm start

> create-rust-webpack@0.1.3 start C:\0\rust-webassembly\my-app
> webpack-dev-server -d

🧐  Checking for wasm-pack...

✅  wasm-pack is installed.

ℹ️  Compiling your crate...

i 「wds」: Project is running at http://localhost:8080/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from C:\0\rust-webassembly\my-app\dist
wasm-pack error: Compiling your crate to WebAssembly
Caused by: Process exited with exit code: 101: `cargo build` did not exit successfully.

stdout:

stderr:

   Compiling wasm-bindgen-macro-support v0.2.25
error[E0277]: the trait bound `&mut syn::Field: quote::ToTokens` is not satisfied
   --> C:\Users\attila\.cargo\registry\src\github.com-1ecc6299db9ec823\wasm-bindgen-macro-support-0.2.25\src\parser.rs:376:44
    |
376 |                 assert_not_variadic(&opts, &field)?;
    |                                            -^^^^^
    |                                            |
    |                                            the trait `quote::ToTokens` is not implemented for `&mut syn::Field`
    |                                            help: consider removing 1 leading `&`-references
    |
    = help: the following implementations were found:
              <syn::Field as quote::ToTokens>
    = note: required for the cast to the object type `dyn quote::ToTokens`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: Could not compile `wasm-bindgen-macro-support`.

To learn more, run the command again with --verbose.


× 「wdm」: Hash: 4a39adb79ad381d877fa
Version: webpack 4.20.2
Time: 1476ms
Built at: 2018-10-17 11:27:41
     Asset       Size  Chunks             Chunk Names
 bundle.js    837 KiB    main  [emitted]  main
index.html  272 bytes          [emitted]
Entrypoint main = bundle.js
[./js/index.js] 60 bytes {main} [built]
[./node_modules/ansi-html/index.js] 4.16 KiB {main} [built]
[./node_modules/events/events.js] 8.13 KiB {main} [built]
[./node_modules/html-entities/index.js] 231 bytes {main} [built]
[./node_modules/loglevel/lib/loglevel.js] 7.68 KiB {main} [built]
[./node_modules/querystring-es3/index.js] 127 bytes {main} [built]
[./node_modules/strip-ansi/index.js] 161 bytes {main} [built]
[./node_modules/url/url.js] 22.8 KiB {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 7.78 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.58 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.05 KiB {main} [built]
[0] multi (webpack)-dev-server/client?http://localhost:8080 ./js/index.js 40 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 77 bytes {main} [built]
[./node_modules/webpack/hot/log.js] (webpack)/hot/log.js 1.11 KiB {main} [optional] [built]
    + 11 hidden modules

ERROR in ./js/index.js
Module not found: Error: Can't resolve '../crate/pkg' in 'C:\0\rust-webassembly\my-app\js'
 @ ./js/index.js 1:0-22
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./js/index.js
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./index.html] 419 bytes {0} [built]
    [./node_modules/lodash/lodash.js] 527 KiB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 509 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 519 bytes {0} [built]
i 「wdm」: Failed to compile.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
fitzgencommented, Oct 17, 2018

Have you tried

rustup update nightly
cargo update

?

1reaction
fitzgencommented, Oct 18, 2018

@rsmelo @amcsi if you run wasm-pack build in the crate directory, does that execute OK?

@xtuc @sendilkumarn is the wasm-pack plugin running with -m no-install? If so, that shouldn’t be necessary anymore, since wasm-pack build will automatically determine if installing wasm-bindgen is unnecessary since 0.5.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error[E0277]: the trait bound `Vec<TokenStream2>: ToTokens ...
For some reason, quote::ToTokens isn't implemented for proc_macro2::TokenStream . New answer. This is achievable using the quote! macro's ...
Read more >
E0277: Trait bound not satisfied
Need some help with the following error message. We are unwrapping the return value and applying Neg op on each D in Vec....
Read more >
syn - Rust - Docs.rs
Syn is a parsing library for parsing a stream of Rust tokens into a syntax tree of ... error[E0277]: the trait bound `std::thread::Thread:...
Read more >
Rookie Premiere In MUT 23 EASILY Explained! How To Get ...
#Madden22 #Madden22UltimateTeam #MUT22. Rookie Premiere In MUT 23 EASILY Explained! How To Get Rookie Premiere Players + Tokens.
Read more >
mozilla-inbound: changeset 393233 ... - Mercurial
-bug 1413336 - if PSM xpcshell tests have been run locally, these changes will ... + // eslint-disable-next-line mozilla/no-cpows-in-tests content.location ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found