about summary refs log tree commit diff
path: root/library/core/src/ascii.rs
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2023-05-12 19:37:02 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2023-05-12 19:37:02 -0700
commit28449daa2241410d4c384c5608b87fe7c85ffae6 (patch)
tree40cfb1e6d2c7e5087f61af88867f488d912e5dfc /library/core/src/ascii.rs
parent4a59ba4d54a3ec0d8ea1e82b7eeb5c8b0162de04 (diff)
downloadrust-28449daa2241410d4c384c5608b87fe7c85ffae6.tar.gz
rust-28449daa2241410d4c384c5608b87fe7c85ffae6.zip
`ascii::Char`-ify the escaping code
This means that `EscapeIterInner::as_str` no longer needs unsafe code, because the type system ensures the internal buffer is only ASCII, and thus valid UTF-8.
Diffstat (limited to 'library/core/src/ascii.rs')
-rw-r--r--library/core/src/ascii.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/ascii.rs b/library/core/src/ascii.rs
index 7fd14a7e1ea..ef8e4d098ed 100644
--- a/library/core/src/ascii.rs
+++ b/library/core/src/ascii.rs
@@ -91,7 +91,7 @@ pub struct EscapeDefault(escape::EscapeIterInner<4>);
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn escape_default(c: u8) -> EscapeDefault {
-    let mut data = [0; 4];
+    let mut data = [Char::Null; 4];
     let range = escape::escape_ascii_into(&mut data, c);
     EscapeDefault(escape::EscapeIterInner::new(data, range))
 }