Open and answer this issue on GitHub.
bug, ready · opened 2026-11-29 · updated 2026-11-29 · 0 comments
use std::io
fn main() throws {
let xs = [1, 2, 3]
for (l, x) in io::lines().zip(xs.iter()) { println(f"{l} {x}") }
}
On 9f01bae8 this gives NK2701: “A for over a sequence of (String, ?) gives one value at a time, but you’re binding 2”.
It prints each input line next to 1, 2 and 3 (Seq::zip, Part II).
The item’s second type is ?. The likely place is the checker’s typing of zip when the receiver is a stream.
zip on a stream receiver types its item as (String, T), with T taken from the argument’s item type.for over it is one loop (ADR-chain-loop-v1 D6).tests/compiler/tests/ with its .stdin and .stdout.The probe prints its three pairs.
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).