Repository navigation
One C function, two constructors: a producer's second presentation is a producer, and a parentless value of a parented type is free (D214, part of #3122) - #3589
Merged
Conversation
added 3 commits
November 24, 2026 05:51
This was referenced Nov 24, 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.
Part of #3122, which stays open for the version floor, the
rename withwording and the blessing of the §16.2b.11 words.Now writable (the rest of D214's ruling):
Two changes.
Facade. Two presentations of one function already existed (ruling Amendment 3: each later item gets its own declaration linked to the same C symbol). A producer's second presentation was treated as an operation on the parent. The resource that names the function in
fromnow gets the same clause for the presentation's declaration, so every rule that reads a resource's producers reads both.Checker. With one parented constructor the type is
ephemeral { parent: Option[&Easy], … }, andMime.new().unwrap()was refused as "a view into a temporaryOption[Mime]". The rule at fault treated the result of any builtin method as a view of its receiver when the result had no origins of its own.unwrapconsumes its receiver (the compiler's own receiver-mode table says so) and hands back a value: it carries what the carrier carried and views nothing of the carrier, which is gone. That is now what is recorded, for a by-value receiver and a by-value result of a consuming builtin only; a reference result, a borrowed receiver, and a non-consuming method keep the old rule.Tests.
behav_d214_both_constructors: both constructors; the parentless value returned from a function.err_d214_parented_value_outlives_parent: the parented value still cannot outlive its parent.Evidence at beea3c8.
:native-compile-error-tests,:behavior-tests,:validate-all-tests, pre-checks green; battery green; linux-aarch64 container leg green (:build,:behavior-tests,:native-compile-error-tests);:release-checkssurvey: all targets green.