Open and answer this issue on GitHub.
bug, ready · opened 2026-11-30 · updated 2026-11-30 · 0 comments
Two chains over a list that do not pause, joined by if, fail in rustc. ADR-chain-loop-v1 D7 says they should be an enum of their states. Found by run 10 of “Chains over lists, maps and std’s other producers are one loop the compiler writes, and seq.rs leaves Rust” (#2927). It fails at 3a7160c1 and at 91fcef53.
Probe:
fn main() throws {
let xs: Vec[i64] = [1, 2, 3, 4, 5, 6]
let k = if xs.len() > 3 { xs.iter().map(fn(x) { x * 2 }) } else { xs.iter().map(fn(x) { x + 1 }) }
println(f"{k.count()}")
}
Expected: 6.
Suspected cause: the enum of the two chains’ states (__NikaiaOneOf) is written only for chains over a stream or chains that pause. The pausing form is “Two pausing chains joined by if fail in rustc (NK1343): no enum of their states (ADR-chain-loop-v1 D7)” (#2994); the two could be fixed together.
To build
if/match become a __NikaiaOneOf of their states, with the consumers.if and match, two different steps, and a step on the joined value.Generated by Claude Code