Issue #2943: An unannotated integer list that is summed becomes Vec, and a collect from it into Vec[i64] fails (NK1343)

Open and answer this issue on GitHub.

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

Probe

fn main() throws {
    let xs = [1, 2, 3]
    let s = xs.iter().sum()
    let v: Vec[i64] = xs.iter().collect()
    println(f"{v.len()} {s}")
}

This gives NK1343. rustc reports mismatched types: expected List<i64>, found List<i32>. The lowered Rust writes let xs: Vec<i32> and let s: i32. It fails the same way on c2554dfb and on the tree of the second run of #2927. Without the sum line, the program prints 3.

Expected

The program prints 3 6. An integer literal that nothing names is i64 (Part I).

Suspected cause

The checker’s summed fact (CheckFacts.summed) gives the literal’s open integer type as i32, and the let of xs takes that type. To check: print facts.summed for the sum node.

To build

  1. A sum does not narrow an open integer literal below i64 unless something names a narrower type.
  2. The probe becomes a test with its .stdout.

Done when

The probe prints 3 6.

Found during “Chains over lists, maps and std’s other producers are one loop the compiler writes, and seq.rs leaves Rust (ADR-chain-loop-v1 D6, D7)” (#2927).

Back to Open Issues