1 An "or" pattern was used where the variable bindings are not consistently bound
4 Erroneous code example:
8 Some(y) | None => { /* use y */ } // error: variable `y` from pattern #1 is
9 // not bound in pattern #2
14 Here, `y` is bound to the contents of the `Some` and can be used within the
15 block corresponding to the match arm. However, in case `x` is `None`, we have
16 not specified what `y` is, and the block will use a nonexistent variable.
18 To fix this error, either split into multiple match arms:
23 Some(y) => { /* use y */ }
28 or, bind the variable to a field of the same type in all sub-patterns of the
34 (0, y) | (y, 0) => { /* use y */}
39 In this example, if `x` matches the pattern `(0, _)`, the second field is set
40 to `y`. If it matches `(_, 0)`, the first field is set to `y`; so in all
41 cases `y` is set to some value.