Skip to content

d115 impl - #2297

Merged
ehartford merged 1 commit into
mainfrom
d115-impl
Oct 9, 2026
Merged

ehartford merged 1 commit into
mainfrom
d115-impl

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Stack created with GitHub Stacks CLI • Give Feedback 💬

…nership decides how it binds (#2283)

Sema decides per slice pattern whether its subject is owned (a temporary,
a place moved with `move`, a parameter) or observed (a place, a reference,
a slice), records it, and types the bindings: owned elements and a
`[T; N-k]` / `Vec[T]` remainder, or views and a `[]T` rest. MIR reads the
verdict: views plus a range slice; an owned array moves every element out
(unbound ones are discarded and dropped, as `_` is); an owned Vec removes
the tail and head and moves the remainder into `rest`. Slice names now
carry view origins (collect_pattern_binding_syms skipped them).

Fixes two defects found by the debug allocator:
- `let [first, ..] = mk() else ...` bound a view into the temporary Vec,
  dropped before `first.id` was read (WITH_DEBUG_ALLOC_SCRIBBLE read
  0xDEDEDEDE = -555819298); `first` is now owned.
- `match move v: [first, ..]` leaked the Vec (`LEAK origin=Vec`); now
  `debug-alloc: leak count=0`.

A guard after an owned-Vec removal is refused (#2289) until the D115
Amendment 1 offset header lets a failed guard put elements back. The
owned-Vec head is still `remove(0)`; the O(1) remainder comes with that
header change.
@ehartford
ehartford added this pull request to stack #2299 October 9, 2026 09:37
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on the stack top 1339711 (gate 113s, uat 139s, battery-checks 386s). The first run was red on cli-selfhost-project-tests: the runtime_workers case waited for the second fiber worker by a 2,000,000-spin count; reproduced under 18-thread CPU saturation (2 of 20 failed, 0 of 20 idle), fixed with a 30 s now_ns() deadline (0 of 20 under load), assertion unchanged.

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.

1 participant