Skip to content

Commit ed290fd

Browse files
authored
Rollup merge of #146976 - npmccallum:clone, r=scottmcm
constify basic Clone impls
2 parents 6e07b25 + 04c2724 commit ed290fd

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎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-
implClonefor $t {
578+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
579+
implconstClonefor $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-
implClonefor ! {
597+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
598+
implconstClonefor ! {
597599
#[inline]
598600
fnclone(&self) -> Self{
599601
*self
600602
}
601603
}
602604

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

611614
#[stable(feature = "rust1", since = "1.0.0")]
612-
impl<T:PointeeSized>Clonefor*mutT{
615+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
616+
impl<T:PointeeSized>constClonefor*mutT{
613617
#[inline(always)]
614618
fnclone(&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>Clonefor&T{
625+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
626+
impl<T:PointeeSized>constClonefor&T{
622627
#[inline(always)]
623628
#[rustc_diagnostic_item = "noop_method_clone"]
624629
fnclone(&self) -> Self{

0 commit comments

Comments
 (0)