Repository navigation
Conversation
Decided 2026-10-07: persistent outlives the process, so it may not hold a pointer, span, string or other reference into process memory. A @Lifetime(persistent) static whose declared type is not TransportSafe (#1340) is rejected, naming the field or element type that carries the reference: persistent static 'held' must hold a TransportSafe value, but its type is `ptr<i32>`, which refers to process memory and does not survive a restart flowc_type_transport_blocker in type_id.flow follows the existing TransportSafe walk and returns the innermost offending field or type. Checking the declaration covers every store into the static. domain_application_escape_persistent becomes domain_persistent_pointer_static (its ptr static is now rejected at the declaration); domain_persistent_string_array is new. The language test stores and reads back persistent i64 and [i32; 2] statics.
Fixed point at gen2; bootstrap_from_c.sh --verify passes.
godofecht
merged commit Oct 7, 2026
82bf008
into
cursor/request-persistent-domains-11ad
7 checks passed
godofecht
added a commit
that referenced
this pull request
Oct 7, 2026
Decided 2026-10-07: persistent outlives the process, so it may not hold a pointer, span, string or other reference into process memory. A @Lifetime(persistent) static whose declared type is not TransportSafe (#1340) is rejected, naming the field or element type that carries the reference. flowc_type_transport_blocker in type_id.flow follows the existing TransportSafe walk and returns the innermost offending field or type. Checking the declaration covers every store into the static. domain_application_escape_persistent becomes domain_persistent_pointer_static; domain_persistent_string_array is new. The language test stores and reads back persistent i64 and [i32; 2] statics. From PR #1437, which was merged into the #1369 branch.
godofecht
added a commit
that referenced
this pull request
Oct 7, 2026
Decided 2026-10-07: persistent outlives the process, so it may not hold a pointer, span, string or other reference into process memory. A @Lifetime(persistent) static whose declared type is not TransportSafe (#1340) is rejected, naming the field or element type that carries the reference. flowc_type_transport_blocker in type_id.flow follows the existing TransportSafe walk and returns the innermost offending field or type. Checking the declaration covers every store into the static. domain_application_escape_persistent becomes domain_persistent_pointer_static; domain_persistent_string_array is new. The language test stores and reads back persistent i64 and [i32; 2] statics. From PR #1437, which was merged into the #1369 branch.
Contributor
Author
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.
Fixes #1421. Stacked on #1369 (base branch
cursor/request-persistent-domains-11ad); merge #1369 first, then rebase this onto main and regenerate the bootstrap.Decision implemented
From the owner's decision on #1421 (2026-10-07): a value stored in
persistentmust be TransportSafe (the trait from #1340). The checker rejects a non-TransportSafe value stored into a persistent location, naming the field or element that carries the reference. Values read back keep their type.Change
compiler/src/type_id.flow:flowc_type_transport_blockerfollows the existing TransportSafe walk and returns the innermost offending struct field or type node (-1 when safe).compiler/src/sem_check.flow: a@lifetime(persistent)static whose declared type is not TransportSafe is an error. Checking the declaration covers every store into it.Fixtures:
domain_application_escape_persistentbecomesdomain_persistent_pointer_static(itsptrstatic is now rejected at the declaration, before the LD1 escape);domain_persistent_string_arrayis new.tests/lang/test_lifetime_request_persistent.flowstores and reads back persistenti64and[i32; 2]statics.compiler/scripts/roundtrip.flowandgate_lib.flow: sem_check's separate-compilation deps gaintype_id.Docs: lifetime-request-persistent.md, lifetime-domains.md, and the follow-up line in docs/project/Questions.md.
Module statics today can only be primitives, fixed arrays of primitives, strings or pointers, so the struct-field path of the diagnostic has no reachable fixture yet; it is there for when struct statics land.
Proof
Both fixtures fail with the #1369 compiler (
FAIL domain_persistent_pointer_static,FAIL domain_persistent_string_array) and pass here.Gates (on the #1369 branch)
flowc selftest PASS;
--regenfixed point;--verifyPASS; typecheck_rules 146/0; parity_typecheck clean; test-lang pass; self_host_full ALL PASS; roundtrip ALL PASS (after the deps fix); doc_links clean.