diff options
| author | bors <bors@rust-lang.org> | 2020-05-31 13:39:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-31 13:39:05 +0000 |
| commit | f6072cab136beea206b7cfe79f8d10fccf5af591 (patch) | |
| tree | 11b0ec9ab29833da453b04c7c2ee9e72a3f52a88 /src/libstd | |
| parent | 4b1f86adbe41e8dd4864ca2315f43953dd503bb5 (diff) | |
| parent | cbc73dc2637343f3a0ebba92efc5942e37cc4763 (diff) | |
| download | rust-f6072cab136beea206b7cfe79f8d10fccf5af591.tar.gz rust-f6072cab136beea206b7cfe79f8d10fccf5af591.zip | |
Auto merge of #72813 - RalfJung:rollup-4ko6q8j, r=RalfJung
Rollup of 5 pull requests Successful merges: - #72683 (from_u32_unchecked: check validity, and fix UB in Wtf8) - #72715 (Account for trailing comma when suggesting `where` clauses) - #72745 (generalize Borrow<[T]> for Interned<'tcx, List<T>>) - #72749 (Update stdarch submodule to latest head) - #72781 (Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error`) Failed merges: r? @ghost
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/lib.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys_common/wtf8.rs | 6 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 9ddaa100c0e..d6493454db5 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -247,6 +247,7 @@ #![feature(cfg_target_has_atomic)] #![feature(cfg_target_thread_local)] #![feature(char_error_internals)] +#![feature(char_internals)] #![feature(clamp)] #![feature(concat_idents)] #![feature(const_cstr_unchecked)] diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index a5ba3daba3e..bdb6a05464e 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -201,9 +201,8 @@ impl Wtf8Buf { /// Copied from String::push /// This does **not** include the WTF-8 concatenation check. fn push_code_point_unchecked(&mut self, code_point: CodePoint) { - let c = unsafe { char::from_u32_unchecked(code_point.value) }; let mut bytes = [0; 4]; - let bytes = c.encode_utf8(&mut bytes).as_bytes(); + let bytes = char::encode_utf8_raw(code_point.value, &mut bytes); self.bytes.extend_from_slice(bytes) } @@ -840,8 +839,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]; } |
