-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Added a hint for wrong escaping of curly braces in format strings. #24295
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
Unfortunately this may not be the best place for this error. For example I think that this will trigger the error message as well: let foo = "\{"; |
Er sorry, posted too soon! Perhaps this could issue a |
@alexcrichton thanks, I will look into this tomorrow! |
When you forget to put a
So the information is all in one error. I wanted to emulate this behaviour. I have followed your suggestion and added a span_help, such that the compiler output looks like:
(PS: this also confirms that this can also happen in a non-format string :)) |
Oh sorry, I didn't read your comment very closely. |
I did the changes suggested by @rprichard, thanks for those! |
Thanks! Could you squash the commits together and add a test as well? |
…braces in a format string if a wrongly escaped one is detected in a string.
Sorry for the confusion-if any-but I somewhat destroyed my git history whilst trying to squash, and then Github automatically closed the pr. Sorry for your lost comments @rprichard. I have added the test, and put it together with the changes into one commit. |
As i proposed in #24262 (and found acceptance in the IRC channel), added a compiler warning for wrong escaping of curly braces.
As i proposed in #24262 (and found acceptance in the IRC channel), added a compiler warning for wrong escaping of curly braces.