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
A non-Unit tail under -> Never passes Sema and fails the MIR validator (wrong layer) #1493
Found while testing D60 (fn f -> Never: g = 1, which now yields a read of g and takes this path). Reproduced on origin/main 5848ae9 (stage1):
fn f -> Never: 5
fn main: f()
error: invalid MIR before codegen: use rvalue type is incompatible with assign destination (dest ty=15 kind=18, src ty=3 kind=1)
--> never5.w:1:17
The block spelling (let a = 1 then g) is the same. Sema accepts an i32 tail under a declared Never return; the MIR validator catches it, so it is loud, but the diagnostic is a compiler-internal one at the wrong layer. Expected: Sema's "return type mismatch" at the tail (a Never function's body must diverge on every path). The branch in check_fn_body_with_sig_at that compares a non-Unit tail against the declared return (types_compatible / implicit Ok wrapping) lets it through.
Activity