about summary refs log tree commit diff
path: root/src/libstd/sys_common
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-05-30 12:08:55 +0200
committerRalf Jung <post@ralfj.de>2020-05-30 12:11:21 +0200
commit9c627c33dde998cfe42bcde07e1c5692370daf63 (patch)
tree59cd9bb446c94b2a8003d4a18df605b99553c2e1 /src/libstd/sys_common
parent3182cdf9baf8ed9e8ae24f4742ee5d3d01c2b54a (diff)
downloadrust-9c627c33dde998cfe42bcde07e1c5692370daf63.tar.gz
rust-9c627c33dde998cfe42bcde07e1c5692370daf63.zip
also expose and use encode_utf16_raw for wtf8
Diffstat (limited to 'src/libstd/sys_common')
-rw-r--r--src/libstd/sys_common/wtf8.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs
index 90bbf4afd1a..9f589c93ae5 100644
--- a/src/libstd/sys_common/wtf8.rs
+++ b/src/libstd/sys_common/wtf8.rs
@@ -828,8 +828,7 @@ impl<'a> Iterator for EncodeWide<'a> {
 
         let mut buf = [0; 2];
         self.code_points.next().map(|code_point| {
-            let c = unsafe { char::from_u32_unchecked(code_point.value) };
-            let n = c.encode_utf16(&mut buf).len();
+            let n = char::encode_utf16_raw(code_point.value, &mut buf).len();
             if n == 2 {
                 self.extra = buf[1];
             }