-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Expand macro expression #957
Comments
I wouldn't want this to be built into syn, which is only supposed to be a parser. However it would be reasonable to address in a different crate. |
@edgarogh Did you find a crate that could do this ? Edit: For anyone interested there's also the unstable |
You can proxy your proc-macro through a macro-rules-macro using https://docs.rs/with_builtin_macros to support a subset of the std macros. I have an example using it and also extended that with optional support for the |
I'm making an expression/function macro that takes a string literal, transforms it, and returns a new string literal. The problem I'm having is that string-literal-returning macros like
concat!
,env!
,stringify!
(and I might forget some) cannot be given as a parameter to my macro due to the order in which macros are expanded (they're passed as macro expressions, not expanded). I spent quite a bit of time in the doc and didn't find any way to expand aExprMacro
into the expanded macro's TokenStream, so I can use this in place.Is there such a feature ? If no, is it planned, or impossible to do ?
The text was updated successfully, but these errors were encountered: