-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
#[derive(...)]
doesn't invalidate tokens for nested items
#81099
Comments
The part about #[derive(MyTrait)]
#[my_attr]
struct S { ... } should be ready to receive an item with invalidated tokens as an input. |
I'm going to feature-gate macro attributes on nested nodes in #79078 because they are very similar to attribute macros after derive in the sense that they allow macros to observe derive's output, and the lang team's position is that it shouldn't be allowed on stable yet. |
#80689 will automatically fix the |
|
@nnethercote This was probably addressed by your recent fixes to token collection? |
Has the behaviour changed? If so, I guess those fixes are responsible. |
Reproduction:
#[derive]
will fully configure the itemS
and remove#[cfg(FALSE)] { 10 }
before outputting the item or passing it toPartialEq
andEq
.#[print_attr]
however will print tokens for bothcfg
cases because its input tokens are not invalidated and are stale.Fix:
#[derive]
should walk the whole input item and invalidate tokens for all nested nodes, not only for the item itself.CanSynthesizeMissingTokens::Yes
.cc @Aaron1011
The text was updated successfully, but these errors were encountered: