Should be very similar to deriving `Default`, see `src/ir/analysis/derive_default.rs` and the `CanDeriveDefault` trait that gets used in codegen.