Issue #2994: Two pausing chains joined by if fail in rustc (NK1343): no enum of their states (ADR-chain-loop-v1 D7)

Open and answer this issue on GitHub.

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

Two pausing chains joined by if fail in rustc. ADR-chain-loop-v1 D7 says they should be an enum of their states. 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 k = if xs.len() > 3 { xs.iter().map(fn(x) { p(x) }) } else { xs.iter().filter(fn(x) { pp(x) }) }
    println(f"{k.count()}")
}
error[NK1343]: ... `if` and `else` have incompatible types, expected struct `__NikaiaChain<..>`

Expected: 6.

Suspected cause: the paused kept states (emit_paused_kept_steps) write no __NikaiaOneOf, as the non-pausing kept chains do since run 6.

To build


Generated by Claude Code

Back to Open Issues