Progress/Documentation of Macros 2.0


#1

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?


#2

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.


#3

What also might help is this:

I tried using procedural-masquerade, but due to issues regarding & tokens, I can’t really use it.


#4

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