Skip to content

macro_rules should not be considered deprecated in the future #1562

@eastspire

Description

@eastspire

I want to challenge the statement from [Rust Course](https://course.rs/advance/macro.html#%E6%9C%AA%E6%9D%A5%E5%B0%86%E8%A2%AB%E6%9B%BF%E4%BB%A3%E7%9A%84-macro_rules):

"For macro_rules, there are indeed some problems. Therefore, Rust plans to replace it with the new declarative macros in the future: they work in a similar way but solve the existing issues. After that, macro_rules will become deprecated."

I don’t think this statement is accurate or reflects the current direction of the Rust language.

  • macro_rules! is stable, widely used, and deeply embedded in both the Rust ecosystem and the standard library itself.
  • There has been no official RFC or language team decision stating that macro_rules! will be deprecated.
  • The newer "declarative macros 2.0" do address some issues, but they coexist with macro_rules! rather than serving as a strict replacement.

Marking macro_rules! as "will be deprecated" is misleading. At best, it can be said that declarative macros are the preferred future direction for new macro development, but macro_rules! is not going away.

I suggest updating the wording to avoid confusion for learners and to better reflect the actual status of macro_rules!.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions