Skip to content

Commit c7f1c36

Browse files
committed
Update docs on vector value syntax.
1 parent 007af36 commit c7f1c36

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

doc/rust.texi

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,7 @@ assert (p._1 == "world");
22962296
@cindex Vector types
22972297
@cindex Array types, see @i{Vector types}
22982298

2299-
The vector type-constructor @code{vec} represents a homogeneous array of
2299+
The vector type-constructor represents a homogeneous array of
23002300
values of a given type. A vector has a fixed size. The layer of a vector type
23012301
is to the layer of its member type, like any type that contains a single
23022302
member type.
@@ -2305,11 +2305,11 @@ Vectors can be sliced. A slice expression builds a new vector by copying a
23052305
contiguous range -- given by a pair of indices representing a half-open
23062306
interval -- out of the sliced vector.
23072307

2308-
An example of a @code{vec} type and its use:
2308+
An example of a vector type and its use:
23092309
@example
2310-
let vec[int] v = vec(7, 5, 3);
2310+
let [int] v = [7, 5, 3];
23112311
let int i = v.(2);
2312-
let vec[int] v2 = v.(0,1); // Form a slice.
2312+
let [int] v2 = v.(0,1); // Form a slice.
23132313
@end example
23142314

23152315
Vectors always @emph{allocate} a storage region sufficient to store the first
@@ -2318,8 +2318,8 @@ vector. This behaviour supports idiomatic in-place ``growth'' of a mutable
23182318
slot holding a vector:
23192319

23202320
@example
2321-
let mutable vec[int] v = vec(1, 2, 3);
2322-
v += vec(4, 5, 6);
2321+
let mutable vec[int] v = [1, 2, 3];
2322+
v += [4, 5, 6];
23232323
@end example
23242324

23252325
Normal vector concatenation causes the allocation of a fresh vector to hold
@@ -2451,7 +2451,7 @@ An example of a @code{chan} type:
24512451
@example
24522452
type chan[vec[str]] svc;
24532453
let svc c = get_chan();
2454-
let vec[str] v = vec("hello", "world");
2454+
let vec[str] v = ["hello", "world"];
24552455
c <| v;
24562456
@end example
24572457

@@ -3346,7 +3346,7 @@ Executing a @code{cont} expression immediately terminates the current iteration
33463346
of the innermost loop enclosing it, returning control to the loop
33473347
@emph{head}. In the case of a @code{while} loop, the head is the conditional
33483348
expression controlling the loop. In the case of a @code{for} or @code{for
3349-
each} loop, the head is the iterator or vector-slice increment controlling the
3349+
each} loop, the head is the iterator or vector-element increment controlling the
33503350
loop.
33513351

33523352
A @code{cont} expression is only permitted in the body of a loop.
@@ -3368,7 +3368,7 @@ run the loop over the slice.
33683368

33693369
Example of 4 for loops, all identical:
33703370
@example
3371-
let vec[foo] v = vec(a, b, c);
3371+
let vec[foo] v = [a, b, c];
33723372
33733373
for (foo e in v.(0, _vec.len(v))) @{
33743374
bar(e);
@@ -3718,17 +3718,12 @@ allocating and freeing boxed values.
37183718
@c * Ref.Run.Mem:: Runtime built-in type services.
37193719
@cindex Built-in types
37203720

3721-
The runtime provides C and Rust code to manage several built-in types:
3722-
@itemize
3723-
@item @code{vec}, the type of vectors.
3724-
@item @code{str}, the type of UTF-8 strings.
3725-
@item @code{big}, the type of arbitrary-precision integers.
3726-
@item @code{chan}, the type of communication channels.
3727-
@item @code{port}, the type of communication ports.
3728-
@item @code{task}, the type of tasks.
3729-
@end itemize
3730-
Support for other built-in types such as simple types, tuples,
3731-
records, and tags is open-coded by the Rust compiler.
3721+
The runtime provides C and Rust code to assist with various built-in types,
3722+
such as vectors, strings, bignums, and the low level communication system
3723+
(ports, channels, tasks).
3724+
3725+
Support for other built-in types such as simple types, tuples, records, and
3726+
tags is open-coded by the Rust compiler.
37323727

37333728
@node Ref.Run.Comm
37343729
@subsection Ref.Run.Comm

0 commit comments

Comments
 (0)