-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
make format! accept const vars as format-strings #69133
Comments
Macros run before name resolution, so there's no way for |
Closing with @sfackler's explanation. |
If you want to interpolate like that, you can use |
maybe a inline function can help on it. |
Processing the string still happens during macro expansion actually. (The format string syntax is directly parsed, implicit arguments are directly resolved to their indexes, etc. etc.) It's just that instead of expanding to a (And if we want to be able to resolve names/constants, I think we'd need to postpone the parsing not only until the AST lowering, but even later in the HIR.) |
I wonder if we could make rustc accept code like this:
Currently this errors with:
rustc 1.43.0-nightly (58b834344 2020-02-05)
The text was updated successfully, but these errors were encountered: