Skip to content

Commit 446932b

Browse files
rilliangraydon
authored andcommitted
Fix doc references to 'for each' syntax to match the compiler.
The rustboot compiler expects 'for each (type v in ...)' like 'for', rather than 'for each (type v = ...)' as given in the documentation.
1 parent 4af0db4 commit 446932b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/rust.texi

+4-4
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ iter range(int lo, int hi) -> int @{
18451845
@}
18461846
18471847
let int sum = 0;
1848-
for each (int x = range(0,100)) @{
1848+
for each (int x in range(0,100)) @{
18491849
sum += x;
18501850
@}
18511851
@end example
@@ -2325,7 +2325,7 @@ iter range(int x, int y) -> int @{
23252325
@}
23262326
@}
23272327
2328-
for each (int i = range(5,7)) @{
2328+
for each (int i in range(5,7)) @{
23292329
@dots{};
23302330
@}
23312331
@end example
@@ -3149,7 +3149,7 @@ fn read_file_lines(&str path) -> vec[str] @{
31493149
note path;
31503150
vec[str] r;
31513151
file f = open_read(path);
3152-
for each (str &s = lines(f)) @{
3152+
for each (str &s in lines(f)) @{
31533153
vec.append(r,s);
31543154
@}
31553155
ret r;
@@ -3282,7 +3282,7 @@ Example of a foreach loop:
32823282
@example
32833283
let str txt;
32843284
let vec[str] lines;
3285-
for each (&str s = _str.split(txt, "\n")) @{
3285+
for each (&str s in _str.split(txt, "\n")) @{
32863286
vec.push(lines, s);
32873287
@}
32883288
@end example

0 commit comments

Comments
 (0)