diff options
| author | ash <97464181+Borgerr@users.noreply.github.com> | 2024-06-25 07:34:35 -0600 |
|---|---|---|
| committer | ash <97464181+Borgerr@users.noreply.github.com> | 2024-06-25 07:36:34 -0600 |
| commit | aa46a3368eb017eba41bfab956c7787d46c09935 (patch) | |
| tree | d35402a118f084f15479a264ddbdf393deae819b /library/std/src/sys_common | |
| parent | 7e187e8e4b0a12b9adc0d24dc30dffde6ceaba4a (diff) | |
| download | rust-aa46a3368eb017eba41bfab956c7787d46c09935.tar.gz rust-aa46a3368eb017eba41bfab956c7787d46c09935.zip | |
`PathBuf::as_mut_vec` removed and verified for UEFI and Windows platforms #126333
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(); } } |
