1 This error indicates that the compiler cannot guarantee a matching pattern for
2 one or more possible inputs to a match expression. Guaranteed matches are
3 required in order to assign values to match expressions, or alternatively,
4 determine the flow of execution.
6 Erroneous code example:
14 let x = Terminator::HastaLaVistaBaby;
16 match x { // error: non-exhaustive patterns: `HastaLaVistaBaby` not covered
17 Terminator::TalkToMyHand => {}
21 If you encounter this error you must alter your patterns so that every possible
22 value of the input type is matched. For types with a small number of variants
23 (like enums) you should probably cover all cases explicitly. Alternatively, the
24 underscore `_` wildcard pattern can be added after all other patterns to match
25 "anything else". Example:
33 let x = Terminator::HastaLaVistaBaby;
36 Terminator::TalkToMyHand => {}
37 Terminator::HastaLaVistaBaby => {}
43 Terminator::TalkToMyHand => {}