From 9e4e9e439076a81357d8ce996d76cc906f137a48 Mon Sep 17 00:00:00 2001 From: Theemathas Chirananthavat Date: Wed, 10 Dec 2025 15:38:16 +0700 Subject: [PATCH] Use `PointeeSized` bound for `TrivialClone` impls These `TrivialClone` impls previously had `?Sized` bounds, which are different from the `PointeeSized` bounds on the corresponding `Clone` and `Copy` impls. So, I've changed the `?Sized` bounds into `PointeeSized` bounds. This mistake was made presumably because the `TrivialClone` PR (https://github.com/rust-lang/rust/pull/135634) was opened in Jan 2025, but merged in Nov 2025. During that time, the sized hierachy PR (https://github.com/rust-lang/rust/pull/137944) was opened in Mar 2025, and merged in Jun 2025. The `TrivialClone` PR was not updated to account for the sized hierachy changes. --- library/core/src/marker.rs | 2 +- library/core/src/ptr/metadata.rs | 2 +- library/core/src/ptr/non_null.rs | 2 +- library/core/src/ptr/unique.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index e945cd77a75f7..68f22767d6cf0 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -860,7 +860,7 @@ impl Clone for PhantomData { #[doc(hidden)] #[unstable(feature = "trivial_clone", issue = "none")] -unsafe impl TrivialClone for PhantomData {} +unsafe impl TrivialClone for PhantomData {} #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] diff --git a/library/core/src/ptr/metadata.rs b/library/core/src/ptr/metadata.rs index 998a5b031c280..1a58643168332 100644 --- a/library/core/src/ptr/metadata.rs +++ b/library/core/src/ptr/metadata.rs @@ -233,7 +233,7 @@ impl Clone for DynMetadata { } #[doc(hidden)] -unsafe impl TrivialClone for DynMetadata {} +unsafe impl TrivialClone for DynMetadata {} impl Eq for DynMetadata {} diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index aa3af2f185287..cb43d095f5d1a 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -1656,7 +1656,7 @@ impl Copy for NonNull {} #[doc(hidden)] #[unstable(feature = "trivial_clone", issue = "none")] -unsafe impl TrivialClone for NonNull {} +unsafe impl TrivialClone for NonNull {} #[unstable(feature = "coerce_unsized", issue = "18598")] impl CoerceUnsized> for NonNull where T: Unsize {} diff --git a/library/core/src/ptr/unique.rs b/library/core/src/ptr/unique.rs index 5e7b1f7038024..1bbe3ea242f6c 100644 --- a/library/core/src/ptr/unique.rs +++ b/library/core/src/ptr/unique.rs @@ -168,7 +168,7 @@ impl Copy for Unique {} #[doc(hidden)] #[unstable(feature = "trivial_clone", issue = "none")] -unsafe impl TrivialClone for Unique {} +unsafe impl TrivialClone for Unique {} #[unstable(feature = "ptr_internals", issue = "none")] impl CoerceUnsized> for Unique where T: Unsize {}