Skip to content

Commit 7be7a8f

Browse files
committed
auto merge of #15121 : steveklabnik/rust/matching_docs, r=alexcrichton
Fixes #11113.
2 parents 2f74325 + 53627dd commit 7be7a8f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/doc/tutorial.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,14 @@ tuple, introducing two variables at once: `a` and `b`.
566566
let (a, b) = get_tuple_of_two_ints();
567567
~~~~
568568

569-
Let bindings only work with _irrefutable_ patterns: that is, patterns
570-
that can never fail to match. This excludes `let` from matching
571-
literals and most `enum` variants.
569+
Let bindings only work with _irrefutable_ patterns: that is, patterns that can
570+
never fail to match. This excludes `let` from matching literals and most `enum`
571+
variants as binding patterns, since most such patterns are not irrefutable. For
572+
example, this will not compile:
573+
574+
~~~~{ignore}
575+
let (a, 2) = (1, 2);
576+
~~~~
572577

573578
## Loops
574579

0 commit comments

Comments
 (0)