Skip to content

Commit 8488ae6

Browse files
committed
Make Clone::clone a lang item
1 parent 2fff48d commit 8488ae6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/clone.rs

+3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ pub trait Clone: Sized {
160160
/// ```
161161
#[stable(feature = "rust1", since = "1.0.0")]
162162
#[must_use = "cloning is often expensive and is not expected to have side effects"]
163+
// Clone::clone is special because the compiler generates MIR to implement it for some types.
164+
// See InstanceKind::CloneShim.
165+
#[cfg_attr(not(bootstrap), lang = "clone_fn")]
163166
fn clone(&self) -> Self;
164167

165168
/// Performs copy-assignment from `source`.

0 commit comments

Comments
 (0)