Open and answer this issue on GitHub.
bug, ready · opened 2026-12-01 · updated 2026-12-01 · 0 comments
A for over io::lines() inside a task’s lambda is not lowered as a stream loop. It reads owned lines, one copy per line. ADR-stream-buffers-v1 D1 says a stream reads into a pool and its items view it; D9 and the rejected options rule out a copy on the stream path.
use std::io
fn main() throws {
async(detached) fn {
for line in io::lines() {
println(line)
}
}
}
nikaia run --tethers probe.nika (stdin a\nb, compiler at d379cde1) prints no view in a signature here, so there is no state to solve. and no main (stream): entry. nikaia lower writes io::lines().await and .next(). The same loop in main’s own body lowers to io::lines().await.in_pool(4) and .next_line() with .parts().
buffers.nika: the stream-loop collection (walked / stream_loops) does not enter a spawned lambda’s body (block_spawns).
buffers.nika also goes into the bodies of spawned lambdas.tests/compiler/tests/: the probe above with .stdin and .stdout, and a --tethers test that names the loop with its pool.The probe lowers to a pooled stream loop (in_pool, next_line), and --tethers names it with its counting step.
Found by the builder of “A stream’s views handed to a task over a bounded channel, counted with the cheapest of four steps” (#2854), run 2.
Generated by Claude Code