Skip to content

Commit e3622db

Browse files
committed
constify basic Clone impls
1 parent 637b50b commit e3622db

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

library/core/src/clone.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ mod impls {
575575
($($t:ty)*) => {
576576
$(
577577
#[stable(feature = "rust1", since = "1.0.0")]
578-
impl Clone for $t {
578+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
579+
impl const Clone for $t {
579580
#[inline(always)]
580581
fn clone(&self) -> Self {
581582
*self
@@ -593,23 +594,26 @@ mod impls {
593594
}
594595

595596
#[unstable(feature = "never_type", issue = "35121")]
596-
impl Clone for ! {
597+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
598+
impl const Clone for ! {
597599
#[inline]
598600
fn clone(&self) -> Self {
599601
*self
600602
}
601603
}
602604

603605
#[stable(feature = "rust1", since = "1.0.0")]
604-
impl<T: PointeeSized> Clone for *const T {
606+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
607+
impl<T: PointeeSized> const Clone for *const T {
605608
#[inline(always)]
606609
fn clone(&self) -> Self {
607610
*self
608611
}
609612
}
610613

611614
#[stable(feature = "rust1", since = "1.0.0")]
612-
impl<T: PointeeSized> Clone for *mut T {
615+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
616+
impl<T: PointeeSized> const Clone for *mut T {
613617
#[inline(always)]
614618
fn clone(&self) -> Self {
615619
*self
@@ -618,7 +622,8 @@ mod impls {
618622

619623
/// Shared references can be cloned, but mutable references *cannot*!
620624
#[stable(feature = "rust1", since = "1.0.0")]
621-
impl<T: PointeeSized> Clone for &T {
625+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
626+
impl<T: PointeeSized> const Clone for &T {
622627
#[inline(always)]
623628
#[rustc_diagnostic_item = "noop_method_clone"]
624629
fn clone(&self) -> Self {

0 commit comments

Comments
 (0)