-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo uses the target-triplet, should be host-triplet, to compile proc-macro
#5825
Comments
Wait, you're using
That's not useful for actual proc macros, but I might be misunderstanding your usecase. |
Yes as mentioned by @eddyb this sequence of steps isn't a bug in Cargo, but you can try turning off the |
If either of the two dependencies is commented out, the build for The I've tried to I only solution I see is to vendor all of syn, quote and proc-macro2, rip out the |
@lukaslueg I think the best solution here is to just fix |
@alexcrichton syn and quote have the same problem, so they would need fixing as well, in addition to all other crates which have a Instead of fixing every crate out there that has this problem, couldn't we make cargo hide the |
We could perhaps, but that's not at all a Cargo issue and is an issue for rust-lang/rust. In the meantime it'll likely be easiest to fix this in |
This seems to be happening for me on only windows because I depend on It doesn't seem to cause a problem on linux/mac. |
I assume this is related to dtolnay/proc-macro2#111 |
dtolnay/proc-macro2#111 is the "fix" for this, although all crates with a feature like this will fail to build if they do not specifically exclude |
Coming over from rust-lang/rust#52707
tl;dr: Cargo fails to compile a crate with a dependency on
proc_macro
for wasm32. @eddyb suggested that the underlying problem is not with rustc but cargo using the target-triplet to compileproc-macro
, while it should be using the host-triplet.proc-macro
is missing from the distribution for wasm32:...which causes anything that depends on
proc-macro2
somewhere down the tree to be unable to compile to wasm:... 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 onproc-macro2
effectively prohibits compiling for the web. May it be possible to includeproc-macro
in the wasm32-target ?In fact, all I need is
proc_macro2::{Delimiter, Ident, Literal, Punct, TokenStream}
The text was updated successfully, but these errors were encountered: