summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/core/src/clone.rs9
-rw-r--r--library/core/src/lib.rs1
2 files changed, 8 insertions, 2 deletions
diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs
index 57de507a73e..a34d1b4a064 100644
--- a/library/core/src/clone.rs
+++ b/library/core/src/clone.rs
@@ -36,7 +36,7 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
-use crate::marker::PointeeSized;
+use crate::marker::{Destruct, PointeeSized};
 
 mod uninit;
 
@@ -157,6 +157,8 @@ mod uninit;
 #[lang = "clone"]
 #[rustc_diagnostic_item = "Clone"]
 #[rustc_trivial_field_reads]
+#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
+#[const_trait]
 pub trait Clone: Sized {
     /// Returns a duplicate of the value.
     ///
@@ -208,7 +210,10 @@ pub trait Clone: Sized {
     /// allocations.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn clone_from(&mut self, source: &Self) {
+    fn clone_from(&mut self, source: &Self)
+    where
+        Self: ~const Destruct,
+    {
         *self = source.clone()
     }
 }
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 6231c3425c8..39d5399101d 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -103,6 +103,7 @@
 #![feature(cfg_select)]
 #![feature(cfg_target_has_reliable_f16_f128)]
 #![feature(const_carrying_mul_add)]
+#![feature(const_destruct)]
 #![feature(const_eval_select)]
 #![feature(core_intrinsics)]
 #![feature(coverage_attribute)]