-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Hint on unknown escape of Unicode quotation marks in string literal #128906
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
Fixes rust-lang#128858 I opted not to produce a suggestion, since it's not obvious what the user meant to do.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
The job Click to see the possible cause of the failure (guessed by this bot)
|
"{ec} is not an ascii quote, \ | ||
but may look like one in some fonts.\n\ | ||
consider writing it in its \ | ||
escaped form for clarity." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the spacing is a bit awkward here. Can we use a semicolon to turn this into one line?
"{ec} is not an ascii quote, \ | |
but may look like one in some fonts.\n\ | |
consider writing it in its \ | |
escaped form for clarity." | |
"{ec} is not an ascii quote but may look like one in some fonts; consider escaping it to avoid confusion" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm pretty sure that would put it over the 100 char line length limit.
i'm also unsure if you have a problem with the formatting of the output or the code (the code is 4 lines, but the actual output is only 2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output -- we don't typically have multi-line diagnostics (unless formatting a list or something), and we try to avoid periods in diagnostic outputs as a matter of style. I personally find multi-sentence notes to be a bit wordy.
Yeah, you'll need to re-\
the string literal.
Also please squash this into one commit, no need for an additional |
You could emit a |
= help: \u{201c} is not an ascii quote, but may look like one in some fonts. | ||
consider writing it in its escaped form for clarity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: the help
message itself could look like
help: U+201C Left Double Quotation Mark (“) looks like U+0022 Quotation Mark (") (ASCII quotation mark) but are different characters
and a MaybeIncorrect
suggestion as mentioned could look something like
help: consider writing the Unicode escape
|
2 | dbg!("since when is \u{201c}THIS\” not allowed in a string literal");
| ++++++++
(exact wording may vary)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does rustc have a database of unicode character names?
I'm not going to be around for a few weeks. r? @compiler-errors as you were already looking at it :) |
@lolbinarycat any updates on this? thanks |
@Dylan-DPC I've mostly moved on to working on rustdoc, since the codebase is smaller and i feel like i can make a more meaningful impact on it. I may come back to this at some point, but if someone else wants to take over this PR, I wouldn't mind. |
superseded by #137067 |
Fixes #128858
I opted not to produce a suggestion, since it's not obvious what the user meant to do.