@@ -274,7 +274,7 @@ characters. This is a bug that will eventually be fixed.
274
274
275
275
The double-colon (` :: ` ) is used as a module separator, so
276
276
` io::println ` means 'the thing named ` println ` in the module
277
- named ` io ` .
277
+ named ` io ` ' .
278
278
279
279
Rust will normally emit warnings about unused variables. These can be
280
280
suppressed by using a variable name that starts with an underscore.
@@ -1114,9 +1114,9 @@ enum direction {
1114
1114
This will define ` north ` , ` east ` , ` south ` , and ` west ` as constants,
1115
1115
all of which have type ` direction ` .
1116
1116
1117
- When the enum is C like, that is none of the variants have parameters,
1118
- it is possible to explicitly set the discriminator values to an integer
1119
- value:
1117
+ When an enum is C- like, that is, when none of the variants have
1118
+ parameters, it is possible to explicitly set the discriminator values
1119
+ to an integer value:
1120
1120
1121
1121
~~~~
1122
1122
enum color {
@@ -1372,7 +1372,7 @@ destructors. Resources might go away in the future.
1372
1372
Rust datatypes are not trivial to copy (the way, for example,
1373
1373
JavaScript values can be copied by simply taking one or two machine
1374
1374
words and plunking them somewhere else). Shared boxes require
1375
- reference count updates, big records, enums, or unique pointers require
1375
+ reference count updates, and big records, enums, or unique pointers require
1376
1376
an arbitrary amount of data to be copied (plus updating the reference
1377
1377
counts of shared boxes hanging off them).
1378
1378
@@ -1492,7 +1492,7 @@ simply pick the most efficient passing style. There is one exception,
1492
1492
which will be described in the section on [ generics] ( #generics ) .
1493
1493
1494
1494
To explicitly set the passing-style for a parameter, you prefix the
1495
- argument name with a sigil. There are two special passing styles that
1495
+ argument name with a sigil. There are three special passing styles that
1496
1496
are often useful. The first is by-mutable-pointer, written with a
1497
1497
single ` & ` :
1498
1498
@@ -1532,10 +1532,11 @@ non-copyable types.
1532
1532
1533
1533
## Generic functions
1534
1534
1535
- Throughout this tutorial, I've been defining functions like ` for_rev `
1536
- that act only on integers. It is 2012, and we no longer expect to be
1537
- defining such functions again and again for every type they apply to.
1538
- Thus, Rust allows functions and datatypes to have type parameters.
1535
+ Throughout this tutorial, we've been defining functions like ` for_rev `
1536
+ that act only on single data types. It is 2012, and we no longer
1537
+ expect to be defining such functions again and again for every type
1538
+ they apply to. Thus, Rust allows functions and datatypes to have type
1539
+ parameters.
1539
1540
1540
1541
~~~~
1541
1542
fn for_rev<T>(v: [T], act: fn(T)) {
@@ -1877,7 +1878,7 @@ just fine, but it does not have access to `enc::super_secret_number`.
1877
1878
1878
1879
## Namespaces
1879
1880
1880
- Rust uses three different namespaces. One for modules, one for types,
1881
+ Rust uses three different namespaces: one for modules, one for types,
1881
1882
and one for values. This means that this code is valid:
1882
1883
1883
1884
~~~~
@@ -1901,10 +1902,10 @@ though `str` is a built-in type name.
1901
1902
The resolution process in Rust simply goes up the chain of contexts,
1902
1903
looking for the name in each context. Nested functions and modules
1903
1904
create new contexts inside their parent function or module. A file
1904
- that's part of a bigger crate will have that crate's context as parent
1905
- context.
1905
+ that's part of a bigger crate will have that crate's context as its
1906
+ parent context.
1906
1907
1907
- Identifiers can shadow each others . In this program, ` x ` is of type
1908
+ Identifiers can shadow each other . In this program, ` x ` is of type
1908
1909
` int ` :
1909
1910
1910
1911
~~~~
0 commit comments