From c4139df11838b20b512f525076a5b9db61ebe464 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Mon, 24 Jun 2024 18:09:27 +0300 Subject: [PATCH] Sparkle some attributes over `CloneToUninit` stuff --- library/core/src/clone.rs | 7 +++++++ library/std/src/ffi/os_str.rs | 1 + library/std/src/path.rs | 1 + library/std/src/sys/os_str/bytes.rs | 1 + library/std/src/sys/os_str/wtf8.rs | 1 + library/std/src/sys_common/wtf8.rs | 1 + 6 files changed, 12 insertions(+) diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 9875ef020473..24bdb3fb8b07 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -269,6 +269,7 @@ pub unsafe trait CloneToUninit { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for T { + #[inline] default unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: The safety conditions of clone_to_uninit() are a superset of those of // ptr::write(). @@ -282,8 +283,10 @@ 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 { + #[inline] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: The safety conditions of clone_to_uninit() are a superset of those of // ptr::copy_nonoverlapping(). @@ -295,6 +298,7 @@ unsafe impl CloneToUninit for T { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for [T] { + #[inline] #[cfg_attr(debug_assertions, track_caller)] default unsafe fn clone_to_uninit(&self, dst: *mut Self) { let len = self.len(); @@ -323,8 +327,10 @@ unsafe impl CloneToUninit for [T] { } } +#[doc(hidden)] #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for [T] { + #[inline] #[cfg_attr(debug_assertions, track_caller)] unsafe fn clone_to_uninit(&self, dst: *mut Self) { let len = self.len(); @@ -345,6 +351,7 @@ unsafe impl CloneToUninit for [T] { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for str { + #[inline] #[cfg_attr(debug_assertions, track_caller)] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: str is just a [u8] with UTF-8 invariant diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index db99e990d5be..8d0a6529ede9 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -1271,6 +1271,7 @@ impl Clone for Box { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for OsStr { + #[inline] #[cfg_attr(debug_assertions, track_caller)] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: we're just a wrapper around a platform-specific Slice diff --git a/library/std/src/path.rs b/library/std/src/path.rs index eb8f0d1a8f00..1629f2bf397d 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -3026,6 +3026,7 @@ impl Path { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for Path { + #[inline] #[cfg_attr(debug_assertions, track_caller)] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: Path is just a wrapper around OsStr diff --git a/library/std/src/sys/os_str/bytes.rs b/library/std/src/sys/os_str/bytes.rs index 761557faeedd..b8aaced23c65 100644 --- a/library/std/src/sys/os_str/bytes.rs +++ b/library/std/src/sys/os_str/bytes.rs @@ -353,6 +353,7 @@ impl Slice { #[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 [u8] diff --git a/library/std/src/sys/os_str/wtf8.rs b/library/std/src/sys/os_str/wtf8.rs index 7f1aeb7a07c4..3320f4364a51 100644 --- a/library/std/src/sys/os_str/wtf8.rs +++ b/library/std/src/sys/os_str/wtf8.rs @@ -275,6 +275,7 @@ impl Slice { #[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 diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs index 261a5700ee81..41eff858f1e1 100644 --- a/library/std/src/sys_common/wtf8.rs +++ b/library/std/src/sys_common/wtf8.rs @@ -1049,6 +1049,7 @@ impl Hash for Wtf8 { #[unstable(feature = "clone_to_uninit", issue = "126799")] unsafe impl CloneToUninit for Wtf8 { + #[inline] #[cfg_attr(debug_assertions, track_caller)] unsafe fn clone_to_uninit(&self, dst: *mut Self) { // SAFETY: we're just a wrapper around [u8]