S0051: duplicate field in pattern
Generated from rellum-diagnostics/src/db.rs.
Explanation
A record or enum payload field can only be bound once in a pattern. Binding the same field twice would create two local names for the same payload slot and make later field checks ambiguous.
Common causes
- listing the same record field twice
- copying a field name while editing an enum variant pattern
- trying to bind one field under two different names
Canonical fixes
- remove the duplicate field from the pattern
Before:
Point { x, x }
After:
Point { x }
- add a different field when another payload value is needed
Before:
Point { x, x }
After:
Point { x, y }
Code example
Point { x, x }