From af04418a0519d45af1bc41667bffc0c2fce2cef4 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Tue, 11 Jun 2024 22:55:55 -0700 Subject: Make PathBuf less Ok with adding UTF-16 then `into_string` --- library/std/src/sys_common/wtf8.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'library/std/src') 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 { + // 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 } } -- cgit 1.4.1-3-g733a5