Uh oh!
There was an error while loading. Please reload this page.
Update char::escape_debug_ext to handle different escapes in strings and chars - #83079
Conversation
rust-highfive
commented
Mar 13, 2021
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
osa1
commented
Mar 13, 2021
I'll update docs of |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
osa1
commented
Mar 13, 2021
I'll add a test, which directory should I put it? |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Should I introduce a struct for these bool args?
This comment has been minimized.
This comment has been minimized.
osa1
commented
Mar 13, 2021
I don't have time to tweak this more today, I'll get back to this later. |
There was a problem hiding this comment.
Debug output of str now escapes " but not '.
There was a problem hiding this comment.
Debug output of char not escapes ' but not ".
osa1
commented
Mar 14, 2021
I believe this should currently be completely backwards compatible, other than For some reason |
There was a problem hiding this comment.
Escapes both ' and ", as before.
There was a problem hiding this comment.
Escapes both ' and ", as before.
There was a problem hiding this comment.
Escapes both ' and ", as before.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
osa1
commented
Mar 15, 2021
@m-ou-se This is ready for reviews now. I'll squash the commits once all is done. |
joshtriplett
commented
Mar 16, 2021
This seems like a great idea. I think enumEscapeChars{EscapeSingleQuote,EscapeDoubleQuote,EscapeBothQuotes,}implEscapeChars{fnescape_single_quote(&self) -> bool{matchself{
...}}fnescape_double_quote(&self) -> bool{matchself{
...}}}I'm hoping that'll produce generated code that's just as efficient. |
bors
commented
Mar 19, 2021
☔ The latest upstream changes (presumably #83301) made this pull request unmergeable. Please resolve the merge conflicts. |
osa1
commented
Mar 21, 2021
@joshtriplett I didn't quite understand how that enum would work, but I added a struct for to give names to the bool args. I'll squash the commits before merge. Ping @m-ou-se |
osa1
commented
Mar 26, 2021
Ping @m-ou-se |
m-ou-se
commented
Mar 26, 2021
Thanks! @bors r+ |
bors
commented
Mar 26, 2021
📌 Commit 52db9708dbb5fbfde615fa2c64c92656b6e610ac has been approved by |
…vs. chars Fixes#83046 The program fn main() { println!("{:?}", '"'); println!("{:?}", "'"); } would previously print '\"' "\'" With this patch it now prints: '"' "'"
osa1
commented
Mar 26, 2021
@m-ou-se Thanks for the review. I squashed the commits, could you approve again please? |
m-ou-se
commented
Mar 26, 2021
@bors r+ |
bors
commented
Mar 26, 2021
📌 Commit 819247f has been approved by |
bors
commented
Mar 26, 2021
bors
commented
Mar 26, 2021
☀️ Test successful - checks-actions |
Free lunch is over, Debug representation for str has changed (rust-lang/rust#83079). Roll our own version based on the stable `escape_debug()` method instead. Also spell out all the enums while at it.
Run tarpaulin for code coverage on stable rust instead of nightly. Nightly rust has our test cases failing due to the changed debug printing of strings with single quotes "'" so our test cases using should_panic(expected = <error message>) are failing. See rust-lang/rust#83079
The change in [1] is now in stable. [1]: rust-lang/rust#83079
Fixes#83046
The program
would previously print
With this patch it now prints: