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
While debugging roignpar/optfield#4 I noticed that attribute macros only have access to attributes defined after them. As all the documentation I could find on the subject states that "The second TokenStream is the rest of the item including other attributes on the item", I thought this could be a bug since order of attributes is never mentioned.
It might as well just be missing documentation(?).
I tried this code:
#[before]#[after]structItem;
I expected to see this happen: if after is an attribute macro it would receive #[before] as part of it's item TokenStream.
Instead, this happened: it doesn't.
I initially thought this had something to do with syn: dtolnay/syn#1452
We haven't definitively documented what a proc-macro sees, but it will most likely be that attributes see the inert attributes that follow them. I'm going to close as a duplicate of rust-lang/reference#692, since this seems like a documentation issue.
While debugging roignpar/optfield#4 I noticed that attribute macros only have access to attributes defined after them. As all the documentation I could find on the subject states that "The second TokenStream is the rest of the item including other attributes on the item", I thought this could be a bug since order of attributes is never mentioned.
It might as well just be missing documentation(?).
I tried this code:
I expected to see this happen: if
after
is an attribute macro it would receive#[before]
as part of it's itemTokenStream
.Instead, this happened: it doesn't.
I initially thought this had something to do with
syn
: dtolnay/syn#1452Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: