Skip to content

Derive Hash for hashable generated ADTs - #17

Open
uurl wants to merge 1 commit into
cbeuw:masterfrom
uurl:feat/hashable-adts
Open

Derive Hash for hashable generated ADTs#17
uurl wants to merge 1 commit into
cbeuw:masterfrom
uurl:feat/hashable-adts

Conversation

@uurl

@uurl uurl commented Jul 24, 2026

Copy link
Copy Markdown

Closes #16

Summary

Allow generated ADTs to participate in hash-based variable dumping when their fields are recursively hashable and deterministically printable.

Changes

  • Remove the unconditional ADT exclusion from TyId::hashable().

  • Continue excluding types containing floating-point values or pointers.

  • Add Hash to the generated derive attributes for hashable ADTs.

  • Add tests covering:

    • ADTs with primitive hashable fields.
    • Nested hashable ADTs.
    • ADTs containing floating-point fields.
    • ADTs containing pointer fields.

Rationale

The dump-variable logic already selects initialized locals using TyId::hashable(). Generated ADTs were excluded because they did not derive Hash, even when all of their fields supported hashing.

This change enables those ADTs without modifying the dumper ABI, memory model, or type-generation behavior.

Validation

  • cargo fmt --check
  • cargo build
  • RUST_LOG=debug cargo test
  • cargo test -p mir serialize_hashable_adts -- --nocapture

Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow hashable ADTs to participate in variable dumps

1 participant