-
Notifications
You must be signed in to change notification settings - Fork 13.3k
String
Debug
implementation prints escaped single quotes
#83046
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
Comments
This is because the same format string method of I checked the language spec https://doc.rust-lang.org/stable/reference/tokens.html#string-literals I don't think |
Oh, wow. Until you mentioned it, I didn't even notice that this also affects |
Update char::escape_debug_ext to handle different escapes in strings and chars Fixes rust-lang#83046 The program fn main() { println!("{:?}", '"'); println!("{:?}", "'"); } would previously print '\"' "\'" With this patch it now prints: '"' "'"
This is very minor.
(playground)
Expected output:
"'"
Actual output:
"\'"
Perhaps this was intentional, but I'm not sure why it would be. The closest issue I saw was #3752 which is ancient and was more obviously a bug since escapes were appearing in
Display
output and not justDebug
.This reproduces in the latest stable (1.50.0) and nightly (1.52.0-nightly) builds.
The text was updated successfully, but these errors were encountered: