Declarative macro_rules! attribute macros by joshtriplett · Pull Request #3697 · rust-lang/rfcs (original) (raw)

Tracking issue: rust-lang/rust#143547

Many crates provide attribute macros. Today, this requires defining proc
macros, in a separate crate, typically with several additional dependencies
adding substantial compilation time, and typically guarded by a feature that
users need to remember to enable.

However, many common cases of attribute macros don't require any more power
than an ordinary macro_rules! macro. Supporting these common cases would
allow many crates to avoid defining proc macros, reduce dependencies and
compilation time, and provide these macros unconditionally without requiring a
the user to enable a feature.

I've reviewed several existing proc-macro-based attributes in the ecosystem,
and it appears that many would be able to use this feature to avoid needing
proc macros at all.

Rendered