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.
.sum() fails the same way..any(fn(x) { x > 4 }) and .find(fn(x) { x > 4 }) fail with “no method named any/find found for struct __NikaiaChain<G0, F1, U1>”. all likewise.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
fold and sum become accumulators in the loop, and any, all and find become early ends. The same ends go on the paused state’s consumers.Generated by Claude Code