Issue #2992: A chain whose step pauses over a list, ended by fold, sum, any, all or find, fails in rustc (NK1343)

Open and answer this issue on GitHub.

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

A chain whose step pauses over a list, ended by fold, sum, any, all or find, passes the checker and fails in rustc. Found by run 9 of “Chains over lists, maps and std’s other producers are one loop the compiler writes, and seq.rs leaves Rust” (#2927). It fails the same way at fedd08f6.

Probe:

use std::time

fn p(x: i64) -> i64 {
    time::sleep(0.millis())
    return x * 2
}

fn pp(x: i64) -> bool {
    time::sleep(0.millis())
    return x % 2 == 0
}

fn main() throws {
    let xs: Vec[i64] = [1, 2, 3, 4, 5, 6]
    let s = xs.iter().map(fn(x) { p(x) }).fold(0, fn(acc, x) { acc + x })
    println(f"{s}")
}
error[NK1343]: ... the method `fold` exists for struct `__NikaiaChain<..>`, but its trait bounds were not satisfied

Expected: 42.

Cause, traced: emit_stream_chain (emit_core_calls.nika) takes a plain pausing chain only for count, collect, join and nth. The state that emit_kept_walk falls back to has none of these ends.

To build


Generated by Claude Code

Back to Open Issues