Skip to content

Commit 08b0ee4

Browse files
committed
automatically implement TrivialClone for closures and tuples
If each of the component types is `TrivialClone`, the closure/tuple itself can be trivially cloned.
1 parent bc70836 commit 08b0ee4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

core/src/clone.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ pub const trait Clone: Sized {
269269
issue = "none"
270270
)]
271271
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
272+
#[lang = "trivial_clone"]
272273
// SAFETY:
273274
// It is sound to specialize on this because the `clone` implementation cannot be
274275
// lifetime-dependent. Therefore, if `TrivialClone` is implemented for any lifetime,

0 commit comments

Comments
 (0)