Skip to main content

Module heap_variants

Module heap_variants 

Source
Expand description

Single source of truth for HeapValue variants.

define_heap_types! generates:

  • HeapValue enum
  • HeapKind enum (discriminant)
  • HeapValue::kind() method
  • HeapValue::is_truthy() method
  • HeapValue::type_name() method

equals(), structural_eq(), and Display remain hand-written because they have complex per-variant logic (e.g. cross-type numeric comparison).

Strict-typing bulldozer (Phase 2): every variant whose payload depended on the deleted ValueWord (the v1 dynamic-tag word) has been removed from HeapValue, along with the supporting *Data structs. The HeapKind discriminator preserves its ordinal numbering for ABI stability — gone variants now appear only in HeapKind (reserved). Heterogeneous-element collections (HashMap, Set, Deque, PriorityQueue), dynamic single-value wrappers (Some/Ok/Err/Range/TraitObject/ FunctionRef), and dynamic capture/control-flow holders (Iterator, Generator, Concurrency, Rare, Enum, Array, HostClosure, ProjectedRef) are awaiting monomorphized typed replacements per docs/runtime-v2-spec.md.