bynk.types.extensible_match_needs_wildcard
Error A match covers an extensible standard-library enum (FetchError, Method) without a wildcard; it may gain variants in a minor release.
Some standard-library enums, among them FetchError and Method, are extensible: a minor release may add a variant. A match that names every variant they have today would then stop covering them, so the compiler asks for a wildcard arm now, and the match keeps compiling when a variant arrives. Listing every current variant is not enough. Add _, or Err(_) where the enum is wrapped, and put there whatever should happen for a variant you did not name. An enum of your own with the same name is not extensible; the rule follows the first-party enum. For an ordinary enum, a missing arm is bynk.types.non_exhaustive_match.
Example
fn verb(m: Method) -> String { match m { // ✗ every variant, but no wildcard Get => "read" Post => "write" Put => "write" Delete => "write" Patch => "write" Head => "read" Options => "read" }}
fn verb(m: Method) -> String { match m { Get => "read" _ => "write" // ✓ also covers variants added later }}In the Book
See also
- Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.extensible_match_needs_wildcardshows the same from the installed toolchain, without a network.