Skip to content

Commit 3182cdf

Browse files
committed
wtf8: use encode_utf8_raw
1 parent 72d85db commit 3182cdf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@
247247
#![feature(cfg_target_has_atomic)]
248248
#![feature(cfg_target_thread_local)]
249249
#![feature(char_error_internals)]
250+
#![feature(char_internals)]
250251
#![feature(clamp)]
251252
#![feature(concat_idents)]
252253
#![feature(const_cstr_unchecked)]

src/libstd/sys_common/wtf8.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,8 @@ impl Wtf8Buf {
201201
/// Copied from String::push
202202
/// This does **not** include the WTF-8 concatenation check.
203203
fn push_code_point_unchecked(&mut self, code_point: CodePoint) {
204-
let c = unsafe { char::from_u32_unchecked(code_point.value) };
205204
let mut bytes = [0; 4];
206-
let bytes = c.encode_utf8(&mut bytes).as_bytes();
205+
let bytes = char::encode_utf8_raw(code_point.value, &mut bytes).as_bytes();
207206
self.bytes.extend_from_slice(bytes)
208207
}
209208

0 commit comments

Comments
 (0)