diff options
| author | Ralf Jung <post@ralfj.de> | 2020-05-30 12:08:55 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-05-30 12:11:21 +0200 |
| commit | 9c627c33dde998cfe42bcde07e1c5692370daf63 (patch) | |
| tree | 59cd9bb446c94b2a8003d4a18df605b99553c2e1 /src/libstd/sys_common | |
| parent | 3182cdf9baf8ed9e8ae24f4742ee5d3d01c2b54a (diff) | |
| download | rust-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.rs | 3 |
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]; } |
