Problem
TyId::hashable() currently excludes every ADT, even when all of its fields are recursively hashable and deterministically printable.
Generated ADTs derive Debug and optionally Copy and Clone, but they never derive Hash. Consequently, initialized ADT locals are never selected by insert_dump_var_gadget() for hash-based output.
Proposed change
- Allow
TyId::hashable() to accept ADTs that contain no floating-point or pointer types.
- Add
Hash to the generated derive attributes for ADTs that satisfy TyId::hashable().
- Preserve the current exclusion of pointer-containing and floating-point-containing values.
- Add tests covering primitive-field ADTs, nested ADTs, floating-point fields, and pointer fields.
Scope
This should not change:
- The dumper function signature.
- Memory or pointer semantics.
- Type-generation weights.
- ADT generation behavior.
- The handling of floats or pointers.
Acceptance criteria
- Hashable generated ADTs derive
Hash.
- Nested hashable ADTs derive
Hash.
- ADTs containing floats or pointers do not derive
Hash.
- Hashable initialized ADT locals can be selected by the existing dump-variable logic.
- Existing workspace tests continue to pass.
Problem
TyId::hashable()currently excludes every ADT, even when all of its fields are recursively hashable and deterministically printable.Generated ADTs derive
Debugand optionallyCopyandClone, but they never deriveHash. Consequently, initialized ADT locals are never selected byinsert_dump_var_gadget()for hash-based output.Proposed change
TyId::hashable()to accept ADTs that contain no floating-point or pointer types.Hashto the generated derive attributes for ADTs that satisfyTyId::hashable().Scope
This should not change:
Acceptance criteria
Hash.Hash.Hash.