-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Use escaped byte string representation for CString Debug #26965
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
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
Can I avoid somehow adding a new feature name? I understand we might not want to add anything to ascii::EscapeDefault -- but at the same time, it's safer to use Also think about the result of displaying a partly iterated ascii::EscapeDefault (it will still be ascii safe, but display a partial string). |
Currently, no, but it's fine to just invent a name like you have. Due to there being no current precedent for implementing for byte in self.to_bytes().iter().flat_map(|b| ascii::escape_default(*b)) {
write!(f, "{}", byte as char);
} |
It's actually Display for the iterator. I think it's pretty appropriate, but I understand we can avoid it |
Faithfully represent the contents of the CString and CStr in their Debug impl, by treating them as byte strings with our default escaping to ascii representation. Add impl Debug for Cstr. Fixes rust-lang#26964.
Updated! Not changing EscapeDefault then. Neat little iterator. |
⌛ Testing commit 92c8a94 with merge c75264c... |
💔 Test failed - auto-linux-64-opt |
@bors: retry On Sat, Jul 11, 2015 at 11:02 PM, bors notifications@github.com wrote:
|
Use escaped byte string representation for CString Debug Faithfully represent the contents of the CString and CStr in their Debug impl, by treating them as byte strings with our default escaping to ascii representation. Add impl Debug for CStr. Fixes #26964.
Suggested relnote: CStr now implements Optional extra: CStr and CString now render as ascii escaped byte strings in Debug formatting |
Use escaped byte string representation for CString Debug
Faithfully represent the contents of the CString and CStr in their Debug
impl, by treating them as byte strings with our default escaping to
ascii representation.
Add impl Debug for CStr.
Fixes #26964.