Skip to content

Commit ea37fad

Browse files
committed
reference: 'struct' is more common that 'structure'
Shoud have been part of commit 0b13ee0
1 parent ec4362d commit ea37fad

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

src/doc/reference.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ let p: Point = (41, 68);
10731073

10741074
### Structs
10751075

1076-
A _structure_ is a nominal [structure type](#structure-types) defined with the
1076+
A _struct_ is a nominal [struct type](#struct-types) defined with the
10771077
keyword `struct`.
10781078

10791079
An example of a `struct` item and its use:
@@ -1084,7 +1084,7 @@ let p = Point {x: 10, y: 11};
10841084
let px: i32 = p.x;
10851085
```
10861086

1087-
A _tuple structure_ is a nominal [tuple type](#tuple-types), also defined with
1087+
A _tuple struct_ is a nominal [tuple type](#tuple-types), also defined with
10881088
the keyword `struct`. For example:
10891089

10901090
```
@@ -1093,8 +1093,8 @@ let p = Point(10, 11);
10931093
let px: i32 = match p { Point(x, _) => x };
10941094
```
10951095

1096-
A _unit-like struct_ is a structure without any fields, defined by leaving off
1097-
the list of fields entirely. Such a structure implicitly defines a constant of
1096+
A _unit-like struct_ is a struct without any fields, defined by leaving off
1097+
the list of fields entirely. Such a struct implicitly defines a constant of
10981098
its type with the same name. For example:
10991099

11001100
```
@@ -1112,7 +1112,7 @@ const Cookie: Cookie = Cookie {};
11121112
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
11131113
```
11141114

1115-
The precise memory layout of a structure is not specified. One can specify a
1115+
The precise memory layout of a struct is not specified. One can specify a
11161116
particular layout using the [`repr` attribute](#ffi-attributes).
11171117

11181118
### Enumerations
@@ -2401,7 +2401,7 @@ items.
24012401

24022402
An _item declaration statement_ has a syntactic form identical to an
24032403
[item](#items) declaration within a module. Declaring an item — a
2404-
function, enumeration, structure, type, static, trait, implementation or module
2404+
function, enumeration, struct, type, static, trait, implementation or module
24052405
— locally within a statement block is simply a way of restricting its
24062406
scope to a narrow region containing all of its uses; it is otherwise identical
24072407
in meaning to declaring the item outside the statement block.
@@ -2546,26 +2546,26 @@ comma:
25462546
(0); // zero in parentheses
25472547
```
25482548

2549-
### Structure expressions
2549+
### Struct expressions
25502550

2551-
There are several forms of structure expressions. A _structure expression_
2552-
consists of the [path](#paths) of a [structure item](#structs), followed by
2551+
There are several forms of struct expressions. A _struct expression_
2552+
consists of the [path](#paths) of a [struct item](#structs), followed by
25532553
a brace-enclosed list of one or more comma-separated name-value pairs,
2554-
providing the field values of a new instance of the structure. A field name
2554+
providing the field values of a new instance of the struct. A field name
25552555
can be any identifier, and is separated from its value expression by a colon.
2556-
The location denoted by a structure field is mutable if and only if the
2557-
enclosing structure is mutable.
2556+
The location denoted by a struct field is mutable if and only if the
2557+
enclosing struct is mutable.
25582558

2559-
A _tuple structure expression_ consists of the [path](#paths) of a [structure
2559+
A _tuple struct expression_ consists of the [path](#paths) of a [struct
25602560
item](#structs), followed by a parenthesized list of one or more
2561-
comma-separated expressions (in other words, the path of a structure item
2562-
followed by a tuple expression). The structure item must be a tuple structure
2561+
comma-separated expressions (in other words, the path of a struct item
2562+
followed by a tuple expression). The struct item must be a tuple struct
25632563
item.
25642564

2565-
A _unit-like structure expression_ consists only of the [path](#paths) of a
2566-
[structure item](#structs).
2565+
A _unit-like struct expression_ consists only of the [path](#paths) of a
2566+
[struct item](#structs).
25672567

2568-
The following are examples of structure expressions:
2568+
The following are examples of struct expressions:
25692569

25702570
```
25712571
# struct Point { x: f64, y: f64 }
@@ -2578,14 +2578,14 @@ let u = game::User {name: "Joe", age: 35, score: 100_000};
25782578
some_fn::<Cookie>(Cookie);
25792579
```
25802580

2581-
A structure expression forms a new value of the named structure type. Note
2582-
that for a given *unit-like* structure type, this will always be the same
2581+
A struct expression forms a new value of the named struct type. Note
2582+
that for a given *unit-like* struct type, this will always be the same
25832583
value.
25842584

2585-
A structure expression can terminate with the syntax `..` followed by an
2585+
A struct expression can terminate with the syntax `..` followed by an
25862586
expression to denote a functional update. The expression following `..` (the
2587-
base) must have the same structure type as the new structure type being formed.
2588-
The entire expression denotes the result of constructing a new structure (with
2587+
base) must have the same struct type as the new struct type being formed.
2588+
The entire expression denotes the result of constructing a new struct (with
25892589
the same type as the base expression) with the given values for the fields that
25902590
were explicitly specified and the values in the base expression for all other
25912591
fields.
@@ -2631,7 +2631,7 @@ the left-hand-side expression is an indirect [trait object](#trait-objects).
26312631
A _field expression_ consists of an expression followed by a single dot and an
26322632
identifier, when not immediately followed by a parenthesized expression-list
26332633
(the latter is a [method call expression](#method-call-expressions)). A field
2634-
expression denotes a field of a [structure](#structure-types).
2634+
expression denotes a field of a [struct](#struct-types).
26352635

26362636
```{.ignore .field}
26372637
mystruct.myfield;
@@ -3350,17 +3350,17 @@ As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The
33503350
All in-bounds elements of arrays and slices are always initialized, and access
33513351
to an array or slice is always bounds-checked.
33523352

3353-
### Structure types
3353+
### Struct types
33543354

33553355
A `struct` *type* is a heterogeneous product of other types, called the
33563356
*fields* of the type.[^structtype]
33573357

33583358
[^structtype]: `struct` types are analogous to `struct` types in C,
33593359
the *record* types of the ML family,
3360-
or the *structure* types of the Lisp family.
3360+
or the *struct* types of the Lisp family.
33613361

33623362
New instances of a `struct` can be constructed with a [struct
3363-
expression](#structure-expressions).
3363+
expression](#struct-expressions).
33643364

33653365
The memory layout of a `struct` is undefined by default to allow for compiler
33663366
optimizations like field reordering, but it can be fixed with the
@@ -3370,14 +3370,14 @@ have the same memory layout.
33703370

33713371
The fields of a `struct` may be qualified by [visibility
33723372
modifiers](#visibility-and-privacy), to allow access to data in a
3373-
structure outside a module.
3373+
struct outside a module.
33743374

3375-
A _tuple struct_ type is just like a structure type, except that the fields are
3375+
A _tuple struct_ type is just like a struct type, except that the fields are
33763376
anonymous.
33773377

3378-
A _unit-like struct_ type is like a structure type, except that it has no
3379-
fields. The one value constructed by the associated [structure
3380-
expression](#structure-expressions) is the only value that inhabits such a
3378+
A _unit-like struct_ type is like a struct type, except that it has no
3379+
fields. The one value constructed by the associated [struct
3380+
expression](#struct-expressions) is the only value that inhabits such a
33813381
type.
33823382

33833383
### Enumerated types
@@ -3404,7 +3404,7 @@ named reference to an [`enum` item](#enumerations).
34043404
### Recursive types
34053405

34063406
Nominal types &mdash; [enumerations](#enumerated-types) and
3407-
[structs](#structure-types) &mdash; may be recursive. That is, each `enum`
3407+
[structs](#struct-types) &mdash; may be recursive. That is, each `enum`
34083408
constructor or `struct` field may refer, directly or indirectly, to the
34093409
enclosing `enum` or `struct` type itself. Such recursion has restrictions:
34103410

0 commit comments

Comments
 (0)