Skip to content

Commit 434f6a4

Browse files
committed
Add impl const for Clone
1 parent 688ea65 commit 434f6a4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

library/core/src/clone.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,19 @@ pub macro Clone($item:item) {
258258
/// Use closures allow captured values to be automatically used.
259259
/// This is similar to have a closure that you would call `.use` over each captured value.
260260
#[unstable(feature = "ergonomic_clones", issue = "132290")]
261+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
262+
#[const_trait]
261263
#[lang = "use_cloned"]
262-
pub trait UseCloned: Clone {
264+
pub trait UseCloned: ~const Clone {
263265
// Empty.
264266
}
265267

266268
macro_rules! impl_use_cloned {
267269
($($t:ty)*) => {
268270
$(
269271
#[unstable(feature = "ergonomic_clones", issue = "132290")]
270-
impl UseCloned for $t {}
272+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
273+
impl const UseCloned for $t {}
271274
)*
272275
}
273276
}
@@ -543,7 +546,8 @@ mod impls {
543546
($($t:ty)*) => {
544547
$(
545548
#[stable(feature = "rust1", since = "1.0.0")]
546-
impl Clone for $t {
549+
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
550+
impl const Clone for $t {
547551
#[inline(always)]
548552
fn clone(&self) -> Self {
549553
*self

0 commit comments

Comments
 (0)