Open and answer this issue on GitHub.
bug, ready · opened 2026-11-30 · updated 2026-11-30 · 0 comments
An eager map over a list, whose lambda holds a pausing chain over the same list, fails in rustc with a borrow of a moved value. 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 ys = xs.map(fn(x) { xs.iter().filter(fn(y) { pp(y + x) }).count() })
println(f"{ys.len()}")
}
error[NK1343]: ... borrow of moved value: `xs` (in __nikaia_map_list)
Expected: 6.
Suspected cause: the call that emit_call_eager_entry writes moves the receiver list into __nikaia_map_list while its lambda still reads it.
To build
Generated by Claude Code