Skip to content

Commit 786ae01

Browse files
committed
auto merge of #5782 : zofrex/rust/doc-1-tuples, r=thestinger
As per [the 0.6 release notes](https://github.com/mozilla/rust/wiki/Doc-detailed-release-notes#06-april-2013) single-element tuples are legal. I spotted a couple of places in the documentation that said otherwise, and propose these changes to them.
2 parents 1968130 + ac9e694 commit 786ae01

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

doc/rust.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1653,11 +1653,12 @@ Path expressions are [lvalues](#lvalues-rvalues-and-temporaries).
16531653

16541654
### Tuple expressions
16551655

1656-
Tuples are written by enclosing two or more comma-separated
1656+
Tuples are written by enclosing one or more comma-separated
16571657
expressions in parentheses. They are used to create [tuple-typed](#tuple-types)
16581658
values.
16591659

16601660
~~~~~~~~ {.tuple}
1661+
(0,);
16611662
(0f, 4.5f);
16621663
("a", 4u, true);
16631664
~~~~~~~~
@@ -2578,7 +2579,7 @@ to the record type-constructor. The differences are as follows:
25782579

25792580
Tuple types and values are denoted by listing the types or values of their
25802581
elements, respectively, in a parenthesized, comma-separated
2581-
list. Single-element tuples are not legal; all tuples have two or more values.
2582+
list.
25822583

25832584
The members of a tuple are laid out in memory contiguously, like a record, in
25842585
order specified by the tuple type.

doc/tutorial.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ fn area(sh: Shape) -> float {
747747

748748
Tuples in Rust behave exactly like structs, except that their fields
749749
do not have names. Thus, you cannot access their fields with dot notation.
750-
Tuples can have any arity except for 0 or 1 (though you may consider
750+
Tuples can have any arity except for 0 (though you may consider
751751
unit, `()`, as the empty tuple if you like).
752752

753753
~~~~

0 commit comments

Comments
 (0)