Repository navigation
Consuming same-type pointer producer with null status returns Result[R, E] carrying R in good state (D241) - #3641
Merged
Merged
Conversation
…R, E] carrying R in good state (D241, closes #3121)
Contributor
Author
|
Battery and
|
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.
Implements #3121 (D241, delegated under D237/D98 from D235's ruling; spec v7.97).
src/Ast.with,src/Parser.with): addednull status <status_value>fnclause (FacadeStatusClause.NullStatus), acceptingTokenKind.TK_KW_NULLat clause head and reusingparse_facade_status().src/Sema.with,src/SemaFacade.with): allowsconsumes param Non a direct-return pointer producer of its own resourceRwhennull status CONSTis stated; refuses omittingnull status(the facade never invents a status), refuses consuming same-type producers on dependent resources (ephemeral values cannot live in errors), refuses straynull statuson non-consuming / non-producer functions, and skips the consumed same-type parameter infacade_producer_parents.src/compiler/FacadeRender.with): rendersmove fn <name>(...) -> Result[R, E](and its consuming imported-name forwarder) returningErr(E.FailedWithResource(CONST, R { repr: prev, live: true }))onNULL—Ritself in a good state withself.live = falsebefore the C call soDropruns exactly once on both paths. Supports both<R>Errorand shared facade error types (FailedWith<R>).docs/spec/016_ffi.md§16.2b.4,docs/spec/031_contract-language.md§31.5 & §31.8.3,docs/spec/README.md(v7.97),docs/meetings/2026-11-26-D241-consuming-same-type-pointer-producer.md,docs/meetings/README.md.test/behavior/behav_3121_consumes_same_producer.with(real C slist fixture verifying append, OOMNULLreturning original list intact in good state, subsequent append on recovered list, and zero leaks),test/behavior/behav_3121_libcurl_slist_new.with(realcurl_slist_appendwithparam 0 fixed null),test/compile_errors/err_3121_consumes_same_producer_no_null_status.with, andtest/compile_errors/err_3121_null_status_stray.with.closes #3121