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
Sema/MIR: let Ok(x) = … else: return 1 in fn main: (inferred return) fails the MIR validator at the return; -> i32 spelled explicitly compiles #1623
Found by the ruling §66 example rewrite. A let-else whose else branch is return 1 does not make an unannotated fn main: return i32 the way an if …: return 1 does; the tail print is then Unit and the validator refuses the return:
error: invalid MIR before codegen: use rvalue type is incompatible with assign destination (dest ty=14 kind=4, src ty=3 kind=1)
--> letelse_pure.w:5:9
5 | return 1
fn main -> i32: → compiles, prints pure.
The same program with a later if cond: return 1 (so a non-let-else return establishes i32) → compiles (this is why the sqlite3 UAT fixture, which has both, is fine).
Using v after the binding changes nothing.
So the D43 return-type inference does not see a return inside a let-else's diverging block; D58's let-else should count like any other statement's return. Stage1 of c18fdfe.
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.