Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proc-macro not distributed for target wasm32-unknown-unknown #52707

Closed
lukaslueg opened this issue Jul 25, 2018 · 1 comment
Closed

proc-macro not distributed for target wasm32-unknown-unknown #52707

lukaslueg opened this issue Jul 25, 2018 · 1 comment

Comments

@lukaslueg
Copy link
Contributor

lukaslueg commented Jul 25, 2018

Coming over from koute/cargo-web#125

proc-macro is missing from the distribution for wasm32:

$ ls ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib | grep proc_macro
libproc_macro-1ea4ba9e4f6cdbc1.so

$ ls ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib | grep proc_macro

...which causes anything that depends on proc-macro2 somewhere down the tree to be unable to compile to wasm:

$ cargo new foobar
$ cd foobar
$ echo 'proc-macro2 = "*"' >> Cargo.toml
$ cargo build --target=wasm32-unknown-unknown
   Compiling unicode-xid v0.1.0                                                                                                                                                                                                              
   Compiling proc-macro2 v0.4.9
error[E0463]: can't find crate for `proc_macro`
  --> /home/kou/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.9/src/lib.rs:50:1
   |
50 | extern crate proc_macro;
   | ^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

... which in turn is very sad because proc-macro2 is needed not just for procedural macros but also to "just" parse rust code and having anything depend on a crate which in turn depends on proc-macro2 effectively prohibits compiling for the web. May it be possible to include proc-macro in the wasm32-target ?

In fact, all I need is proc_macro2::{Delimiter, Ident, Literal, Punct, TokenStream}

@Boscop
Copy link

Boscop commented Jul 28, 2018

I want to use the interpolate crate (for string interpolation) in my yew frontend, but I'm getting:

error: cannot produce proc-macro for interpolate v0.1.1 as the target wasm32-unknown-unknown does not support these crate types

:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants