Skip to content

Remove $:meta matcher in decl macros #49629

Closed
@dtolnay

Description

@dtolnay

$:meta is intended for matching the content of attributes, as in the following:

#![feature(decl_macro)]

macro m(
    $(#[$m:meta])*
    struct $n:ident;
) {
    $(#[$m])*
    struct $n(usize);
}

m! {
    #[derive(Debug)]
    struct S;
}

fn main() {
    println!("{:?}", S(1));
}

According to #34981 (comment) we intend to support arbitrary token streams inside of attributes rather than the limited grammar of $:meta. Let's have decl macros drop support for $:meta and encourage #[$($meta:tt)*] instead.

Metadata

Metadata

Assignees

Labels

A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions