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
Codegen: a static Type.fn (no self) called through an instance, b.make(p), emits a call with the receiver as an extra argument (invalid LLVM function) #1617
Found while probing null-argument contexts for the SQLite facade (D51 stage 12); pre-existing on the stage-9 stage1 (same output with a typed local, so not the stage 12 null change).
type B2 { n: i32 }
fn B2.make(p: *mut *mut i8) -> B2: B2 { n: if p == null: 7 else: 0 }
fn main:
let b = B2 { n: 1 }
let q: *mut *mut i8 = null
let a = b.make(q).n // B2.make(q) is fine
print(f"{a}")
Incorrect number of arguments passed to called function!
%4 = call %B2 @B2.make(ptr %3, ptr null)
===== INVALID LLVM FUNCTION main =====
error: code generation failed
Sema accepts b.make(q) (a static fn reached through a value) and MirLower/codegen pass the receiver as a first argument the callee does not take. Either Sema rejects the spelling (a static fn has no receiver; B2.make(q) is the call) or lowering drops the receiver — the spec should decide which; today it is a silent codegen failure, which is neither.
Activity
Paper cuts: Vec ranges as []T views, let-else return inference, usize…
ehartford commentedon Sep 26, 2026
Fixed on main by #1702 (55739d4); battery green, pinned by the behavior tests named in the PR.