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 traps (LLVM getTypeSizeInBits on void) on a cast to *const Unit: (u: &Unit) as *const Unit as *mut c_void #1626
Found by Modeled C stage 12b (#1618): a facade callback method generic in the userdata type U is specialized with U = Unit when the nullable callback is absent, and its body u as *const U as *mut c_void traps the compiler.
Minimal repro (with run):
fn c(u: &Unit) -> *mut c_void: u as *const Unit as *mut c_void
fn main:
let x = ()
print(c(x) == null)
Expected: compiles; a pointer cast needs no pointee size. Actual: the compiler exits 133 (SIGTRAP) in llvm::DataLayout::getTypeSizeInBits(llvm::Type*) — brk #0x1 on the void type — with no diagnostic (lldb: EXC_BREAKPOINT in getTypeSizeInBits, called from the cast lowering).
transmute[*mut c_void](u) of the same value compiles and runs, so the rendered facade method uses that (FacadeRender.w facade_render_callback_methods, the nullable branch). Remove that workaround when this is fixed. A silent trap is also a tool that stayed silent: the cast lowering should reject or handle a zero-sized pointee, never reach LLVM's assertion.
Activity
Facade: `nullable param N` on a paired callback renders `Option[exter…
Facade: `nullable param N` on a paired callback renders `Option[exter…
Facade: `nullable param N` on a paired callback renders `Option[exter…
Modeled C stage 12b: optional callbacks, items valid on the failed st…
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.