You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#83046 reported the behavior of <str as Debug>::fmt escaping single quotes, and it was changed in #83079. Should we do the same for OsString?
I ran into this in #114132. It seems easy to fix for unix:
diff --git a/library/core/src/str/lossy.rs b/library/core/src/str/lossy.rs
index 59f873d1268..7e5ae364361 100644
--- a/library/core/src/str/lossy.rs+++ b/library/core/src/str/lossy.rs@@ -1,3 +1,4 @@+use crate::char::EscapeDebugExtArgs;
use crate::fmt;
use crate::fmt::Formatter;
use crate::fmt::Write;
@@ -85,7 +86,11 @@ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let valid = chunk.valid();
let mut from = 0;
for (i, c) in valid.char_indices() {
- let esc = c.escape_debug();+ let esc = c.escape_debug_ext(EscapeDebugExtArgs {+ escape_grapheme_extended: true,+ escape_single_quote: false,+ escape_double_quote: true,+ });
// If char needs escaping, flush backlog so far and write, else skip
if esc.len() != 1 {
f.write_str(&valid[from..i])?;
But on windows OsString is implemented using Wtf8, which is in std rather than core, which means it can't call char::escape_debug_ext:
produces
(playground)
#83046 reported the behavior of
<str as Debug>::fmt
escaping single quotes, and it was changed in #83079. Should we do the same forOsString
?I ran into this in #114132. It seems easy to fix for unix:
But on windows
OsString
is implemented usingWtf8
, which is instd
rather thancore
, which means it can't callchar::escape_debug_ext
:rust/library/std/src/sys_common/wtf8.rs
Line 532 in 139b49b
The text was updated successfully, but these errors were encountered: