-
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
Compile time lowercasing/etc of stringify!d idents. #16607
Comments
Rather than special-purpose macros like |
We would also use this in the compiler's |
Ah, nice. I'll do that then.
|
Adding macros would require an RFC nowadays, so I'm giving this a close. |
Yeah, I think this could be a plugin library. |
…cape-left-curly, r=Veykril fix: Don't add `\` before `{` Fixes rust-lang#16607 for `{`. The `}` case is already fixed by rust-lang#16475. The [LSP snippet grammar](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax) only specifies that `$`, `}`, and `\` can be escaped with backslashes, but not `{`.
In this macro for Servo (PR), I'm taking in an ident, using it as a method name, and later
stringify!
ing it. Unfortunately, the method name needs to be title case, but the string version needs to be lowercase. I currently get around this by usingstringify!($attr).to_ascii_lower().as_slice()
but this executes at runtime which is slightly inefficient.Could we have variants of
stringify!
that work at compile time?The text was updated successfully, but these errors were encountered: