@@ -674,7 +674,7 @@ There are several kinds of item:
674
674
* [ modules] ( #modules )
675
675
* [ functions] ( #functions )
676
676
* [ type definitions] ( grammar.html#type-definitions )
677
- * [ structs ] ( #structs )
677
+ * [ structures ] ( #structures )
678
678
* [ enumerations] ( #enumerations )
679
679
* [ constant items] ( #constant-items )
680
680
* [ static items] ( #static-items )
@@ -900,10 +900,9 @@ fn main() {}
900
900
901
901
### Functions
902
902
903
- A _ function item_ defines a sequence of [ statements] ( #statements ) and a
904
- final [ expression] ( #expressions ) , along with a name and a set of
905
- parameters. Other than a name, all these are optional.
906
- Functions are declared with the keyword ` fn ` . Functions may declare a
903
+ A _ function item_ defines a sequence of [ statements] ( #statements ) and an
904
+ optional final [ expression] ( #expressions ) , along with a name and a set of
905
+ parameters. Functions are declared with the keyword ` fn ` . Functions declare a
907
906
set of * input* [ * variables* ] ( #variables ) as parameters, through which the caller
908
907
passes arguments into the function, and the * output* [ * type* ] ( #types )
909
908
of the value the function will return to its caller on completion.
@@ -922,7 +921,7 @@ An example of a function:
922
921
923
922
```
924
923
fn add(x: i32, y: i32) -> i32 {
925
- x + y
924
+ return x + y;
926
925
}
927
926
```
928
927
@@ -1156,7 +1155,7 @@ type Point = (u8, u8);
1156
1155
let p: Point = (41, 68);
1157
1156
```
1158
1157
1159
- ### Structs
1158
+ ### Structures
1160
1159
1161
1160
A _ structure_ is a nominal [ structure type] ( #structure-types ) defined with the
1162
1161
keyword ` struct ` .
@@ -2093,8 +2092,6 @@ The following configurations must be defined by the implementation:
2093
2092
* ` target_pointer_width = "..." ` - Target pointer width in bits. This is set
2094
2093
to ` "32" ` for targets with 32-bit pointers, and likewise set to ` "64" ` for
2095
2094
64-bit pointers.
2096
- * ` target_vendor = "..." ` - Vendor of the target, for example ` apple ` , ` pc ` , or
2097
- simply ` "unknown" ` .
2098
2095
* ` test ` - Enabled when compiling the test harness (using the ` --test ` flag).
2099
2096
* ` unix ` - See ` target_family ` .
2100
2097
* ` windows ` - See ` target_family ` .
@@ -2271,7 +2268,7 @@ The currently implemented features of the reference compiler are:
2271
2268
* ` advanced_slice_patterns ` - See the [ match expressions] ( #match-expressions )
2272
2269
section for discussion; the exact semantics of
2273
2270
slice patterns are subject to change, so some types
2274
- are still unstable.
2271
+ are still unstable.
2275
2272
2276
2273
* ` slice_patterns ` - OK, actually, slice patterns are just scary and
2277
2274
completely unstable.
@@ -2292,9 +2289,6 @@ The currently implemented features of the reference compiler are:
2292
2289
* ` box_syntax ` - Allows use of ` box ` expressions, the exact semantics of which
2293
2290
is subject to change.
2294
2291
2295
- * ` cfg_target_vendor ` - Allows conditional compilation using the ` target_vendor `
2296
- matcher which is subject to change.
2297
-
2298
2292
* ` concat_idents ` - Allows use of the ` concat_idents ` macro, which is in many
2299
2293
ways insufficient for concatenating identifiers, and may be
2300
2294
removed entirely for something more wholesome.
@@ -2620,21 +2614,21 @@ comma:
2620
2614
### Structure expressions
2621
2615
2622
2616
There are several forms of structure expressions. A _ structure expression_
2623
- consists of the [ path] ( #paths ) of a [ structure item] ( #structs ) , followed by
2617
+ consists of the [ path] ( #paths ) of a [ structure item] ( #structures ) , followed by
2624
2618
a brace-enclosed list of one or more comma-separated name-value pairs,
2625
2619
providing the field values of a new instance of the structure. A field name
2626
2620
can be any identifier, and is separated from its value expression by a colon.
2627
2621
The location denoted by a structure field is mutable if and only if the
2628
2622
enclosing structure is mutable.
2629
2623
2630
2624
A _ tuple structure expression_ consists of the [ path] ( #paths ) of a [ structure
2631
- item] ( #structs ) , followed by a parenthesized list of one or more
2625
+ item] ( #structures ) , followed by a parenthesized list of one or more
2632
2626
comma-separated expressions (in other words, the path of a structure item
2633
2627
followed by a tuple expression). The structure item must be a tuple structure
2634
2628
item.
2635
2629
2636
2630
A _ unit-like structure expression_ consists only of the [ path] ( #paths ) of a
2637
- [ structure item] ( #structs ) .
2631
+ [ structure item] ( #structures ) .
2638
2632
2639
2633
The following are examples of structure expressions:
2640
2634
@@ -3151,7 +3145,7 @@ if` condition is evaluated. If all `if` and `else if` conditions evaluate to
3151
3145
3152
3146
A ` match ` expression branches on a * pattern* . The exact form of matching that
3153
3147
occurs depends on the pattern. Patterns consist of some combination of
3154
- literals, destructured arrays or enum constructors, structs and tuples,
3148
+ literals, destructured arrays or enum constructors, structures and tuples,
3155
3149
variable binding specifications, wildcards (` .. ` ), and placeholders (` _ ` ). A
3156
3150
` match ` expression has a * head expression* , which is the value to compare to
3157
3151
the patterns. The type of the patterns must equal the type of the head
@@ -3475,7 +3469,7 @@ named reference to an [`enum` item](#enumerations).
3475
3469
### Recursive types
3476
3470
3477
3471
Nominal types &mdash ; [ enumerations] ( #enumerated-types ) and
3478
- [ structs ] ( #structure-types ) &mdash ; may be recursive. That is, each ` enum `
3472
+ [ structures ] ( #structure-types ) &mdash ; may be recursive. That is, each ` enum `
3479
3473
constructor or ` struct ` field may refer, directly or indirectly, to the
3480
3474
enclosing ` enum ` or ` struct ` type itself. Such recursion has restrictions:
3481
3475
@@ -3503,7 +3497,7 @@ let a: List<i32> = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
3503
3497
### Pointer types
3504
3498
3505
3499
All pointers in Rust are explicit first-class values. They can be copied,
3506
- stored into data structs , and returned from functions. There are two
3500
+ stored into data structures , and returned from functions. There are two
3507
3501
varieties of pointer in Rust:
3508
3502
3509
3503
* References (` & ` )
@@ -3903,7 +3897,7 @@ references to boxes are dropped.
3903
3897
### Variables
3904
3898
3905
3899
A _ variable_ is a component of a stack frame, either a named function parameter,
3906
- an anonymous [ temporary] ( #lvalues-rvalues-and-temporaries ) , or a named local
3900
+ an anonymous [ temporary] ( #lvalues, -rvalues-and-temporaries ) , or a named local
3907
3901
variable.
3908
3902
3909
3903
A _ local variable_ (or * stack-local* allocation) holds a value directly,
@@ -4042,6 +4036,10 @@ In general, `--crate-type=bin` or `--crate-type=lib` should be sufficient for
4042
4036
all compilation needs, and the other options are just available if more
4043
4037
fine-grained control is desired over the output format of a Rust crate.
4044
4038
4039
+ # Appendix: Rationales and design trade-offs
4040
+
4041
+ * TODO* .
4042
+
4045
4043
# Appendix: Influences
4046
4044
4047
4045
Rust is not a particularly original language, with design elements coming from
0 commit comments