Skip to content

Commit 67d421d

Browse files
committed
Document [0, ..8] vector syntax.
Closes #3336
1 parent d107e58 commit 67d421d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/rust.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,9 @@ it is automatically derferenced to make the field access possible.
15471547
### Vector expressions
15481548

15491549
~~~~~~~~{.ebnf .gram}
1550-
vec_expr : '[' "mut" ? [ expr [ ',' expr ] * ] ? ']'
1550+
vec_expr : '[' "mut"? vec_elems? ']'
1551+
1552+
vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
15511553
~~~~~~~~
15521554

15531555
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
@@ -1557,8 +1559,10 @@ indicate that the elements of the resulting vector may be mutated.
15571559
When no mutability is specified, the vector is immutable.
15581560

15591561
~~~~
1562+
[]
15601563
[1, 2, 3, 4];
15611564
["a", "b", "c", "d"];
1565+
[0, ..128]; // vector with 128 zeros
15621566
[mut 0u8, 0u8, 0u8, 0u8];
15631567
~~~~
15641568

@@ -1890,7 +1894,7 @@ let x: int = add(1, 2);
18901894

18911895
~~~~~~~~ {.abnf .gram}
18921896
ident_list : [ ident [ ',' ident ]* ] ? ;
1893-
lambda_expr : '|' ident_list '| expr ;
1897+
lambda_expr : '|' ident_list '|' expr ;
18941898
~~~~~~~~
18951899

18961900
A _lambda expression_ (a.k.a. "anonymous function expression") defines a function and denotes it as a value,

0 commit comments

Comments
 (0)