Skip to content

MIR: a scope's cleanup calls yield their status into an i32 temp; validate-all accepts scope programs (#1411) - #1522

Merged
ehartford merged 1 commit into
mainfrom
fix-1411-scope-cleanup-types
Sep 23, 2026
Merged

ehartford merged 1 commit into
mainfrom
fix-1411-scope-cleanup-types

Conversation

@ehartford

@ehartford ehartford commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

validate-all stopped every thread- and async-scope program (20 corpus files)
at "ownership terminator place has no concrete MIR type". The call was the
scope's own cleanup: emit_drop_entry lowered DK_THREAD_SCOPE to
THREAD_SCOPE_JOIN_ALL + THREAD_SCOPE_DESTROY and DK_ASYNC_SCOPE to
SCOPE_AWAIT_ALL + SCOPE_DESTROY, each with self.new_temp(0) as the call's
destination (MirLower.w:1142/1153/1168/1179 on ba2d5d1). --dump-mir of
spec_ss14_9_scope_no_runtime.w shows it: _8: <inferred>,
call const ()(copy _2) -> [return: _8, next: bb4], and
mir_validate_place_type returns 0 for it in validate_ownership_body.

Codegen yields each of these four intrinsics as an i32 0 (CodegenDispatch,
the with_thread_scope_* / with_scope_* arms), exactly like the task
cancel/detach intrinsics, whose destinations the lowering already typed
i32 (emit_task_cancel_call). The four scope calls now go through that one
helper, renamed emit_handle_call; nothing else about the calls changes.

Not #1305: the async-call-result typing is a separate defect; none of the
20 files reached it.

Matrix (check --validate-all, base stage1 vs this stage1): every scope
program listed in #1411 goes from the error to validate-all: ok —
behav_async_scope{,panic_cancels_siblings,panic_propagates,d_task},
behav_scope
{block_forms,join_vec_join,spawn,spawn_mut_capture},
spec_ss14
{6_async_blocks,7_task_was_cancelled,8_scoped_task_tracking,
9_scope_no_runtime,16_scopedsend,22_task_ephemerality},
spec_ss14_async_await, examples/{async-auction,async-collection-await,channels/pipeline,
ephemerality-and-lowering/*}; the seven spec_ss14 files that were already ok
stay ok.

Fixture: test/phase/validate_all_scope_cleanup_calls.w (a thread scope and
an async scope under --validate-all).

Sweep: check --validate-all over test/, examples/ and lib/std (3188
files), base stage2 (main f1e3bd2) vs this stack's stage2: the 20 files
above, err_async_scope_no_runtime.w and the new fixture go from this error
to ok. The two nebula files it masked (examples/nebula/src/{main,session}.w)
now reach #1412's older finding, a generator resume that drops a str it
never initialized — wrong code at run time, repro added there.

Closes #1411

Stack #1528, bottom to top: #1522 (#1411) → #1523 (#1413) → #1524 (#1429) → #1525 (#1414) → #1526 (#1372) → #1527 (#1417). Each layer holds only its own commit.

Verification (iterate tier; no battery yet — draft until the seed-driven battery is green): stage1 and stage2 built from the stack top on darwin-aarch64 (SDKROOT CLT 15.4) and on native Windows 10 x64; fixtures below pass on both; check --validate-all swept over test/, examples/, lib/std (3188 files) with base stage2 (main f1e3bd2) vs the stack's stage2.

@ehartford

Copy link
Copy Markdown
Contributor Author

Stack #1528 battery (seed-driven, new seed, cold c_import cache, with :drop-audit/:move-audit) on main + #1522 → … → #1527 (head 33e6ba5; every PR head is a tested commit): build ok, :fixpoint ok, :drop-audit ok, :move-audit ok, :test ok (no reds), :test-green ok, :last-green ok. Merges cleanly into main. Merge the stack: gh stack merge 1527 --squash.

@ehartford
ehartford marked this pull request as ready for review September 23, 2026 16:45
…idate-all accepts scope programs (#1411)

validate-all stopped every thread- and async-scope program (20 corpus files)
at "ownership terminator place has no concrete MIR type". The call was the
scope's own cleanup: emit_drop_entry lowered DK_THREAD_SCOPE to
THREAD_SCOPE_JOIN_ALL + THREAD_SCOPE_DESTROY and DK_ASYNC_SCOPE to
SCOPE_AWAIT_ALL + SCOPE_DESTROY, each with `self.new_temp(0)` as the call's
destination (MirLower.w:1142/1153/1168/1179 on ba2d5d1). --dump-mir of
spec_ss14_9_scope_no_runtime.w shows it: `_8: <inferred>`,
`call const ()(copy _2) -> [return: _8, next: bb4]`, and
mir_validate_place_type returns 0 for it in validate_ownership_body.

Codegen yields each of these four intrinsics as an i32 0 (CodegenDispatch,
the with_thread_scope_* / with_scope_* arms), exactly like the task
cancel/detach intrinsics, whose destinations the lowering already typed
i32 (emit_task_cancel_call). The four scope calls now go through that one
helper, renamed emit_handle_call; nothing else about the calls changes.

Not #1305: the async-call-result typing is a separate defect; none of the
20 files reached it.

Matrix (check --validate-all, base stage1 vs this stage1): every scope
program listed in #1411 goes from the error to `validate-all: ok` —
behav_async_scope{,_panic_cancels_siblings,_panic_propagates,d_task},
behav_scope_{block_forms,join_vec_join,spawn,spawn_mut_capture},
spec_ss14_{6_async_blocks,7_task_was_cancelled,8_scoped_task_tracking,
9_scope_no_runtime,16_scopedsend,22_task_ephemerality},
spec_ss14_async_await, examples/{async-auction,async-collection-await,channels/pipeline,
ephemerality-and-lowering/*}; the seven spec_ss14 files that were already ok
stay ok.

Fixture: test/phase/validate_all_scope_cleanup_calls.w (a thread scope and
an async scope under --validate-all).

Sweep: `check --validate-all` over test/, examples/ and lib/std (3188
files), base stage2 (main f1e3bd2) vs this stack's stage2: the 20 files
above, err_async_scope_no_runtime.w and the new fixture go from this error
to ok. The two nebula files it masked (examples/nebula/src/{main,session}.w)
now reach #1412's older finding, a generator resume that drops a str it
never initialized — wrong code at run time, repro added there.
@ehartford
ehartford force-pushed the fix-1411-scope-cleanup-types branch from 9089c9e to 66d9860 Compare September 23, 2026 19:40
@ehartford
ehartford removed this pull request from stack #1528 September 23, 2026 19:43
@ehartford
ehartford added this pull request to stack #1563 September 23, 2026 19:43
@ehartford
ehartford merged commit df3861d into main Sep 23, 2026
@ehartford
ehartford deleted the fix-1411-scope-cleanup-types branch September 24, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validate-ownership: async/scope programs fail with "ownership terminator place has no concrete MIR type"

1 participant