Repository navigation
Modeled C: callback contracts on free functions (#1644) - #1672
Merged
Merged
Conversation
This was referenced Sep 25, 2026
Closed
ehartford
force-pushed
the
modeled-c-completion
branch
from
September 25, 2026 15:00
d16adce to
44cbc6c
Compare
Share callback rendering, userdata-first contextual typing, nullable pair validation, and thread/effect checks between free and receiver calls. Typed callable userdata permits a collecting callback to mutate a captured Vec without granting mutation through a shared Vec reference. Root-cause proof: LLDB stopped in Sema.verify_facade_callback_items after facade_method_host returned x0=0; its length comparison at +668 branched from +672 to the no-resource diagnostic at +940 (SemaFacade.w:3641). The contract was rejected solely because presentation had no receiver. Validation: pinned-seed :dev, compiler source check, free callback runtime regression, existing scope/nullable method regressions, thread/pair/call-once negative probes, audit:all (643344 facts, 0 violations). Void free bridges have explicit Unit returns, as required by the public-function validator. Element buffers and the tally integration follow in the next stack layer.
ehartford
force-pushed
the
modeled-c-completion
branch
from
September 25, 2026 17:34
44cbc6c to
b1a1cf0
Compare
ehartford
marked this pull request as ready for review
September 25, 2026 17:35
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.
A valid
callback param N userdata param Mcontract was rejected when the C function had no modeled receiver. Free functions now render safe generic bridges and share methods' contextual callback typing, nullable-pair validation, and thread/effect checks.Regressions cover both C parameter orders, renamed functions, void returns, nullable callbacks, and mutable collection through a capturing callable borrowed as userdata. Negative cases retain pairing, Send/Sync, and call-once checks. LLDB located the original rejection in
Sema.verify_facade_callback_items; the commit records the evidence.Validation of this PR plus #1675, at exact head
590aa2be, with the pinned seed::test,:test-green, and:last-greenpassed, including 1,282 behavior files and 20 example steps.:user-programs-safepassed.Rebased cleanly onto main
c5aaf76f: this PR is nowb1a1cf0d, and #1675 is78edfb7a. The combined stable patch ID is unchanged (9bfe49f5d021fa84ec5606b207841e33cd94fef4). Per the handoff's rebase rule, the recorded battery applies to the unchanged patches; an integrated main battery remains required before installation.This lower stack is being validated independently of unfinished #1652. Refs #1644; #1675 completes the tally migration.