Tagged Built-in Callable Identity
Routed Finding
Hygiene design route: hr-3f982596bd15b2c4
- Rule: DESIGN-30 (identity metadata over a parallel mechanism).
- Severity: Major.
- Evidence: LLVM ARC emission recognizes built-in compound methods through the
declare_builtins!name/type dispatch mechanism inbuiltins/compound_traits.rs, while ordinary and derived user methods travel through realized callable identities and ABI records. The special path exists to present built-ins uniformly to callers but gives them a backend-local mechanism instead of shared identity metadata. - Why this is not LEAK duplication: the core defect is not repeated code text; it is a separate syntactic/ABI dispatch basin for built-ins that should differ from ordinary declarations only by stable identity.
- No within-budget cure: deleting one LLVM table is unsafe until realization closes built-ins into the shared artifact, evaluator and VM consume the same identity, runtime descriptors are explicit, and all backend-local fallbacks fail closed.
Goal
Represent built-in methods as tagged members of the ordinary closed callable inventory so executor selection never changes how a callable is discovered or identified.
Required Design
- Define backend-neutral built-in/lang-item identity metadata in the shared registry or executable callable record.
- Realize built-in methods into
ExecutableProgramwith the same stable function identity, typed signature, ownership contract, and call-target closure used by user declarations. - Project a tagged callable to evaluator, VM, LLVM, and native implementations without name-prefix or receiver-spelling discovery.
- Delete
declare_builtins!routing and equivalent backend-local method tables once all entries are represented by the shared identity path. - Reject a missing, duplicate, stale, or executor-only built-in identity during executable-program validation; no silent fallback or semantic synthesis is permitted.
Verification
- Property tests prove built-in and user callable records share representation and calling-convention invariants.
- Inventory tests cover compound traits, Option/Result helpers, iterators, debug/printable methods, derives, and bodyless runtime operations.
- Negative tests reject name-only discovery, missing descriptors, duplicate identities, and backend-local synthesis.
- Evaluator/VM/LLVM debug/release/AOT parity and leak accounting remain exact.
Closeout
This section closes only after its owned criterion is satisfied, code-side TPR is clean, and a source-fingerprint-current canonical test-all run is full green.
Work Items
- Replace LLVM-only built-in method routing with tagged ordinary callable identities in the shared executable program