-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Procedural Macros expanding macros by example vs. __rust_unstable_column() #48781
Comments
On the origins of why I'm not very familiar with the capabilities of the procedural macro API but maybe you can just invoke the |
Alternatively, you can try shadowing the |
Honestly, I'd just like to use the expansion of the macro. Ideally the expander would deal with it, leaving me to care about my procedural macro. Shouldn't we fix this at the expander level instead of the caller? |
IDK, I just want to avoid any kind of stabilisation of that macro which is a kludge and a hack but needed. Make sure it stays nightly only even if proc macros get stable. |
Agreed, and that should be possible without requiring proc macro authors to resort to kludges of their own. We just need to figure out how to let them expand macros like rustc. |
It appears RFC #2320 shows a way to resolve this. |
Just a wild thought, but can we now use |
@matklad nice idea. It should work actually. You should try to make a PR and check whether the |
|
In flamer and overflower, I expand
ExprMac
s when I find them so I can fold their expansion. However, this clashes with current libstd implementation ofassert!(..)
etc., because they use the __rust_unstable_column() macro, which, it appears, may not be called from outside libstd. This causes an error when trying to apply the procedural macro.In general: Is there a way to get the macro expanded version of the code within a procedural macro? Do I need to register differently?
(Note: Since this only occurs with procedural macros, this is nightly-only).
The text was updated successfully, but these errors were encountered: