Repository navigation
Ownership: validate-ownership sees leaks (Reset state); drop exactly once for skipped for-patterns, comprehension Err carriers, generator locals, and &T fields of Drop types (#1384 #1488 #1490 #1504 #1548 #1492) - #1718
Merged
Conversation
added 2 commits
September 26, 2026 03:48
…nd an owned local still Init at a return is a leak (#1384, #1488) The blank `x = const zst(T)` re-initialized a place in the drop-state domain, so every moved-out local read as Init at its return and no leak could be seen; and nothing looked at returns at all. Reset — blanked after a move or drop, owning nothing — joins as a guarded drop beside Init, as MaybeMoved beside a move, as garbage beside untouched memory; a move of it is a use after move. At every return, a local some `drop` targets (owned storage the lowering scheduled a drop for) that is still Init with no sub-place moved or blanked is refused as a leak; a generator's next body, whose locals live in its state across a yield, is exempt. The compiler tree validates clean; the #1490/#1504/#1548 repros are caught or fixed.
…on's Err carrier, a generator's locals at exhaustion, and a &Db field (#1490, #1504, #1548, #1492) - #1490: a refutable `for PATTERN in …` over consuming iteration skipped elements without dropping them; the skip edge now drops an owned element (bind_for_element_or_skip mirrors the comprehension path; the two payload-binding callers own their item). - #1504: the for-comprehension desugars its fail arm to `___fail @ _`; the @-binding moved the carrier into the outer local and the wildcard under it moved the same subject into a discard temp (A7) — two owners. The outer binding owns the value; a wildcard inner pattern binds and discards nothing. - #1548: lower_generator_next_body restores state fields into locals and, at exhaustion, the source body's scope exit dropped them while the state kept the same bytes for its own drop glue. The exhaustion rewrite blanks the state fields to the reset sentinel after those drops. - #1492: get_type_name names a reference's pointee, so type_has_drop_impl called `&Db` Drop and a `mut self` receiver's `&Db` field was moved and blanked (a null parent on the next read). A reference or raw pointer never has a Drop impl. Each pinned under --debug-alloc (leak count=0) and --validate-all.
Contributor
Author
|
Seed-driven battery on 13550c6: build, :fixpoint, :drop-audit, :move-audit green; :test rc=1 on two internals fixtures (mir_vacated_payload_drop_test, mir_move_of_moved_place_test): they initialize a fresh local with the zero-sized blank, which the new Reset transfer read as a reset. Fix in progress (a blank into untouched memory initializes; Reset joins with Init as Init). Stays draft. |
…ve one; the validator's fixtures initialize with a value, not the reset blank Reset joined with Init as Maybe, so a payload moved out and reset on one arm read as vacated when the enum was dropped at the join, and a local reset on one arm and live on the other was refused a move there. The blank frees nothing on its path: the join drops and moves as the live path does. mir_vacated_payload_drop_test and mir_move_of_moved_place_test built their fixtures' initial value from the zero-sized blank, which is the reset sentinel, not a value (every lowering site blanks a place it has moved from, some after its StorageDead); they now initialize with an empty aggregate. The tree's own validate-all stays clean.
Contributor
Author
|
Seed-driven battery green on 94b9f12 (alone, with :drop-audit and :move-audit; host darwin-aarch64, seed per seed.lock): |
ehartford
marked this pull request as ready for review
September 26, 2026 09:43
This was referenced Sep 26, 2026
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.
Ownership/drop-scheduling change — alone in its battery with
:drop-auditand:move-audit. Draft until posted.Resetstate (owns nothing; guarded drop; a move of it is use-after-move) and an owned local stillInitat a return is refused as a leak (validate-ownership is blind to leaks: an owned local still Init at a return passes validate-all (#1365 leak was 'ok') #1384, validate-ownership has no leak check: a compiler temporary still Init at return passes #1488). The compiler tree validates clean; generator next bodies are exempt.forpattern drops the elements it skips.___fail @ _arm hands the Err carrier over once.&Pfield of amut selfreceiver is moved and blanked whenP: Drop— readingself.dbinto a child nulls the receiver's field (segfault) #1492&Dbis never Drop; amut selfreceiver's reference field is copied, not moved and blanked.