@@ -13,16 +13,16 @@ provides three kinds of material:
13
13
- Appendix chapters providing rationale and references to languages that
14
14
influenced the design.
15
15
16
- This document does not serve as an introduction to the
16
+ This document does not serve as a tutorial introduction to the
17
17
language. Background familiarity with the language is assumed. A separate
18
- [ guide ] is available to help acquire such background familiarity.
18
+ [ tutorial ] document is available to help acquire such background familiarity.
19
19
20
20
This document also does not serve as a reference to the [ standard]
21
21
library included in the language distribution. Those libraries are
22
22
documented separately by extracting documentation attributes from their
23
23
source code.
24
24
25
- [ guide ] : guide .html
25
+ [ tutorial ] : tutorial .html
26
26
[ standard ] : std/index.html
27
27
28
28
## Disclaimer
@@ -349,7 +349,7 @@ enclosed within two `U+0022` (double-quote) characters,
349
349
with the exception of ` U+0022 ` itself,
350
350
which must be _ escaped_ by a preceding ` U+005C ` character (` \ ` ),
351
351
or a _ raw byte string literal_ .
352
- It is equivalent to a ` &'static [u8] ` borrowed array of unsigned 8-bit integers.
352
+ It is equivalent to a ` &'static [u8] ` borrowed vector of unsigned 8-bit integers.
353
353
354
354
Some additional _ escapes_ are available in either byte or non-raw byte string
355
355
literals. An escape starts with a ` U+005C ` (` \ ` ) and continues with one of
@@ -2555,8 +2555,6 @@ The currently implemented features of the reference compiler are:
2555
2555
which is considered wildly unsafe and will be
2556
2556
obsoleted by language improvements.
2557
2557
2558
- * ` tuple_indexing ` - Allows use of tuple indexing (expressions like ` expr.0 ` )
2559
-
2560
2558
If a feature is promoted to a language feature, then all existing programs will
2561
2559
start to receive compilation warnings about #[ feature] directives which enabled
2562
2560
the new feature (because the directive is no longer necessary). However, if
@@ -2811,17 +2809,16 @@ When the type providing the field inherits mutabilty, it can be [assigned](#assi
2811
2809
Also, if the type of the expression to the left of the dot is a pointer,
2812
2810
it is automatically dereferenced to make the field access possible.
2813
2811
2814
- ### Array expressions
2812
+ ### Vector expressions
2815
2813
2816
2814
~~~~ {.ebnf .gram}
2817
- array_expr : '[' "mut" ? vec_elems? ']' ;
2815
+ vec_expr : '[' "mut" ? vec_elems? ']' ;
2818
2816
2819
- array_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
2817
+ vec_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
2820
2818
~~~~
2821
2819
2822
- An [ array] ( #vector,-array,-and-slice-types ) _ expression_ is written by
2823
- enclosing zero or more comma-separated expressions of uniform type in square
2824
- brackets.
2820
+ A [ _ vector_ ] ( #vector-types ) _ expression_ is written by enclosing zero or
2821
+ more comma-separated expressions of uniform type in square brackets.
2825
2822
2826
2823
In the ` [expr ',' ".." expr] ` form, the expression after the ` ".." `
2827
2824
must be a constant expression that can be evaluated at compile time, such
@@ -2830,7 +2827,7 @@ as a [literal](#literals) or a [static item](#static-items).
2830
2827
~~~~
2831
2828
[1i, 2, 3, 4];
2832
2829
["a", "b", "c", "d"];
2833
- [0i, ..128]; // array with 128 zeros
2830
+ [0i, ..128]; // vector with 128 zeros
2834
2831
[0u8, 0u8, 0u8, 0u8];
2835
2832
~~~~
2836
2833
@@ -2840,9 +2837,9 @@ as a [literal](#literals) or a [static item](#static-items).
2840
2837
idx_expr : expr '[' expr ']' ;
2841
2838
~~~~
2842
2839
2843
- [ Array ] ( #vector,-array,-and-slice -types ) -typed expressions can be indexed by writing a
2840
+ [ Vector ] ( #vector-types ) -typed expressions can be indexed by writing a
2844
2841
square-bracket-enclosed expression (the index) after them. When the
2845
- array is mutable, the resulting [ lvalue] ( #lvalues,-rvalues-and-temporaries ) can be assigned to.
2842
+ vector is mutable, the resulting [ lvalue] ( #lvalues,-rvalues-and-temporaries ) can be assigned to.
2846
2843
2847
2844
Indices are zero-based, and may be of any integral type. Vector access
2848
2845
is bounds-checked at run-time. When the check fails, it will put the
@@ -2903,7 +2900,7 @@ This means that arithmetic operators can be overridden for user-defined types.
2903
2900
The default meaning of the operators on standard types is given here.
2904
2901
2905
2902
* ` + `
2906
- : Addition and array /string concatenation.
2903
+ : Addition and vector /string concatenation.
2907
2904
Calls the ` add ` method on the ` std::ops::Add ` trait.
2908
2905
* ` - `
2909
2906
: Subtraction.
@@ -3206,7 +3203,7 @@ for_expr : "for" pat "in" no_struct_literal_expr '{' block '}' ;
3206
3203
A ` for ` expression is a syntactic construct for looping over elements
3207
3204
provided by an implementation of ` std::iter::Iterator ` .
3208
3205
3209
- An example of a for loop over the contents of an array :
3206
+ An example of a for loop over the contents of a vector :
3210
3207
3211
3208
~~~~
3212
3209
# type Foo = int;
@@ -3264,7 +3261,7 @@ match_pat : pat [ '|' pat ] * [ "if" expr ] ? ;
3264
3261
3265
3262
A ` match ` expression branches on a * pattern* . The exact form of matching that
3266
3263
occurs depends on the pattern. Patterns consist of some combination of
3267
- literals, destructured arrays or enum constructors, structures and
3264
+ literals, destructured vectors or enum constructors, structures and
3268
3265
tuples, variable binding specifications, wildcards (` .. ` ), and placeholders
3269
3266
(` _ ` ). A ` match ` expression has a * head expression* , which is the value to
3270
3267
compare to the patterns. The type of the patterns must equal the type of the
@@ -3293,11 +3290,11 @@ between `_` and `..` is that the pattern `C(_)` is only type-correct if `C` has
3293
3290
exactly one argument, while the pattern ` C(..) ` is type-correct for any enum
3294
3291
variant ` C ` , regardless of how many arguments ` C ` has.
3295
3292
3296
- Used inside a array pattern, ` .. ` stands for any number of elements, when the
3293
+ Used inside a vector pattern, ` .. ` stands for any number of elements, when the
3297
3294
` advanced_slice_patterns ` feature gate is turned on. This wildcard can be used
3298
- at most once for a given array , which implies that it cannot be used to
3295
+ at most once for a given vector , which implies that it cannot be used to
3299
3296
specifically match elements that are at an unknown distance from both ends of a
3300
- array , like ` [.., 42, ..] ` . If followed by a variable name, it will bind the
3297
+ vector , like ` [.., 42, ..] ` . If followed by a variable name, it will bind the
3301
3298
corresponding slice to the variable. Example:
3302
3299
3303
3300
~~~~
@@ -3430,7 +3427,7 @@ let message = match x {
3430
3427
~~~~
3431
3428
3432
3429
Range patterns only work on scalar types
3433
- (like integers and characters; not like arrays and structs, which have sub-components).
3430
+ (like integers and characters; not like vectors and structs, which have sub-components).
3434
3431
A range pattern may not be a sub-range of another range pattern inside the same ` match ` .
3435
3432
3436
3433
Finally, match patterns can accept * pattern guards* to further refine the
@@ -3538,10 +3535,10 @@ http://www.unicode.org/glossary/#unicode_scalar_value)
3538
3535
(ie. a code point that is not a surrogate),
3539
3536
represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
3540
3537
or 0xE000 to 0x10FFFF range.
3541
- A ` [char] ` array is effectively an UCS-4 / UTF-32 string.
3538
+ A ` [char] ` vector is effectively an UCS-4 / UTF-32 string.
3542
3539
3543
3540
A value of type ` str ` is a Unicode string,
3544
- represented as a array of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
3541
+ represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
3545
3542
Since ` str ` is of unknown size, it is not a _ first class_ type,
3546
3543
but can only be instantiated through a pointer type,
3547
3544
such as ` &str ` or ` String ` .
@@ -3652,7 +3649,7 @@ Such recursion has restrictions:
3652
3649
3653
3650
* Recursive types must include a nominal type in the recursion
3654
3651
(not mere [ type definitions] ( #type-definitions ) ,
3655
- or other structural types such as [ arrays ] ( #vector,-array,-and-slice -types ) or [ tuples] ( #tuple-types ) ).
3652
+ or other structural types such as [ vectors ] ( #vector-types ) or [ tuples] ( #tuple-types ) ).
3656
3653
* A recursive ` enum ` item must have at least one non-recursive constructor
3657
3654
(in order to give the recursion a basis case).
3658
3655
* The size of a recursive type must be finite;
@@ -4156,7 +4153,7 @@ heap data.
4156
4153
### Built in types
4157
4154
4158
4155
The runtime provides C and Rust code to assist with various built-in types,
4159
- such as arrays , strings, and the low level communication system (ports,
4156
+ such as vectors , strings, and the low level communication system (ports,
4160
4157
channels, tasks).
4161
4158
4162
4159
Support for other built-in types such as simple types, tuples and
@@ -4175,7 +4172,7 @@ communication facilities.
4175
4172
The Rust compiler supports various methods to link crates together both
4176
4173
statically and dynamically. This section will explore the various methods to
4177
4174
link Rust crates together, and more information about native libraries can be
4178
- found in the [ ffi guide ] [ ffi ] .
4175
+ found in the [ ffi tutorial ] [ ffi ] .
4179
4176
4180
4177
In one session of compilation, the compiler can generate multiple artifacts
4181
4178
through the usage of either command line flags or the ` crate_type ` attribute.
0 commit comments