Skip to content

Commit

Permalink
Make Clone::clone a lang item
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Jul 25, 2024
1 parent 2fff48d commit 8488ae6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ pub trait Clone: Sized {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "cloning is often expensive and is not expected to have side effects"]
// Clone::clone is special because the compiler generates MIR to implement it for some types.
// See InstanceKind::CloneShim.
#[cfg_attr(not(bootstrap), lang = "clone_fn")]
fn clone(&self) -> Self;

/// Performs copy-assignment from `source`.
Expand Down

0 comments on commit 8488ae6

Please sign in to comment.