Open and answer this issue on GitHub.
bug, ready · opened 2026-11-30 · updated 2026-11-30 · 0 comments
A pausing chain collected into a declared HashSet 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::collections
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: collections::HashSet[i64] = xs.iter().map(fn(x) { p(x) }).collect()
println(f"{ys.len()}")
}
error[NK1343]: ... mismatched types, expected struct `HashSet<i64>`, found struct `List<i64>`
Expected: 6. collect builds what the declaration names (ADR-293 D25).
Suspected cause: emit_stream_chain’s plain loop collects into a List, whatever collected_into says.
To build
Generated by Claude Code