Hi, I'm looking for documentation on macros 2.0 on nightly. How far has the project advanced and can we use procedural macros on nightly?
3 Likes
I'd be keen to hear about this for my include_dir crate. I've dabbled in function-style proc macros before and about the only useful resource I could find was the actual RFC.
1 Like
What also might help is this:
https://github.com/rust-lang/rust/issues/39412
I tried using procedural-masquerade, but due to issues regarding &
tokens, I can't really use it.
You can use proc macros on nightly. You basically create a crate and dub it as a proc-macro
crate just like proc_macro_derive then add the #![feature(proc_macro)]
flag and label your function like #[proc_macro(function_name)]
where it accepts a TokenStream
and outputs a TokenStream
. It's basically the same as proc_macro_derive except for some minor things
2 Likes