Open and answer this issue on GitHub.
ready · opened 2026-12-01 · updated 2026-12-01 · 0 comments
Found while clarifying #3011 (async D20). NK2122 refuses a task::ChildHandle only where the value’s own type is one (a_child_handle, check_core_ops.nika:1539, called at check_core_args.nika:391 and check_core_stmt.nika:2273). A handle wrapped in anything else passes, so it can outlive its group.
Probe (checks and runs, should be refused):
fn main() throws {
async {
let h = async(handle) fn { 2 }
let s = SharedMut([h])
print(1)
}
}
SharedMut(Holder { h }) passes the same way.
To build
ChildHandle: through a field, an element, an option, a closure capture or SharedMut..nika test per path in tests/compiler/tests/, each with its .stderr.Done when the probe and the Holder variant are refused with NK2122, and the existing NK2122 tests pass.
Related: “Cycles of handles: the compiler refuses them unless it proves a back edge” (#1626).
Generated by Claude Code