Skip to content

Closure soundness campaign: §12.4 capture-set completeness and escape classification (one root cause for #1566 #1567 #1570 #1594 #1598 #1605 #1638 #1603) #1698

Closed

Description

@ehartford

Ruling (Eric, 2026-09-25): every open issue is closed out before Phase 3 STC stdlib sourcing starts; this campaign runs first because these are memory-safety holes in ordinary application code.

One root cause, eight symptoms. §12.4 says a closure captures by place; the implementation (a) misses whole syntactic forms when collecting the capture set and (b) has no escape classification, so a closure that is stored, returned, or sent to another thread keeps pointers into the frame that created it.

Capture-set completeness:

Escape classification (stored / returned / sent closures):

Call through a callable reference:

Plan: one Sema owner for the capture set (D65: Sema decides capture semantics), fed by a single walker over every expression form; escape = a closure value that flows anywhere but a non-escaping call argument requires move or a diagnosis (spec §12.1–§12.3); MIR materializes the environment per Sema's verdict. Ownership/drop change: alone in its battery with :drop-audit and :move-audit. Each symptom gets a behavior test and, where a diagnosis is the answer, a compile_errors test; the eight issues close when the campaign lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions