-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
PathBuf::as_mut_vec
removed and verified for UEFI and Windows platf…
…orms #126333
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Borgerr
Author
Contributor
|
||
} | ||
} | ||
|
||
|
Maybe this is not sound because we use the old value of
is_known_utf8
after callingextend_from_slice
.