Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vagueness about "add additional attributes" in macro.proc.derive.attributes #1760

Open
workingjubilee opened this issue Mar 14, 2025 · 0 comments
Labels
A-proc-macro Area: proc-macros Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like.

Comments

@workingjubilee
Copy link
Member

Derive macros can add additional attributes into the scope of the item they are on. Said attributes are called derive macro helper attributes. These attributes are inert, and their only purpose is to be fed into the derive macro that defined them. That said, they can be seen by all macros.

When it says a derive macro can "add additional attributes into the scope", it does not make it very clear that it allows these helper attributes to be used in the scope. Instead, the way it is worded suggests the derive macro can mutate its input TokenStream, which as far as I am aware is not the case. I believe derive macros are "pure"... with respect to their TokenStream, anyway.

...also "add additional" anything seems slightly repetitive, but that's relatively minor.

@ehuss ehuss added Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like. A-proc-macro Area: proc-macros labels Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-proc-macro Area: proc-macros Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like.
Projects
None yet
Development

No branches or pull requests

2 participants