{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreihkg2v73xoarff2qnqdukkhgbk7fmjiebg6xatmo4jiszpe7p74x4",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mnpubt37seh2"
},
"path": "/t/make-derive-copy-enough-for-both-clone-and-copy/24371?page=2#post_23",
"publishedAt": "2026-06-07T17:13:28.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "chrefr:\n\n> The `Clone` derive already does that\n\nInteresting, I wasn't aware of that. It seems doesn't work in all cases though, e.g. with a generic parameter I see this:\n\n\n struct Foo<T> {\n a: T,\n b: T,\n c: T,\n }\n #[attr = AutomaticallyDerived]\n impl <T> ::core::clone::Clone for Foo<T> where T: ::core::clone::Clone {\n #[attr = Inline(Hint)]\n fn clone(&self)\n ->\n Foo<T> {\n Foo {\n a: ::core::clone::Clone::clone(&self.a),\n b: ::core::clone::Clone::clone(&self.b),\n c: ::core::clone::Clone::clone(&self.c) }\n }\n }\n\n\nMight be something related to backward compatibility.\n\nchrefr:\n\n> Not true, since old editions must still be supported by the compiler.\n\nI meant dropping the original `#[rustc_ignore_this_impl_in_case_of_conflict]` proposal and doing this only over an edition. That is, `#[derive(Copy)]` in a new edition is equivalent of both `Clone` and `Copy`, and adding another `Clone` impl (either manually or via `derive`) is a hard error, and not touching the current editions at all.",
"title": "Make `#[derive(Copy)]` enough for both `Clone` and `Copy`"
}