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
Uninferable-but-mentioned generic type param silently defaults to i32, producing phantom 'expects &i32' diagnostics #738
SemaDecl.w:2792 (ensure_generic_substitutions): when a type parameter is unbound after argument inference but IS mentioned in some parameter's type, Sema silently substitutes i32:
if self.type_param_mentions_any_param_type(tp_name, param_start, param_count) != 0:
self.put_generic_subst(tp_name, self.ty_i32, call_node)
Downstream this manufactures diagnostics about types the user never wrote — #737's original report showed argument 1 expects &i32 for a param declared &C (the binder failed to bind C, then C silently became i32). The binder gap is fixed under #737, but every remaining inference gap that leaves a mentioned param unbound (e.g. a mismatched generic base: fn f[T](x: SomeStruct[T]) called with a different container) still reaches this default and reports i32-flavored nonsense instead of the honest #598 teaching diagnostic ('cannot infer type parameter ...').
This is a silent fallback (CLAUDE.md forbids these): translation failed, output fabricated. Wants: emit the #598 diagnostic in the mentioned case too (or thread the real reason binding failed). Needs care: the default may be load-bearing for error-recovery cascades where arg types are already 0 — audit callers before removing.
Fixed in c7dc28c (battery green; seed + installed now v0.15.1-gc7dc28ce).
On a clean compile, a mentioned-but-unbound type parameter now reports the inference failure by name — 'cannot infer type parameter T for this call; the argument's shape does not match the parameter type that mentions T' — instead of silently substituting i32 and letting downstream diagnostics blame types the user never wrote. The i32 default survives only as cascade suppression when the call's arguments already errored (single-error output preserved for broken call sites, verified). Pinned by test/compile_errors/err_generic_uninferable_mentioned_param.w.
Activity
ehartford commentedon Jul 28, 2026
Fixed in c7dc28c (battery green; seed + installed now v0.15.1-gc7dc28ce).
On a clean compile, a mentioned-but-unbound type parameter now reports the inference failure by name — 'cannot infer type parameter T for this call; the argument's shape does not match the parameter type that mentions T' — instead of silently substituting i32 and letting downstream diagnostics blame types the user never wrote. The i32 default survives only as cascade suppression when the call's arguments already errored (single-error output preserved for broken call sites, verified). Pinned by test/compile_errors/err_generic_uninferable_mentioned_param.w.
#737: a generic &C parameter borrows — infer through auto-ref, do not…
#738: mentioned-but-unbound type param gets the honest inference diag…
Handoff: D27 enshrined and E1+E2 landed; stage2 miscompile blocks the…