Make derive(Clone) implement clone_from as well

Currently #[derive(Clone)] only implements fn clone(&self) -> Self, leaves fn clone_from(&mut self, source: &Self) unimplemented. This makes clone_from with usual structs/enums far less useful than it should be. My question is, would it be possible to make #[derive(Clone)] to generate proper clone_from implementation? Technically it's a breaking change though it should purely be an optimization. Does it sounds feasible to change builtin derive macro in this way?

1 Like

See https://github.com/rust-lang/rust/pull/98445#issuecomment-1190681305

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.