Skip to content

Conversation

joshtriplett
Copy link
Member

This implements unsafe attr rules for declarative macro_rules! attributes, as specified in RFC 3697.

An invocation of an attribute that uses an unsafe attr rule requires the unsafe(attr(...)) syntax.

An invocation of an attribute that uses an ordinary attr rule must not use the unsafe(attr(...)) syntax.

unsafe is only supported on an attr rule, not any other kind of macro_rules! rule.

Tracking issue for macro_rules! attributes: #143547

@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2025

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@joshtriplett joshtriplett added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Sep 14, 2025
@joshtriplett
Copy link
Member Author

r? @petrochenkov

@rustbot rustbot assigned petrochenkov and unassigned davidtwco Sep 14, 2025
Copy link
Contributor

@mu001999 mu001999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I was preparing a talk for the Rust 4linux summit, I did a first pass on this, and it looks good!

Will do a final pass on it next week

Thanks for bringing this forward

View changes since this review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants