diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2023-03-06 07:42:04 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2023-05-02 10:32:07 +0000 |
| commit | a49570fd20a16c0a41b1dfdaf121ef69f60acd7e (patch) | |
| tree | 4fe0c783a16760e3636a5177e0dc661eadc590aa /compiler/rustc_ast | |
| parent | 76d1f93896fb642cd27cbe8ef481b66e974dbdf9 (diff) | |
| download | rust-a49570fd20a16c0a41b1dfdaf121ef69f60acd7e.tar.gz rust-a49570fd20a16c0a41b1dfdaf121ef69f60acd7e.zip | |
fix TODO comments
Diffstat (limited to 'compiler/rustc_ast')
| -rw-r--r-- | compiler/rustc_ast/src/util/literal.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_ast/src/util/literal.rs b/compiler/rustc_ast/src/util/literal.rs index 5fa0ea35455..cd3b163e3ac 100644 --- a/compiler/rustc_ast/src/util/literal.rs +++ b/compiler/rustc_ast/src/util/literal.rs @@ -240,8 +240,14 @@ impl fmt::Display for LitKind { string = symbol )?; } - // TODO need to reescape - LitKind::CStr(..) => todo!(), + LitKind::CStr(ref bytes, StrStyle::Cooked) => { + write!(f, "c\"{}\"", escape_byte_str_symbol(bytes))? + } + LitKind::CStr(ref bytes, StrStyle::Raw(n)) => { + // This can only be valid UTF-8. + let symbol = str::from_utf8(bytes).unwrap(); + write!(f, "cr{delim}\"{symbol}\"{delim}", delim = "#".repeat(n as usize),)?; + } LitKind::Int(n, ty) => { write!(f, "{n}")?; match ty { |
