about summary refs log tree commit diff
path: root/library/std/src/sys_common
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-06-11 22:55:55 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-06-12 01:00:21 -0700
commitaf04418a0519d45af1bc41667bffc0c2fce2cef4 (patch)
tree9c7967379582c8661dbc613ff9ef204d69e3d360 /library/std/src/sys_common
parent76c73827dcd0b363e60b22c3cef64bde4171bf17 (diff)
downloadrust-af04418a0519d45af1bc41667bffc0c2fce2cef4.tar.gz
rust-af04418a0519d45af1bc41667bffc0c2fce2cef4.zip
Make PathBuf less Ok with adding UTF-16 then `into_string`
Diffstat (limited to 'library/std/src/sys_common')
-rw-r--r--library/std/src/sys_common/wtf8.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs
index bb1e505285b..84128a4b595 100644
--- a/library/std/src/sys_common/wtf8.rs
+++ b/library/std/src/sys_common/wtf8.rs
@@ -477,6 +477,9 @@ impl Wtf8Buf {
     /// Part of a hack to make PathBuf::push/pop more efficient.
     #[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
     }
 }