]> git.lizzy.rs Git - rust.git/commitdiff
Describe (a,) vs (a) in docs
authorSteve Klabnik <steve@steveklabnik.com>
Thu, 30 Apr 2015 17:55:03 +0000 (13:55 -0400)
committerSteve Klabnik <steve@steveklabnik.com>
Thu, 30 Apr 2015 19:10:58 +0000 (15:10 -0400)
Fixes #24730

src/doc/reference.md
src/doc/trpl/primitive-types.md

index 19cbd6f90a58146402abf38283d285cac38cae85..f9ffcc9eb286f311c38320f44427e3ac7f3d4fe3 100644 (file)
@@ -2431,11 +2431,18 @@ Tuples are written by enclosing zero or more comma-separated expressions in
 parentheses. They are used to create [tuple-typed](#tuple-types) values.
 
 ```{.tuple}
-(0,);
 (0.0, 4.5);
 ("a", 4usize, true);
 ```
 
+You can disambiguate a single-element tuple from a value in parentheses with a
+comma:
+
+```
+(0,); // single-element tuple
+(0); // zero in parentheses
+```
+
 ### Unit expressions
 
 The expression `()` denotes the _unit value_, the only value of the type with
index aca6e327c3bce07f5d0626faaa162b9ba7623d40..e017e222c74177b6f80a7b529220405e8ac136fe 100644 (file)
@@ -248,6 +248,14 @@ or “breaks up” the tuple, and assigns the bits to three bindings.
 
 This pattern is very powerful, and we’ll see it repeated more later.
 
+You can disambiguate a single-element tuple from a value in parentheses with a
+comma:
+
+```
+(0,); // single-element tuple
+(0); // zero in parentheses
+```
+
 ## Tuple Indexing
 
 You can also access fields of a tuple with indexing syntax: