Skip to content

Wave 2a: D34-A demand-site builder finalization (#920), #3483 std moves (SlotMap/ListSlot/ListRange/ListIterPlace), generic method bounds & HashMapEntry leak fix - #3672

Merged
ehartford merged 7 commits into
mainfrom
wave2
Nov 28, 2026

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Summary

Bundled Wave 2a fixes and features (5 commits, verified locally on :dev and --debug-alloc, seed-driven battery running):

  1. Test runner multi-error verification & Sema diagnostic fix (31f1225d7):
    • TestDirectives.expect_check_fail in src/main.with now stores List[str] and verifies every //! expect-error: / //! expect-check-fail: line instead of silently overwriting with the last one.
    • Fixed stray literal newline in src/Sema.with c_char literal diagnostic and updated 8 stale first-line expectations in test/compile_errors/.
  2. Generic method/impl trait bounds + SlotMap/SlotMapSlot moved to std.collections (Built-in methods get real bodies and declared signatures in the standard library (D110); delete the freeze door and the method-value adapter #3483) (642aa3343):
    • check_generic_method_call in src/SemaCheck.with now enforces check_generic_trait_bounds for impl[T: Bound] type parameters, method type parameters, and where clauses.
    • Moved SlotMap.slot, SlotMap.get_disjoint, SlotMapSlot.get, and SlotMapSlot.set into lib/std/collections.with and deleted the corresponding compiler intrinsics and BuiltinSigs rows.
  3. D34-A demand-site builder finalization via Finalize[T] (D257, closes D34-A: demand-site finalization — a Builder satisfies an owned demand for its built type; grander wrapper-elimination design goes to Eric #920) (bcb2e6299):
    • Added pub trait Finalize[T]: move fn finalize() -> T in lib/std/traits.with and impl Finalize[str] for StringBuilder in lib/std/string.with.
    • Wired Law 2 Phase 2 demand-site finalization in src/SemaCheck.with and src/MirLower.with (owned concrete demands only, no chaining with Option wrapping, retains Copy builders like StringBuilder and moves non-Copy builders).
    • Recorded delegated decision D257 in docs/meetings/2026-11-28-D257-demand-site-builder-finalization.md with Law citations and verbatim Test answers.
    • Added behavior, --debug-alloc, and compile-error tests (behav_920_*, da_920_*, err_920_*).
  4. ListSlot, ListRange, ListIterPlace moved to std.collections + SlotMapSlot.get copy glue fix (Built-in methods get real bodies and declared signatures in the standard library (D110); delete the freeze door and the method-value adapter #3483) (10db912aa):
    • Declared pub type ListRange[T] ephemeral and moved ListSlot.get/set, ListRange.get/set/len/len32/len64/ulen32/is_empty/split_at/split_at_mut, and ListIterPlace.next into lib/std/collections.with (removing ~398 lines of hardcoded intrinsic code and 5 BuiltinSigs rows).
    • Fixed SlotMapSlot.get (and ListSlot.get / ListRange.get) to copy out T: Copy through &T (let v: &T = unsafe { &*slot }; *v) so copy glue retains refcounted str / List fields instead of bitwise reading.
  5. HashMapEntry key-drop leak fix & generic-struct field Sema lookup:
    • MAP_ENTRY in src/CodegenDispatch.with now uses mir_dest_llvm_type (the registered %HashMapEntry__... struct type) instead of an anonymous struct, so mir_emit_drop_fields_ptr finds the struct and drops HashMapEntry.key at scope exit (behav_slot_get_copy_glue.with drops from 2 leaks to 0 leaks under --debug-alloc).
    • mir_emit_drop_fields_ptr and mir_emit_struct_copy_glue_fields resolve instantiated field Sema types by declaration index (type_reflection_field_type_frozen) before falling back to symbol-based projection.
    • Added test/debug_alloc/da_slot_range_copy_glue.with covering ListSlot, ListRange, SlotMapSlot, and HashMapEntry with Courier { name: str, n: i32 }.

Closes #920
Part of #3483

@ehartford

Copy link
Copy Markdown
Contributor Author

Seed-driven battery green at d79e327c6:

battery: d79e327c6 in /Users/eric/.local/with-staging/mg
battery rc=0 wall=1573s
battery: GREEN (d79e327c6); logs in out/battery/
out/battery/battery.log: rc=0 green

Marking ready and merging.

@ehartford
ehartford marked this pull request as ready for review November 28, 2026 12:26
@ehartford
ehartford merged commit 5e173e3 into main Nov 28, 2026
1 check passed
@ehartford
ehartford deleted the wave2 branch November 28, 2026 12:26
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.

D34-A: demand-site finalization — a Builder satisfies an owned demand for its built type; grander wrapper-elimination design goes to Eric

1 participant