varlink / rust

Rust implementation of the Varlink protocol
https://docs.rs/varlink/
Apache License 2.0
61 stars 14 forks source link

varlink_derive compilation error: proc_macro only usable with crates of the proc-macro crate type #30

Closed curiousleo closed 4 years ago

curiousleo commented 4 years ago

Hi! I'm trying to use varlink_derive and I'm seeing this compilation error in our CI:

Building src/lib.rs (varlink_derive)

Running rustc --crate-name varlink_derive src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=2 --edition 2018 -C metadata=6ab36ceda7 -C extra-filename=-6ab36ceda7 --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern varlink_generator=/nix/store/fx04h2n6q0ipli7hm7zknspgjfi0qiva-rust_varlink_generator-8.0.0/lib/libvarlink_generator-10e2cd43da.rlib --cap-lints allow --color always

error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type

  --> src/lib.rs:61:1

   |

61 | #[proc_macro]

   | ^^^^^^^^^^^^^

error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type

  --> src/lib.rs:84:1

   |

84 | #[proc_macro]

   | ^^^^^^^^^^^^^

error: aborting due to 2 previous errors

(from https://travis-ci.org/target/lorri/jobs/623110880#L2842-L2856)

I noticed two things:

I don't get this compilation error in all build environments though - any idea what could be going on here?

curiousleo commented 4 years ago

Hm, just judging by the uses of proc_macro = true (3680 on Github) and proc-macro = true (3926 on Github) it seems that they're both equally valid.

curiousleo commented 4 years ago

The issue here appears to be with Carnix: https://nest.pijul.com/pmeunier/carnix/discussions/41. Closing this ticket.