Issue #2932: Chains over io::lines() pushed into one list from two push sites do not compile (NK1343), while the list literal does

Open and answer this issue on GitHub.

bug, ready · opened 2026-11-29 · updated 2026-11-29 · 0 comments

Probe

use std::io
fn main() throws {
    let mut ss = []
    ss.push(io::lines().take(1))
    ss.push(io::lines().skip(1))
    for s in ss.drain() { println(f"{s.count()}") }
}

On c2554dfb this gives NK1343 (rustc: mismatched types).

Expected

It prints each chain’s count, as the list literal [io::lines().take(1), io::lines().skip(1)] already does (ADR-chain-loop-v1 D7: chains joined by the elements of one list are an enum of their states).

Traced

emit_stream_kept (emit_core_calls.nika) writes each push site’s state as its own struct. emit_stream_variants only sees the elements of one ListLit.

To build

  1. Before writing the first push, the emitter knows every chain pushed into one list, from its literal and from every push, and writes one enum of their states.
  2. The probe becomes a test with its .stdin and .stdout.

Done when

The probe prints both counts.

Found during “A chain over io::lines() is one loop the compiler writes, a kept chain a state it writes, and the view steps leave Rust (ADR-chain-loop-v1 D6, D7)” (#2899).

Back to Open Issues