diff options
| author | bors <bors@rust-lang.org> | 2024-06-25 21:13:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-25 21:13:48 +0000 |
| commit | fda509e817abeeecb5b76bc1de844f355675c81e (patch) | |
| tree | 17494a40e9c437e5c9243f41a3114cbfc3e4d680 /library/std/src/sys_common | |
| parent | c290e9de32e8ba6a673ef125fde40eadd395d170 (diff) | |
| parent | 4ebd69c06350a3ffd59e1109e7eefe8cabf06eb0 (diff) | |
| download | rust-fda509e817abeeecb5b76bc1de844f355675c81e.tar.gz rust-fda509e817abeeecb5b76bc1de844f355675c81e.zip | |
Auto merge of #126965 - matthiaskrgr:rollup-x3kamn8, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #126302 (Detect unused structs which derived Default) - #126885 (Remove internal `PathBuf::as_mut_vec`) - #126916 (Specify target specific linker for `riscv64gc-gnu` job) - #126926 (Tweak a confusing comment in `create_match_candidates`) - #126927 (core: VaArgSafe is an unsafe trait) - #126932 (Tweak `FlatPat::new` to avoid a temporarily-invalid state) - #126946 (Add missing slash in `const_eval_select` doc comment) - #126947 (Delegation: ast lowering refactor) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/sys_common')
| -rw-r--r-- | library/std/src/sys_common/wtf8.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs index 84128a4b595..708f62f476e 100644 --- a/library/std/src/sys_common/wtf8.rs +++ b/library/std/src/sys_common/wtf8.rs @@ -474,13 +474,13 @@ impl Wtf8Buf { Wtf8Buf { bytes: bytes.into_vec(), is_known_utf8: false } } - /// Part of a hack to make PathBuf::push/pop more efficient. + /// Provides plumbing to core `Vec::extend_from_slice`. + /// More well behaving alternative to allowing outer types + /// full mutable access to the core `Vec`. #[inline] - pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> { - // FIXME: this function should not even exist, as it implies violating Wtf8Buf invariants - // For now, simply assume that is about to happen. - self.is_known_utf8 = false; - &mut self.bytes + pub(crate) fn extend_from_slice(&mut self, other: &[u8]) { + self.bytes.extend_from_slice(other); + self.is_known_utf8 = self.is_known_utf8 || self.next_surrogate(0).is_none(); } } |
