Rollup merge of #146976 - npmccallum:clone, r=scottmcm

constify basic Clone impls
This commit is contained in:
Stuart Cook 2025-10-14 16:30:56 +11:00 committed by GitHub
commit ed290fdd5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -575,7 +575,8 @@ mod impls {
($($t:ty)*) => {
$(
#[stable(feature = "rust1", since = "1.0.0")]
impl Clone for $t {
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
impl const Clone for $t {
#[inline(always)]
fn clone(&self) -> Self {
*self
@ -593,7 +594,8 @@ mod impls {
}
#[unstable(feature = "never_type", issue = "35121")]
impl Clone for ! {
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
impl const Clone for ! {
#[inline]
fn clone(&self) -> Self {
*self
@ -601,7 +603,8 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: PointeeSized> Clone for *const T {
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
impl<T: PointeeSized> const Clone for *const T {
#[inline(always)]
fn clone(&self) -> Self {
*self
@ -609,7 +612,8 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: PointeeSized> Clone for *mut T {
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
impl<T: PointeeSized> const Clone for *mut T {
#[inline(always)]
fn clone(&self) -> Self {
*self
@ -618,7 +622,8 @@ mod impls {
/// Shared references can be cloned, but mutable references *cannot*!
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: PointeeSized> Clone for &T {
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
impl<T: PointeeSized> const Clone for &T {
#[inline(always)]
#[rustc_diagnostic_item = "noop_method_clone"]
fn clone(&self) -> Self {