Skip to content

Generic enum: matching a variant with two or more payload fields fails MIR validation ('use rvalue does not resolve to a concrete MIR type') #1441

Closed

Description

@ehartford

Summary

Matching a user generic enum variant with more than one payload field fails MIR validation, even in declaration order and with a scalar type argument.

Repro (origin/main 1c76062)

enum G[T]:
    V(t: T, k: i64)
    E

fn main:
    let g: G[i64] = G.V(7, 8)
    match g:
        G.V(t, k) => print(f"t={t} k={k}")
        G.E => print("E")
error: invalid MIR before codegen: use rvalue does not resolve to a concrete MIR type (place local=1 local_ty=449 projs=2 proj0_kind=3)
 --> g1.w:8:13
8 |         G.V(t, k) => print(f"t={t} k={k}")

A single-field variant (V(t: T)) with the same match works. Expected: t=7 k=8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions