@@ -49,7 +49,7 @@ the following lvalues may be moved out of:
49
49
* [ Variables] ( variables.html ) which are not currently borrowed.
50
50
* [ Temporary values] ( #temporary-lifetimes ) .
51
51
* [ Fields] ( #field-expressions ) of an lvalue which can be moved out of and
52
- doesn't implement [ ` Drop ` ] ( # the-drop-trait) .
52
+ doesn't implement [ ` Drop ` ] ( the-drop-trait.html ) .
53
53
* The result of [ dereferencing] ( #the-dereference-operator ) an expression with
54
54
type ` Box<T> ` and that can also be moved out of.
55
55
@@ -123,8 +123,8 @@ Here are some examples:
123
123
124
124
Certain expressions will treat an expression as an lvalue by implicitly
125
125
borrowing it. For example, it is possible to compare two unsized
126
- [ slices] ( #array-and-slice-types ) for equality directly, because the ` == `
127
- operator implicitly borrows it's operands:
126
+ [ slices] ( types.html #array-and-slice-types) for equality directly, because the
127
+ ` == ` operator implicitly borrows it's operands:
128
128
129
129
``` rust
130
130
# let c = [1 , 2 , 3 ];
@@ -155,17 +155,17 @@ Certain types of expressions can be evaluated at compile time. These are called
155
155
_ constant expressions_ . Certain places, such as in
156
156
[ constants] ( items.html#constant-items ) and [ statics] ( items.html#static-items ) ,
157
157
require a constant expression, and are always evaluated at compile time. In
158
- other places, such as in [ ` let ` statements] ( let-statements ) , constant
159
- expressions may be evaluated at compile time. If errors, such as out of bounds
160
- [ array access] ( #index-expressions ) or [ overflow] ( #overflow ) occurs, then it is
161
- a compiler error if the value must be evaluated at compile time, otherwise it
162
- is just a warning, but the code will most likely panic when run.
158
+ other places, such as in [ ` let ` statements] ( statements.html# let-statements) ,
159
+ constant expressions may be evaluated at compile time. If errors, such as out
160
+ of bounds [ array access] ( #index-expressions ) or [ overflow] ( #overflow ) occurs,
161
+ then it is a compiler error if the value must be evaluated at compile time,
162
+ otherwise it is just a warning, but the code will most likely panic when run.
163
163
164
164
The following expressions are constant expressions, so long as any operands are
165
165
also constant expressions:
166
166
167
167
* [ Literals] ( #literal-expressions ) .
168
- * [ Paths] ( #paths ) to [ functions] ( items.html#functions ) and constants.
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
171
This includes using their value indirectly through a compilicated expression.
@@ -190,7 +190,7 @@ also constant expressions:
190
190
boolean] ( #lazy-boolean-operators ) operators used on integer and floating
191
191
point types, ` bool ` and ` char ` .
192
192
* Shared [ borrow expressions] ( #borrow-operators ) .
193
- * The [ dereference operator] ( #dereference-operator ) , but not to circumvent the
193
+ * The [ dereference operator] ( #the- dereference-operator ) , but not to circumvent the
194
194
rule on statics.
195
195
* [ Grouped expressions] ( #grouped-expressions ) .
196
196
* [ Cast expressions] ( #type-cast-expressions ) , except pointer to address and
@@ -223,7 +223,7 @@ A [path](paths.html) used as an expression context denotes either a local
223
223
variable or an item. Path expressions that resolve to local or static variables
224
224
are [ lvalues] ( expressions.html#lvalues-and-rvalues ) , other paths
225
225
are rvalues. Using a ` static mut ` variable requires an [ ` unsafe `
226
- block] ( #unsafe-block ) .
226
+ block] ( #unsafe-blocks ) .
227
227
228
228
``` rust
229
229
# mod globals {
@@ -452,17 +452,17 @@ mystruct.method(); // Method expression
452
452
(mystruct.function_field)() // Call expression containing a field expression
453
453
```
454
454
455
- A field access is an [ lvalue] ( expressions.html# lvalues-and-rvalues)
456
- referring to the value of that field. When the subexpression is
457
- [ mutable ] ( #mutability ) , the field expression is also mutable.
455
+ A field access is an [ lvalue] ( lvalues-and-rvalues ) referring to the value of
456
+ that field. When the subexpression is [ mutable ] ( #mutability ) , the field
457
+ expression is also mutable.
458
458
459
459
Also, if the type of the expression to the left of the dot is a pointer, it is
460
460
automatically dereferenced as many times as necessary to make the field access
461
461
possible. In cases of ambiguity, we prefer fewer autoderefs to more.
462
462
463
463
Finally the fields of a struct, a reference to a struct are treated as separate
464
464
entities when borrowing. If the struct does not implement
465
- [ ` Drop ` ] ( # the-drop-trait) this also applies to moving out of each of its fields
465
+ [ ` Drop ` ] ( the-drop-trait.html ) this also applies to moving out of each of its fields
466
466
where possible. This also does not apply if automatic dereferencing is done
467
467
though user defined types.
468
468
0 commit comments