Closed jnicholls closed 5 years ago
:+1:
I think this project can use proc_marco
instead of a compiler plugin. https://doc.rust-lang.org/unstable-book/language-features/proc-macro.html
I haven't been following the proc_macro
development but I would be thrilled to use it instead of the current compiler plugin technique. That said, proc_macro
seems to be currently unstable.
Currently, proc_macro are much more stable and have great tooling. Also, proc_macro are currently in the final comment phase https://github.com/rust-lang/rust/issues/38356.
In case anyone comes here wondering if Rust 1.30
proc_macro replaces this, the answer is "no." You're still not allowed have !
in function names, though there's a potential now for building the entire function as a proc_macro.
See #45 - TL;DR: use the paste
crate, it uses a proc macro, and works on stable.
Like other crates have done (e.g. serde_codegen), perhaps provide the ability for someone to instead register the plugin and expand code in build.rs. It would only take a feature flag cfg checks sprinkled around to cut out the stable incompatible parts of this.