type closure-call results; make lambda returns transfer#275
Merged
Conversation
two ownership-model holes, closed together because fixing the first exposed the second. ordered string comparison inside generic bodies compared pointers: the comparison dispatch reads checked operand types, and generic bodies check with type parameters suppressed, so key(a) < key(b) with a fn(T) -> String key ordered by allocation address. closure-typed parameters now record their declared return kinds (the return type hides inside a "returns" wrapper node), calls through them infer that kind, and unannotated binds from such calls carry it — so the comparison sees strings and calls the runtime. sort_by_key drops its strcmp sidestep for the natural comparison it was written with. the new typing exposed the second hole: lambda returns never honored transfer semantics. a lambda returning a borrowed field handed out an uncounted reference, balanced only by the accident that closure-call results were untracked — once tracked, the caller's release freed a job name out from under parq, and the golden check caught the empty string within minutes. lambda expression returns now retain borrowed strings on the way out, exactly as named function returns do. a regression pins the generic comparison in both bound and inline form; parq's golden diff doubles as the use-after-free regression.
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.
summary
two ownership-model holes, closed together because fixing the first exposed the second:
key(a) < key(b)withfn(T) -> Stringordered by allocation address. fix: closure-typed params record their declared return kinds (unwrapping thereturnsAST node), calls through them infer it, and unannotated binds carry it.sort_by_keydrops itsstrcmpsidestep for the natural<.what was tested
new regression pins the generic comparison (bound + inline); parq's golden diff doubles as the use-after-free regression; leak scan clean on parq; full suite green including all four golden checks; fixed point byte-identical; seed refreshed.