about summary refs log tree commit diff
path: root/library/std/src/sys/os_str/wtf8.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/sys/os_str/wtf8.rs')
-rw-r--r--library/std/src/sys/os_str/wtf8.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/std/src/sys/os_str/wtf8.rs b/library/std/src/sys/os_str/wtf8.rs
index ed975ba58b5..433237aa6e7 100644
--- a/library/std/src/sys/os_str/wtf8.rs
+++ b/library/std/src/sys/os_str/wtf8.rs
@@ -1,5 +1,8 @@
 //! The underlying OsString/OsStr implementation on Windows is a
 //! wrapper around the "WTF-8" encoding; see the `wtf8` module for more.
+use core::clone::CloneToUninit;
+use core::ptr::addr_of_mut;
+
 use crate::borrow::Cow;
 use crate::collections::TryReserveError;
 use crate::rc::Rc;
@@ -268,3 +271,13 @@ impl Slice {
         self.inner.eq_ignore_ascii_case(&other.inner)
     }
 }
+
+#[unstable(feature = "clone_to_uninit", issue = "126799")]
+unsafe impl CloneToUninit for Slice {
+    #[inline]
+    #[cfg_attr(debug_assertions, track_caller)]
+    unsafe fn clone_to_uninit(&self, dst: *mut Self) {
+        // SAFETY: we're just a wrapper around Wtf8
+        unsafe { self.inner.clone_to_uninit(addr_of_mut!((*dst).inner)) }
+    }
+}