Repository navigation
D30: runtime definitions inherit their extern's declared contract; runtime libc blocks are not program facades - #2482
Merged
Merged
Conversation
added 3 commits
October 19, 2026 23:48
… extern it replaces std.thread declares `@[effect(fn_ptr: escape_value, ctx: escape_value)] extern fn with_thread_spawn`: the thread keeps the closure. Under WITH_RT_IN_UNIT the runtime's definition won and the extern was dropped with its pins, and the definition's own inference cannot see retention through a raw pointer (a pointer parameter's inferred effects are read-only by design), so a closure holding a view of its frame was spawned unrefused (err_thread_spawn_closure_captures_ref, red under the lane). The frontend keeps a dropped pinned extern for its runtime definition (Zcu.note_runtime_contract_extern, in the prelude tier where std's externs drop and in the program tiers); Sema applies its pins to the definition's signature as an extern's, and they survive that body's inference. One fact in one place: no seed-compiled source changes, so #2481's seed-gated rule for pins on runtime definitions is removed unused.
Two places treated the in-unit runtime's `c facade libc` blocks as the program's: inject_toolchain_facades counted them as claims, so the toolchain libc facade's text lost `domain environ` while its getenv row still named it, and every program using getenv failed under WITH_RT_IN_UNIT (61 lane files, after #2481's domain rule made the omission visible); and the domain rule judged a facade block by current_module_path, which names whatever module was checked last when facade items are collected. Claims skip `<embedded-rt>/` facades, and a block is the runtime's by its own declaration's path.
ehartford
added a commit
that referenced
this pull request
Oct 20, 2026
… seed nightly-20261020-local-1-e1d2b25e6d04 (#2492) * D30 step 2 (part 2): the runtime definitions declare their own contracts; seed nightly-20261020-local-1-e1d2b25e6d04 The @[effect] pins move from lib/std's and src/'s externs onto the rt/ definitions — with_thread_spawn (fn_ptr, ctx: escape_value), with_vec_push_str (val: escape_value), with_vec_append_bytes (v: write) — and #2482's extern-inheritance (Zcu.note_runtime_contract_extern, Sema.runtime_contract_externs) goes: one fact in one place, the definition, which is what the runtime bundle's interface carries. A runtime ABI definition's pin is applied at declaration, as an extern's pin is, and kept through the body's inference: applied only after the body check it was too late — std.thread's spawn_os is checked before the runtime's body, and read `worker` as consume alone, so the lane twin of err_thread_spawn_closure_captures_ref stayed green by accident of the inherited extern and red without it. Under the lane spawn_os.worker now reads escape_value exactly as in the object world. tools/rt_decl_audit.w compares @[effect] pins beside parameter types: on the tree before this commit it reports the five pinned externs against their unpinned definitions (the gate on deleting the externs, plan §10 correction 3); here 0 divergent over 1216 definitions. seed.lock: nightly-20261020-local-1-e1d2b25e6d04, the first seeds whose Sema accepts the pins on rt/ (the seed compiles rt/ for stage1): darwin cut on the laptop (fixpoint over 16 units, :release-checks green), linux-x86_64 on eric-5090, windows-x86_64 on win10 (fixpoints). linux-aarch64 is held on the 10-15 release (#2490: its seed cannot bootstrap main) and windows-aarch64 until the dispatched cross seed is pinned (D137). Workflow pins moved with tools/bump_seed_pins.w. * D30 plan §10: step 2 landed; handoff: the darwin host is the laptop (studio128 is gone, Eric 2026-10-20) --------- Co-authored-by: Eric Hartford <[email protected]>
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.
D30: the last lane red closed without a seed cut, plus a lane regression #2481 introduced.
@[effect(fn_ptr: escape_value, ctx: escape_value)] extern fn with_thread_spawnnow reaches the runtime's definition (frontend keeps the dropped pinned extern; Sema applies its pins as declared and they survive the body's inference). One fact in one place, no seed-compiled source changed, so D30: spec/internals/compile_errors under the lane; facade domains, comptime and declared runtime pins #2481's seed-gated pin rule is removed. Fixture:err_d30_rt_in_unit_spawn_captures_ref.domain environ(61 lane files fail on main since D30: spec/internals/compile_errors under the lane; facade domains, comptime and declared runtime pins #2481). A facade block is judged by its own declaration's path. Fixture:behav_d30_rt_in_unit_toolchain_libc_facade.Under the lane, all fresh: behavior (non-spawning) 1701/1701, compile_errors 1790/1790, spec + internals 282/282.
Battery GREEN on 288a2bd (
with run tools/battery.w, rc=0, 248 s).