diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 9875ef020473..9df39d7b5420 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -282,6 +282,7 @@ unsafe impl CloneToUninit for T { // Specialized implementation for types that are [`Copy`], not just [`Clone`], // and can therefore be copied bitwise. +#[doc(hidden)] #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for T { unsafe fn clone_to_uninit(&self, dst: *mut Self) { @@ -296,6 +297,7 @@ unsafe impl CloneToUninit for T { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for [T] { #[cfg_attr(debug_assertions, track_caller)] + #[inline] default unsafe fn clone_to_uninit(&self, dst: *mut Self) { let len = self.len(); // This is the most likely mistake to make, so check it as a debug assertion. @@ -323,9 +325,11 @@ unsafe impl CloneToUninit for [T] { } } +#[doc(hidden)] #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for [T] { #[cfg_attr(debug_assertions, track_caller)] + #[inline] unsafe fn clone_to_uninit(&self, dst: *mut Self) { let len = self.len(); // This is the most likely mistake to make, so check it as a debug assertion. @@ -346,6 +350,7 @@ unsafe impl CloneToUninit for [T] { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for str { #[cfg_attr(debug_assertions, track_caller)] + #[inline] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: str is just a [u8] with UTF-8 invariant unsafe { self.as_bytes().clone_to_uninit(dst as *mut [u8]) } diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index 21f21d0c034b..b145fca58a90 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -1262,6 +1262,7 @@ impl Clone for Box { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for OsStr { #[cfg_attr(debug_assertions, track_caller)] + #[inline] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: we're just a wrapper around a platform-specific Slice unsafe { self.inner.clone_to_uninit(addr_of_mut!((*dst).inner)) } diff --git a/library/std/src/path.rs b/library/std/src/path.rs index eb111fd6b283..aa9b800f08a4 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -3032,6 +3032,7 @@ impl Path { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for Path { #[cfg_attr(debug_assertions, track_caller)] + #[inline] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: Path is just a wrapper around OsStr unsafe { self.inner.clone_to_uninit(core::ptr::addr_of_mut!((*dst).inner)) } diff --git a/library/std/src/sys/os_str/bytes.rs b/library/std/src/sys/os_str/bytes.rs index 339366e16a61..2907616f98cc 100644 --- a/library/std/src/sys/os_str/bytes.rs +++ b/library/std/src/sys/os_str/bytes.rs @@ -344,6 +344,7 @@ impl Slice { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for Slice { #[cfg_attr(debug_assertions, track_caller)] + #[inline] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: we're just a wrapper around [u8] unsafe { self.inner.clone_to_uninit(addr_of_mut!((*dst).inner)) } diff --git a/library/std/src/sys/os_str/wtf8.rs b/library/std/src/sys/os_str/wtf8.rs index abe7c855a06a..a56edeb5be15 100644 --- a/library/std/src/sys/os_str/wtf8.rs +++ b/library/std/src/sys/os_str/wtf8.rs @@ -266,6 +266,7 @@ impl Slice { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for Slice { #[cfg_attr(debug_assertions, track_caller)] + #[inline] 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)) } diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs index 1ed94035d996..a0ea44c5a239 100644 --- a/library/std/src/sys_common/wtf8.rs +++ b/library/std/src/sys_common/wtf8.rs @@ -1050,6 +1050,7 @@ impl Hash for Wtf8 { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for Wtf8 { #[cfg_attr(debug_assertions, track_caller)] + #[inline] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: we're just a wrapper around [u8] unsafe { self.bytes.clone_to_uninit(addr_of_mut!((*dst).bytes)) }