S0048: record or enum pattern requires named scrutinee
Generated from rellum-diagnostics/src/db.rs.
Explanation
Record and enum variant patterns destructure named record or enum values. A scalar, tuple, array, Option, Result, or value of the wrong named kind does not have the declared payload layout the pattern expects.
Common causes
- matching a scalar or tuple with a record pattern
- matching a record value with an enum variant pattern
- matching an enum value with a record pattern
Canonical fixes
- use a pattern that matches the scrutinee type
Before:
match count
Point { x } => x
After:
match point
Point { x } => x
- convert or construct the value before matching if a named type is intended
Code example
match count
Point { x } => x