Skip to content

Allow proc_macro_attribute and macro_rules with the same name #3780

@PRO-2684

Description

@PRO-2684

We already allow derive macros and traits to share the same name, so that library users only need to use once:

use my_crate::MyTrait;

#[derive(MyTrait)]
struct MyStruct {
  // ...
}

fn main() {
  // ...
}

So we should also allow proc_macro_attribute and macro_rules with the same name, like:

use my_macro::my_macro;

#[my_macro]
struct MyStruct {
  // ...
}

fn main() {
  my_macro!(MyStruct);
}

Related: https://internals.rust-lang.org/t/allow-attribute-and-function-macros-to-share-name/19510 (closed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosMacro related proposals and issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions