{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreifu3x2eeyum2szomdzqp4dwzh4i4tr26pmiixl7o4paslpgzadqai",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mnp7wm2yhdk2"
  },
  "path": "/t/make-derive-copy-enough-for-both-clone-and-copy/24371#post_19",
  "publishedAt": "2026-06-07T11:45:34.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "chrefr:\n\n> I disagree: I might have valid reasons to have custom code in `eq()` but `Eq` is still the same. In fact I did that in the past and also saw it in other places.\n\nYou can do this for `Eq` since it is just a marker trait. Doing this for `PartialOrd` or `Clone` would be against the contract of those traits, and a logic error. Even in the `Eq` case, your intent is better expressed as `impl Eq for T {}` instead of `derive`.\n\nchrefr:\n\n> saving typing 7 letters does not justify a serious language and compiler complexity\n\nIt is not just saving 7 letters, it can also improve the codegen for `Clone`:\n\n\n    impl Clone for T { fn clone(&self) -> Self { *self } }\n\n\nWhich either saves the optimizer time, or improve the final program performance. And if it gets done over an edition, it has additional benefit of preventing the mentioned logic error, and it would no longer need complex compiler features.",
  "title": "Make `#[derive(Copy)]` enough for both `Clone` and `Copy`"
}