External Publication
Visit Post

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

Rust Internals [Unofficial] June 7, 2026
Source

HKalbasi:

It seems doesn't work in all cases though, e.g. with a generic parameter I see this:

Your proposal won't be able to support this case anyway, it is impossible without specialization. Unless you constrain Clone to T: Copy, but this significantly changes behavior and not something you can do if you want your proposal to be drop-in.

HKalbasi:

I 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.

That does not matter, since the only edition still need to be supported, and the code for it must still be inside the compiler.

Discussion in the ATmosphere

Loading comments...