Sparkle some attributes over CloneToUninit stuff

This commit is contained in:
Pavel Grigorenko
2024-06-24 18:09:27 +03:00
parent afabc583f7
commit dbc13fb309
6 changed files with 12 additions and 0 deletions
+7
View File
@@ -272,6 +272,7 @@ pub unsafe trait CloneToUninit {
#[unstable(feature = "clone_to_uninit", issue = "126799")]
unsafe impl<T: Clone> 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().
@@ -285,8 +286,10 @@ unsafe impl<T: Clone> 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<T: Copy> 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().
@@ -298,6 +301,7 @@ unsafe fn clone_to_uninit(&self, dst: *mut Self) {
#[unstable(feature = "clone_to_uninit", issue = "126799")]
unsafe impl<T: Clone> CloneToUninit for [T] {
#[inline]
#[cfg_attr(debug_assertions, track_caller)]
default unsafe fn clone_to_uninit(&self, dst: *mut Self) {
let len = self.len();
@@ -326,8 +330,10 @@ unsafe impl<T: Clone> CloneToUninit for [T] {
}
}
#[doc(hidden)]
#[unstable(feature = "clone_to_uninit", issue = "126799")]
unsafe impl<T: Copy> CloneToUninit for [T] {
#[inline]
#[cfg_attr(debug_assertions, track_caller)]
unsafe fn clone_to_uninit(&self, dst: *mut Self) {
let len = self.len();
@@ -348,6 +354,7 @@ unsafe fn clone_to_uninit(&self, dst: *mut Self) {
#[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
+1
View File
@@ -1266,6 +1266,7 @@ fn clone(&self) -> Self {
#[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
+1
View File
@@ -3113,6 +3113,7 @@ pub fn into_path_buf(self: Box<Path>) -> PathBuf {
#[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
+1
View File
@@ -351,6 +351,7 @@ pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool {
#[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]
+1
View File
@@ -274,6 +274,7 @@ pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool {
#[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
+1
View File
@@ -1051,6 +1051,7 @@ fn hash<H: Hasher>(&self, state: &mut H) {
#[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]