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
Generic enum carrying H[T] of another generic enum: binding the payload in a match fails MIR validation #1442
enum H[T]:
X(t: T)
Y
enum G[T]:
A(h: H[T])
B(n: i64)
fn show_h(h: H[i64]):
match h:
H.X(t) => print(f"X {t}")
H.Y => print("Y")
fn main:
let g: G[i64] = G.A(H.X(3))
match g:
G.A(h) => show_h(h)
G.B(n) => print(f"B {n}")
error: invalid MIR before codegen: use rvalue type is incompatible with assign destination (dest ty=427 kind=19, src ty=4 kind=1)
--> e18.w:17:13
17 | G.A(h) => show_h(h)
Expected: X 3. (src ty=4 is TY_VOID: the bound payload's type did not resolve through the substitution T -> i64 of the nested instance.) A non-generic enum carrying H[i64] works (after #1430).
Activity
MIR/codegen: a generic enum variant with two or more payloads matches…
MIR validator: a user generic enum's payload is not guessed as its ty…
MIR/codegen: a generic enum variant with two or more payloads matches…
MIR validator: a user generic enum's payload is not guessed as its ty…
MIR/codegen: a generic enum variant with two or more payloads matches…
MIR validator: a user generic enum's payload is not guessed as its ty…
ehartford commentedon Sep 26, 2026
Verified fixed on main 55739d4 (release binary): G[T] carrying H[T] payload bound prints X 3.