-
Notifications
You must be signed in to change notification settings - Fork 8
Does it make sense to publish libproc_macro
?
#1
Comments
Ah unfortunately not, I think the issue with bindgen is one we would want to fix in proc-macro2 |
@alexcrichton How do you propose to do that? |
Binaries shouldn't ever depend on proc_macro, so if a binary depends on proc-macro2 then proc-macro2 shouldn't depend on proc_macro. This'd probably involve adding a feature to |
Sounds like this applies to the
Is this something you can specify in the Cargo.toml? It's not clear to me how you'd do this. |
@alexcrichton FYI since we didn't have any better options I went ahead and forked proc_macro into a standalone crate: https://crates.io/crates/rustc-ap-proc_macro. I also forked proc-macro2, quote, and syn, into standalone-proc-macro2 etc. and now we finally have a working cbindgen again. It only builds with nightly rustc so it's less than ideal but better than nothing. Still hoping we can resolve this with rust-lang/rust#48217 so that I can unfork all these things. |
dtolnay/proc-macro2#65 is the strategy I envisioned. That wouldn't require forking anything and would largely just require bindgen to tweak how it depends on syn. |
Currently
cbindgen
depends onsyn
for parsing rust which depends onproc-macro2
which depends onproc-macro
.This works, but it means that the binary depends on rustc libs being in LD_LIBRARY_PATH, which leads to linking errors when running the binary outside of
cargo run
. See rust-lang/rust#47931.I noticed that
rustfmt
seems to get around this by using a published version oflibsyntax
. Does it make sense to have a published version oflibproc_macro
so we could do the same? I believe all oflibproc_macro
s dependencies are currently published.cc @staktrace
The text was updated successfully, but these errors were encountered: