From 8488ae6d29f1985d43c2ef94417980a86609deb4 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Wed, 24 Jul 2024 22:43:12 -0400 Subject: [PATCH] Make Clone::clone a lang item --- core/src/clone.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/clone.rs b/core/src/clone.rs index 939b2be6dfaf1..76a89eaaff86e 100644 --- a/core/src/clone.rs +++ b/core/src/clone.rs @@ -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`.