immutable binding of its function without a copy, a count or NK2101 (ADR-389 D3)Open and answer this issue on GitHub.
ready · opened 2026-11-21 · updated 2026-11-21 · 0 comments
Part of #1199
ADR-389 D3: a task may read an immutable binding of the function that starts it, by capture or as an argument, with no copy and no owner count; nothing can change it, and the compiler keeps it alive until the last task that reads it has ended (Part I 8.3). It never meets NK2101. The binding inside a function and its deep rule are built (3f8dd4c9); this part is the tasks rule. A search finds the binding’s mark (deep in check_core_stmt_let, CheckKind::Immutable) only in check_core_stmt.nika, check_reports.nika and check_takes.nika, none of them the task checks that give NK2101 (check_lambdas.nika and others); the builder confirms with the probe below.
immutable capture or argument of a task gets no copy, no count and no NK2101 (D3).
tests/compiler/tests/: the probe of #1199 (immutable limits = [1, 2, 3] captured by async fn { print(f"{limits.len()}") }, the task awaited) prints 3, with its .stdout.A task that captures or takes an immutable binding of its function compiles without NK2101 and reads the binding without a copy; the report gives a Found: line per finding.
Split from #1199 by Claude Code