IR v2 package to Rust source plus an extern-C header (ADR-0004 section 7, ADR-0007 decision 13).
The full E1.12 backend over the typl surface. Each declaration in a
[v2::Package] is realized twice: once as idiomatic Rust (the language
layer of typl reference Appendix D — every integer is i64, every float is
f64) and once, where the C ABI admits it, as an entry in a companion C
header. Named scalar types become #[repr(transparent)] newtypes so unit
safety survives into generated code (typl reference §5.7); composites map to
structs, enums, and Rust enum unions.
Rust source is built as a [proc_macro2::TokenStream] with quote and
formatted with prettyplease, never by shelling out to rustfmt.
Default derivation follows the leaf-recursion rule: an impl Default is
emitted for a type only when every field it transitively contains is
derivable. The IR InitValue.derivable flag on a composite-typed field is a
one-level flag, so same-package composite references are re-checked by
recursion rather than trusted (see the defaults module).
Derive eligibility uses the same recursion over the transitive closure, in
the derives module: Debug, Clone and PartialEq on every generated
type, Copy, Eq, Hash and the ordering pair where the closure permits,
and Default never, because it comes from the typl init value instead.