Skip to content
Playground(another site)

bynk.parse.empty_match

Error A match has no arms.

A match, or the else match of a let … else, must have at least one arm. Each arm gives the match a value, so one with no arms has none to give. Write an arm for each shape the value can take; a final _ => arm takes whatever the others leave.

Example

match xs { // ✗ no arms
}
match xs {
[x, ..] => x // ✓ one arm for each shape
[] => 0
}

In the Book

See also

  • The grammar rule it governs: match_expr.
  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.empty_match shows the same from the installed toolchain, without a network.