@@ -72,13 +72,13 @@ The following expressions can create mutable lvalues:
72
72
* [ Temporary values] ( #temporary-lifetimes ) .
73
73
* [ Fields] ( #field-expressions ) , this evaluates the subexpression in a mutable
74
74
lvalue context.
75
- * [ Dereferenes ] ( #the-dereference-operator ) of a ` *mut T ` pointer.
75
+ * [ Dereferences ] ( #the-dereference-operator ) of a ` *mut T ` pointer.
76
76
* Dereference of a variable, or field of a variable, with type ` &mut T ` . Note:
77
77
this is an exception to the requirement for the next rule.
78
78
* Dereferences of a type that implements ` DerefMut ` , this then requires that
79
79
the value being dereferenced is evaluated is a mutable lvalue context.
80
80
* [ Indexing] ( #index-expressions ) of a type that implements ` DerefMut ` , this
81
- then evalutes the value being indexed (but not the index) in mutable lvalue
81
+ then evaluates the value being indexed (but not the index) in mutable lvalue
82
82
context.
83
83
84
84
### Temporary lifetimes
@@ -168,7 +168,7 @@ also constant expressions:
168
168
* [ Paths] ( #path-expressions ) to [ functions] ( items.html#functions ) and constants.
169
169
Recursively defining constants is not allowed.
170
170
* Paths to statics, so long as only their address, not their value, is used.
171
- This includes using their value indirectly through a compilicated expression.
171
+ This includes using their value indirectly through a complicated expression.
172
172
\*
173
173
* [ Tuple expressions] ( #tuple-expressions ) .
174
174
* [ Array expressions] ( #array-expressions ) .
@@ -267,7 +267,9 @@ the field values of a new instance of the struct. A field name can be any
267
267
[ identifier] ( identifiers.html ) , and is separated from its value expression by a
268
268
colon. In the case of a tuple struct the field names are numbers corresponding
269
269
to the position of the field. The numbers must be written in decimal,
270
- containing no underscores and with no leading zeros or integer suffix.
270
+ containing no underscores and with no leading zeros or integer suffix. A value
271
+ of a [ union] ( items.html#unions ) type can also be created using this syntax,
272
+ except that it must specify exactly one field.
271
273
272
274
Struct expressions can't be used directly in the head of a [ loop] ( #loops ) or an
273
275
[ ` if ` ] ( #if-expressions ) , [ ` if let ` ] ( #if-let-expressions ) or
@@ -441,8 +443,8 @@ A _field expression_ consists of an expression followed by a single dot and an
441
443
[ identifier] ( identifiers.html ) , when not immediately followed by a
442
444
parenthesized expression-list (the latter is always a [ method call
443
445
expression] ( #method-call-expressions ) ). A field expression denotes a field of a
444
- [ struct] ( types.html#struct-types ) . To call a function stored in a struct
445
- parentheses are needed around the field expression
446
+ [ struct] ( types.html#struct-types ) or [ union ] ( items.html#unions ) . To call a
447
+ function stored in a struct parentheses are needed around the field expression
446
448
447
449
``` rust,ignore
448
450
mystruct.myfield;
@@ -452,9 +454,9 @@ mystruct.method(); // Method expression
452
454
(mystruct.function_field)() // Call expression containing a field expression
453
455
```
454
456
455
- A field access is an [ lvalue] ( expressions.html#lvalues-and-rvalues ) referring to the value of
456
- that field. When the subexpression is [ mutable ] ( #mutability ) , the field
457
- expression is also mutable.
457
+ A field access is an [ lvalue] ( expressions.html#lvalues-and-rvalues ) referring
458
+ to the location of that field. When the subexpression is
459
+ [ mutable ] ( #mutability ) , the field expression is also mutable.
458
460
459
461
Also, if the type of the expression to the left of the dot is a pointer, it is
460
462
automatically dereferenced as many times as necessary to make the field access
@@ -482,7 +484,7 @@ let d: String = x.f3; // Move out of x.f3
482
484
### Tuple indexing expressions
483
485
484
486
[ Tuples] ( types.html#tuple-types ) and [ struct tuples] ( items.html#structs ) can be
485
- indexed using the number corresponding to the possition of the field. The index
487
+ indexed using the number corresponding to the position of the field. The index
486
488
must be written as a [ decimal literal] ( tokens.html#integer-literals ) with no
487
489
underscores or suffix. Tuple indexing expressions also differ from field
488
490
expressions in that they can unambiguously be called as a function. In all
0 commit comments