You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ICE: xs.map(f).collect[List]() on a List: "user generic call lacks a concrete contract" #2319
Calling .collect[...]() on the result of List.map (the LIST_MAP intrinsic) reaches MIR with no concrete contract and stops the compiler instead of compiling or being refused by Sema.
fn main:
let xs = [1, 2]
let ys: List[i32] = xs.map(it + 1).collect[List]()
print(ys.len())
BUG: user generic call lacks a concrete contract: body=981(main) call=2 node=10710 sig=-1 mono=0 [src/MirLower.w:18241 MirModule.validate_generic_call_contracts]
Same with collect[List[str]]() and with str.split(..).map(it.to_owned()).collect[List](). xs.iter().map(it + 1).collect[List]() works. With .collect() and no explicit argument it fails with only error: run failed, which is a second defect: no diagnostic names the problem.
Expected: List.map followed by collect compiles, as the iterator form does. Or, if List.map already returns a List and collect is not a List method, Sema refuses it with a named error before MIR.
Workaround: .iter().map(...). Found by a one-liner tool during D114.
Fixed on main by e3b0ad0 (PR #2661, stack #2668; battery green on the stack top 9f92dbb). The commit message names the root-cause line and the regression test.
Activity
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced; the internal error is still reached.pre-release: an internal error on ordinary iterator code.
Sema: collect[C]() over a value that is not an iterator is refused by…
ehartford commentedon Oct 25, 2026
Fixed on main by e3b0ad0 (PR #2661, stack #2668; battery green on the stack top 9f92dbb). The commit message names the root-cause line and the regression test.