Skip to content

Commit 47cba3a

Browse files
committed
tutorial: Consistent metavariable for types. Closes #2461.
1 parent 3891b5a commit 47cba3a

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

doc/tutorial.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,11 +1014,11 @@ let my_shape = circle({x: 0.0, y: 0.0}, 10.0);
10141014

10151015
## Records
10161016

1017-
Rust record types are written `{field1: TYPE, field2: TYPE [, ...]}`,
1018-
and record literals are written in the same way, but with expressions
1019-
instead of types. They are quite similar to C structs, and even laid
1020-
out the same way in memory (so you can read from a Rust struct in C,
1021-
and vice-versa).
1017+
Rust record types are written `{field1: T1, field2: T2 [, ...]}`,
1018+
where `T1`, `T2`, ... denote types. Record literals are written in
1019+
the same way, but with expressions instead of types. They are quite
1020+
similar to C structs, and even laid out the same way in memory (so you
1021+
can read from a Rust struct in C, and vice-versa).
10221022

10231023
The dot operator is used to access record fields (`mypoint.x`).
10241024

@@ -1220,10 +1220,10 @@ records with mutable fields, it can be useful to have a single copy on
12201220
the heap, and refer to that through a pointer.
12211221

12221222
Rust supports several types of pointers. The simplest is the unsafe
1223-
pointer, written `*TYPE`, which is a completely unchecked pointer
1224-
type only used in unsafe code (and thus, in typical Rust code, very
1225-
rarely). The safe pointer types are `@TYPE` for shared,
1226-
reference-counted boxes, and `~TYPE`, for uniquely-owned pointers.
1223+
pointer, written `*T`, which is a completely unchecked pointer type
1224+
only used in unsafe code (and thus, in typical Rust code, very
1225+
rarely). The safe pointer types are `@T` for shared, reference-counted
1226+
boxes, and `~T`, for uniquely-owned pointers.
12271227

12281228
All pointer types can be dereferenced with the `*` unary operator.
12291229

@@ -1272,9 +1272,9 @@ become the sole owner of the box.
12721272

12731273
### Mutability
12741274

1275-
All pointer types have a mutable variant, written `@mut TYPE` or
1276-
`~mut TYPE`. Given such a pointer, you can write to its contents
1277-
by combining the dereference operator with a mutating action.
1275+
All pointer types have a mutable variant, written `@mut T` or `~mut
1276+
T`. Given such a pointer, you can write to its contents by combining
1277+
the dereference operator with a mutating action.
12781278

12791279
~~~~
12801280
fn increase_contents(pt: @mut int) {
@@ -1285,8 +1285,8 @@ fn increase_contents(pt: @mut int) {
12851285
## Vectors
12861286

12871287
Rust vectors are always heap-allocated and unique. A value of type
1288-
`[TYPE]` is represented by a pointer to a section of heap memory
1289-
containing any number of `TYPE` values.
1288+
`[T]` is represented by a pointer to a section of heap memory
1289+
containing any number of values of type `T`.
12901290

12911291
NOTE: This uniqueness is turning out to be quite awkward in practice,
12921292
and might change in the future.
@@ -1300,9 +1300,9 @@ if myvec[1] { io::println("boom"); }
13001300
~~~~
13011301

13021302
By default, vectors are immutable—you can not replace their elements.
1303-
The type written as `[mut TYPE]` is a vector with mutable
1304-
elements. Mutable vector literals are written `[mut]` (empty) or
1305-
`[mut 1, 2, 3]` (with elements).
1303+
The type written as `[mut T]` is a vector with mutable
1304+
elements. Mutable vector literals are written `[mut]` (empty) or `[mut
1305+
1, 2, 3]` (with elements).
13061306

13071307
The `+` operator means concatenation when applied to vector types.
13081308
Growing a vector in Rust is not as inefficient as it looks :

0 commit comments

Comments
 (0)