You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Sorry about the title. Yo dawg, I heard you like generators...)
This code contains a macro that expands to an cfg-annotated call to another macro, which defines an item. The cfg should cause everything to be dropped, but surprisingly the item is defined anyway.
This is a near-minimal test case because combinations with fewer layers of indirection (i.e. removing define!) produce the expected behavior.
I think the root cause is that cfg stripping is only performed before and after, but not during, macro expansion. So here, (1) initial cfg stripping does nothing, then during macro expansion (2a) group_attr! is expanded producing the annotated call to define!, (2b) define! is expanded, dropping the attribute, and finally (3) final cfg stripping again does nothing.
Ideally this could be restructured somehow so that cfg stripping can be done during macro expansion. But if not, at least we could have a warning during step (2b) above when the attribute evaporates.
Is my understanding correct?
The text was updated successfully, but these errors were encountered:
(Sorry about the title. Yo dawg, I heard you like generators...)
This code contains a macro that expands to an cfg-annotated call to another macro, which defines an item. The cfg should cause everything to be dropped, but surprisingly the item is defined anyway.
This is a near-minimal test case because combinations with fewer layers of indirection (i.e. removing
define!
) produce the expected behavior.I think the root cause is that cfg stripping is only performed before and after, but not during, macro expansion. So here, (1) initial cfg stripping does nothing, then during macro expansion (2a)
group_attr!
is expanded producing the annotated call todefine!
, (2b)define!
is expanded, dropping the attribute, and finally (3) final cfg stripping again does nothing.Ideally this could be restructured somehow so that cfg stripping can be done during macro expansion. But if not, at least we could have a warning during step (2b) above when the attribute evaporates.
Is my understanding correct?
The text was updated successfully, but these errors were encountered: