Skip to content

Commit 53627dd

Browse files
committed
Make an example more clear with sample code.
Fixes #11113.
1 parent d77cb22 commit 53627dd

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
@@ -559,9 +559,14 @@ tuple, introducing two variables at once: `a` and `b`.
559559
let (a, b) = get_tuple_of_two_ints();
560560
~~~~
561561

562-
Let bindings only work with _irrefutable_ patterns: that is, patterns
563-
that can never fail to match. This excludes `let` from matching
564-
literals and most `enum` variants.
562+
Let bindings only work with _irrefutable_ patterns: that is, patterns that can
563+
never fail to match. This excludes `let` from matching literals and most `enum`
564+
variants as binding patterns, since most such patterns are not irrefutable. For
565+
example, this will not compile:
566+
567+
~~~~{ignore}
568+
let (a, 2) = (1, 2);
569+
~~~~
565570

566571
## Loops
567572

0 commit comments

Comments
 (0)