This should be almost identical to deriving `Default`: `src/ir/analysis/derive_default.rs` and the `CanDeriveDefault` trait.