Compiler plugin is dead?


#1

I want use annotation for the function, it can be released with compiler plugin.
But latest articles about rust plugins (what i can found) dated back to 2014 year and from alive project only a rocket really use it.
Somebody know about this feature stability or die?


#2

If you want to add your own annotations, The Book has a section on making your own custom attributes.


#3

I already use it, but custom derive not applicable for using with an implementation. And question not about it


#4

Compiler plugins have never been stabilized, from what I have seen they were mostly a testing ground to get an idea for what sort of things people would do with them. There’s very few RFCs directly related to them (and they’re all pre-1.0) and quoting from the Macros 1.1 RFC:

Additionally, though, it’s essentially impossible to ever stabilize [compiler plugins] because the interface to the compiler is… the compiler! We clearly want to make changes to the compiler over time, so this isn’t acceptable.

Procedural macros are what came out of the plugin test grounds, and intend to cover the majority of use-cases that compiler plugins were used for. Currently they only allow custom Derive attributes since that was the most widely used kind of compiler plugin, but there are plans to extend that in the near future. If you want to see details about how those are to be extended and work out if they fit your use-case there’s the proc-macro RFC #1566 and the tracking issue. By the sounds of some of the recent discussion the implementation appears to be basically complete, but there are still breaking changes that need to happen before stabilisation.


#5

@Nemo157, thanks for full response