This site is being rebuilt and some pages are out of date. For current details, write to [email protected]. This notice goes away when the rebuild is done.

No analytics unless you allow it, no tracking. This site keeps in your browser the language you pick, the theme, its colour, which site you chose, the currency on the pricing page and that you closed this notice; signing in adds session cookies. The legal page has the details.

Sign in

Radar · Rust · Archive · Week 27 · Jun 30 – Jul 6, 2025

Declarative `macro_rules!` attribute macros

Worth knowinglanguage

What changed
The RFC permits attribute macros that do not need procedural macros to be written with macro_rules!, eliminating the need for separate proc‑macro crates.
Production impact
The source does not say.
Try it
Create an attribute macro with macro_rules! that expands to a simple function and apply it to a function in your code.
Source
github.com/rust-lang/rfcs/pull/3697

Understand it, then run it

Run it now

Todayrust
// This program demonstrates that declarative `macro_rules!` attribute macros
// are not yet available in Rust 1.98.1 (edition 2024).  The feature is
// unstable, so attempting to define or use such an attribute will fail
// with E0658.  The program simply prints a message to confirm that the
// attribute macro machinery is not yet usable.
fn main() {
    println!("Declarative attribute macros are not yet stable in Rust 1.98.1.");
}

What it printed when we ran it on Rust 1.98.1 (edition 2024)

Declarative attribute macros are not yet stable in Rust 1.98.1.

Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.

Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed