You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust: a constructor that leaves a struct-, enum- or type-parameter-typed field unset fails with E0277, since #480's Default::default() needs a Default the generator never derives #493
#480 (fixing #344) writes each field a Rust constructor leaves unset as field: Default::default(). That only compiles if the field's type implements Default, and RustGenerator never derives Default on anything it writes:
Enums derive Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, but not Default (:2415).
An unconstrained type parameter gets no Default bound.
The code involved is WriteConstructorBody (:1869-1931, with the loop at :1906-1909) and InstanceFieldNames (:1936). The empty-initialiser path at :1893 and the base-struct field (BaseMemberName) go wrong the same way.
Activity
matt-edmondson commentedon Nov 12, 2026
Triage
Stringfields are fine.RustGenerator.WriteConstructorBody/InstanceFieldNamesand the derive lists for structs and enums.self.namewhich is behind a shared reference" #495 (Clonefor getters). All three want the Rust: a record with a field of a plain struct type doesn't compile (E0277/E0369) because only the record derives Clone/Debug/PartialEq #302 reachability walk to add derives, so one change can cover them.Generated by Claude Code