Open and answer this issue on GitHub.
bug, ready · opened 2026-11-29 · updated 2026-11-29 · 0 comments
use std::io
use std::text
struct Bad {}
impl Error for Bad { fn message(ref self) -> String { return "bad" } }
fn quick(x: i64) -> i64 throws { if x > 2 { throw Bad {} }; return x }
fn main() throws {
let v: Vec[i64] = io::lines().map(fn(l) { quick(text::parse_i64(l) ?? 0) }).collect() catch { [] }
println(f"{v.len()}")
}
Run with stdin 1\n2\n3\n, it gives NK1343: rustc expected List<i64> and found List<Result<i64, Thrown<Bad>>>. It fails the same way on 9f01bae8 and on 56f8c93f.
It prints 0 from the catch, as a failing map over a list does (ADR-loop-failure-v1 D1).
emit_call_failing_through (emit_core_calls.nika) hands the lambda’s Result to a collect that does not gather a Result when a stream’s item fails. The fused loop of emit_stream_chain declines failing lambdas.
map (and filter, then) over io::lines() fails the chain, and the surrounding catch or throws gets the failure (ADR-loop-failure-v1 D1).emit_stream_chain (ADR-chain-loop-v1 D6), where it fits.tests/compiler/tests/ with its .stdin and .stdout.The probe prints 0, and a version where no line fails prints the list’s length.
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).