Skip to content

Commit e980129

Browse files
committed
Auto merge of #28634 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28616, #28617, #28618, #28619, #28620, #28622 - Failed merges: #28621
2 parents 355bbfb + c3ca182 commit e980129

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

src/doc/grammar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ provides only one kind of material:
99

1010
This document does not serve as an introduction to the language. Background
1111
familiarity with the language is assumed. A separate [guide] is available to
12-
help acquire such background familiarity.
12+
help acquire such background.
1313

1414
This document also does not serve as a reference to the [standard] library
1515
included in the language distribution. Those libraries are documented

src/doc/reference.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ There are several kinds of item:
674674
* [modules](#modules)
675675
* [functions](#functions)
676676
* [type definitions](grammar.html#type-definitions)
677-
* [structures](#structures)
677+
* [structs](#structs)
678678
* [enumerations](#enumerations)
679679
* [constant items](#constant-items)
680680
* [static items](#static-items)
@@ -900,9 +900,10 @@ fn main() {}
900900

901901
### Functions
902902

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
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
906907
set of *input* [*variables*](#variables) as parameters, through which the caller
907908
passes arguments into the function, and the *output* [*type*](#types)
908909
of the value the function will return to its caller on completion.
@@ -921,7 +922,7 @@ An example of a function:
921922

922923
```
923924
fn add(x: i32, y: i32) -> i32 {
924-
return x + y;
925+
x + y
925926
}
926927
```
927928

@@ -1155,7 +1156,7 @@ type Point = (u8, u8);
11551156
let p: Point = (41, 68);
11561157
```
11571158

1158-
### Structures
1159+
### Structs
11591160

11601161
A _structure_ is a nominal [structure type](#structure-types) defined with the
11611162
keyword `struct`.
@@ -2614,21 +2615,21 @@ comma:
26142615
### Structure expressions
26152616

26162617
There are several forms of structure expressions. A _structure expression_
2617-
consists of the [path](#paths) of a [structure item](#structures), followed by
2618+
consists of the [path](#paths) of a [structure item](#structs), followed by
26182619
a brace-enclosed list of one or more comma-separated name-value pairs,
26192620
providing the field values of a new instance of the structure. A field name
26202621
can be any identifier, and is separated from its value expression by a colon.
26212622
The location denoted by a structure field is mutable if and only if the
26222623
enclosing structure is mutable.
26232624

26242625
A _tuple structure expression_ consists of the [path](#paths) of a [structure
2625-
item](#structures), followed by a parenthesized list of one or more
2626+
item](#structs), followed by a parenthesized list of one or more
26262627
comma-separated expressions (in other words, the path of a structure item
26272628
followed by a tuple expression). The structure item must be a tuple structure
26282629
item.
26292630

26302631
A _unit-like structure expression_ consists only of the [path](#paths) of a
2631-
[structure item](#structures).
2632+
[structure item](#structs).
26322633

26332634
The following are examples of structure expressions:
26342635

@@ -3145,7 +3146,7 @@ if` condition is evaluated. If all `if` and `else if` conditions evaluate to
31453146

31463147
A `match` expression branches on a *pattern*. The exact form of matching that
31473148
occurs depends on the pattern. Patterns consist of some combination of
3148-
literals, destructured arrays or enum constructors, structures and tuples,
3149+
literals, destructured arrays or enum constructors, structs and tuples,
31493150
variable binding specifications, wildcards (`..`), and placeholders (`_`). A
31503151
`match` expression has a *head expression*, which is the value to compare to
31513152
the patterns. The type of the patterns must equal the type of the head
@@ -3469,7 +3470,7 @@ named reference to an [`enum` item](#enumerations).
34693470
### Recursive types
34703471

34713472
Nominal types — [enumerations](#enumerated-types) and
3472-
[structures](#structure-types) — may be recursive. That is, each `enum`
3473+
[structs](#structure-types) — may be recursive. That is, each `enum`
34733474
constructor or `struct` field may refer, directly or indirectly, to the
34743475
enclosing `enum` or `struct` type itself. Such recursion has restrictions:
34753476

@@ -3497,7 +3498,7 @@ let a: List<i32> = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
34973498
### Pointer types
34983499

34993500
All pointers in Rust are explicit first-class values. They can be copied,
3500-
stored into data structures, and returned from functions. There are two
3501+
stored into data structs, and returned from functions. There are two
35013502
varieties of pointer in Rust:
35023503

35033504
* References (`&`)
@@ -3897,7 +3898,7 @@ references to boxes are dropped.
38973898
### Variables
38983899

38993900
A _variable_ is a component of a stack frame, either a named function parameter,
3900-
an anonymous [temporary](#lvalues,-rvalues-and-temporaries), or a named local
3901+
an anonymous [temporary](#lvalues-rvalues-and-temporaries), or a named local
39013902
variable.
39023903

39033904
A _local variable_ (or *stack-local* allocation) holds a value directly,
@@ -4036,10 +4037,6 @@ In general, `--crate-type=bin` or `--crate-type=lib` should be sufficient for
40364037
all compilation needs, and the other options are just available if more
40374038
fine-grained control is desired over the output format of a Rust crate.
40384039

4039-
# Appendix: Rationales and design trade-offs
4040-
4041-
*TODO*.
4042-
40434040
# Appendix: Influences
40444041

40454042
Rust is not a particularly original language, with design elements coming from

0 commit comments

Comments
 (0)