Repository navigation
Conversation
…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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack created with GitHub Stacks CLI • Give Feedback 💬