-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Have Derive Attribute share a token tree with it's proc macros. #16835
Conversation
☔ The latest upstream changes (presumably #16844) made this pull request unmergeable. Please resolve the merge conflicts. |
6445df5
to
9ec142b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a smart idea, re-using the #[derive]
attribute for the query, since all the inner derives should share the arg! Though this raises the question what to do about the "pseudo" expansion that we use this for right now... Guess it's time to move that hack into a different layer, the question is how
Thank you! I have changed how I did this though I forgot to commit the code. I will have that up soon.
So I was wanting to add a new setting and stuff. The default would be The second would be collect all the derives and return them as one expansion. This would only really matter for the |
wyatt-herkamp@8b78a18 adds a new MacroCallKind DeriveAttr The reason I did this is because handling |
@Veykril should any tests be added for this PR? |
Don't think there is an opportunity of testing here, as the only effect this has is reduce memory usage |
☔ The latest upstream changes (presumably #16895) made this pull request unmergeable. Please resolve the merge conflicts. |
cc6d7cf
to
c376add
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
speculative_expand
also needs to call the new macro arg stuff
Thanks! |
☀️ Test successful - checks-actions |
The goal of this PR is to stop creating a token tree for each derive proc macro.
This is done by giving the derive proc macros an id to its parent derive element.
From running the analysis stat on the rust analyzer project I did see a small memory decrease.
After Change
Currently this breaks the expansion for the actual derive attribute.
TODO
smart_macro_arg