# [derive(Clone)] Is Broken
10 months ago
- #Macros
- #Rust
- #Programming
- The code examples discuss Rust's `#[derive(Clone)]` and its overly restrictive requirements.
- The first example shows a `WrapArc<T>` struct that should compile but doesn't due to Rust's `Clone` derive requirements.
- The second example demonstrates a similar issue with `PartialEq` and `Eq` traits.
- The core problem is that Rust's built-in derive traits require all generic parameters to implement the trait, even when unused.
- Two solutions are proposed: a long-term RFC process or a quick custom macro approach.
- The author suggests implementing a less restrictive derive macro in the `derive_more` crate or creating a new crate.