summary refs log tree commit diff
path: root/src/doc/reference.md
diff options
context:
space:
mode:
authorAlexander Chernyakhovsky <achernya@mit.edu>2015-02-22 00:25:12 -0500
committerAlexander Chernyakhovsky <achernya@mit.edu>2015-02-22 00:25:12 -0500
commit928341e18890c0fec910a0dc92ef7f36e01a8d65 (patch)
tree4ba107a7739d54862425b8e338e520457fe05f47 /src/doc/reference.md
parent2b01a37ec38db9301239f0c0abcf3c695055b0ff (diff)
downloadrust-928341e18890c0fec910a0dc92ef7f36e01a8d65.tar.gz
rust-928341e18890c0fec910a0dc92ef7f36e01a8d65.zip
Include tuple indexing in the Reference.
The Rust Reference should include the tuple indexing (using a number
as a field) notation; currently it is only available on
http://doc.rust-lang.org/std/primitive.tuple.html and not easily
searchable.
Diffstat (limited to 'src/doc/reference.md')
-rw-r--r--src/doc/reference.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index e6ff29799f4..07e5d50f481 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -3554,7 +3554,8 @@ Tuple types and values are denoted by listing the types or values of their
 elements, respectively, in a parenthesized, comma-separated list.
 
 Because tuple elements don't have a name, they can only be accessed by
-pattern-matching.
+pattern-matching or by using `N` directly as a field to access the
+`N`th element.
 
 An example of a tuple type and its use:
 
@@ -3563,6 +3564,7 @@ type Pair<'a> = (i32, &'a str);
 let p: Pair<'static> = (10, "hello");
 let (a, b) = p;
 assert!(b != "world");
+assert!(p.0 == 10);
 ```
 
 ### Array, and Slice types