about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/debug.rs
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2023-09-17 11:23:24 +0000
committerGitHub <noreply@github.com>2023-09-17 11:23:24 +0000
commit584eb696dff27a44492aa8751b11354b8e27a925 (patch)
tree48fafa6e0be05d7e649dc474d35cf6fdccbf4e31 /compiler/rustc_mir_transform/src/coverage/debug.rs
parent7cbe7fa6bffbf580bfa8fc6cbda68fdce21286e8 (diff)
parent9c0e5ebf65ababd5ccae1211cb4831e605311b9a (diff)
downloadrust-584eb696dff27a44492aa8751b11354b8e27a925.tar.gz
rust-584eb696dff27a44492aa8751b11354b8e27a925.zip
Rollup merge of #115434 - soqb:ascii-char-manual-debug, r=dtolnay
make `Debug` impl for `ascii::Char` match that of `char`

# Objective
use a more recognisable format for the `Debug` impl on `ascii::Char` than the derived one based off the enum variants. The alogorithm used is the following:
 - escape `ascii::Char::{Null, CharacterTabulation, CarraigeReturn, LineFeed, ReverseSolidus, Apostrophe}` to `'\0'`, `'\t'`, `'\r'`, `'\n'`, `'\\'` and `'\''` respectively. these are the same escape codes as `<char as Debug>::fmt` uses.
 - if `u8::is_ascii_control` is false, print the character wrapped in single quotes.
 - otherwise, print in the format `'\xAB'` where `A` and `B` are the hex nibbles of the byte. (`char` uses unicode escapes and this seems like the corresponding ascii format).

Tracking issue: https://github.com/rust-lang/rust/issues/110998
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions