diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2014-06-23 14:02:42 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2014-06-25 10:38:03 -0400 |
| commit | 53627dd1f21820f295d366fc491e5fa88be40fd1 (patch) | |
| tree | 3f5d8ccccc0e34ba06de9756163ad3782cb88f58 /src/doc/tutorial.md | |
| parent | d77cb22bb6e5852c99d4c8f5d9de4b33b1b9381b (diff) | |
| download | rust-53627dd1f21820f295d366fc491e5fa88be40fd1.tar.gz rust-53627dd1f21820f295d366fc491e5fa88be40fd1.zip | |
Make an example more clear with sample code.
Fixes #11113.
Diffstat (limited to 'src/doc/tutorial.md')
| -rw-r--r-- | src/doc/tutorial.md | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index e6d9cef7a31..ba80444aaa3 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -559,9 +559,14 @@ tuple, introducing two variables at once: `a` and `b`. let (a, b) = get_tuple_of_two_ints(); ~~~~ -Let bindings only work with _irrefutable_ patterns: that is, patterns -that can never fail to match. This excludes `let` from matching -literals and most `enum` variants. +Let bindings only work with _irrefutable_ patterns: that is, patterns that can +never fail to match. This excludes `let` from matching literals and most `enum` +variants as binding patterns, since most such patterns are not irrefutable. For +example, this will not compile: + +~~~~{ignore} +let (a, 2) = (1, 2); +~~~~ ## Loops |
