External Publication
Visit Post

Make `#[derive(Copy)]` enough for both `Clone` and `Copy`

Rust Internals [Unofficial] June 4, 2026
Source

Also for PartialEq and Eq, and PartialOrd and Ord. This would help in reducing the derive noise on types:

// Previously: #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
#[derive(Eq, Ord, Copy, Hash)]
struct Foo {
    x: i32,
    y: i64,
}

There may be some implementation difficulty about conflicting impls generated by derive(Copy) and derive(Clone) or manual Clone impls. But since these are builtin, the compiler can handle it by using a #[rustc_interanal_ignore_this_impl_in_presence_of_others]. We can fix the semantics and emit error about conflicting impls over an edition.

Discussion in the ATmosphere

Loading comments...