@@ -2541,7 +2541,7 @@ A temporary's lifetime equals the largest lifetime of any reference that points
2541
2541
#### Moved and copied types
2542
2542
2543
2543
When a [ local variable] ( #memory-slots ) is used
2544
- as an [ rvalue] ( #lvalues-rvalues-and-temporaries )
2544
+ as an [ rvalue] ( #lvalues, -rvalues-and-temporaries )
2545
2545
the variable will either be moved or copied, depending on its type.
2546
2546
For types that contain [ owning pointers] ( #pointer-types )
2547
2547
or values that implement the special trait ` Drop ` ,
@@ -2564,7 +2564,7 @@ string, boolean value, or the unit value.
2564
2564
### Path expressions
2565
2565
2566
2566
A [ path] ( #paths ) used as an expression context denotes either a local variable or an item.
2567
- Path expressions are [ lvalues] ( #lvalues-rvalues-and-temporaries ) .
2567
+ Path expressions are [ lvalues] ( #lvalues, -rvalues-and-temporaries ) .
2568
2568
2569
2569
### Tuple expressions
2570
2570
@@ -2677,7 +2677,7 @@ foo().x;
2677
2677
(Struct {a: 10, b: 20}).a;
2678
2678
~~~~
2679
2679
2680
- A field access is an [ lvalue] ( #lvalues-rvalues-and-temporaries ) referring to the value of that field.
2680
+ A field access is an [ lvalue] ( #lvalues, -rvalues-and-temporaries ) referring to the value of that field.
2681
2681
When the type providing the field inherits mutabilty, it can be [ assigned] ( #assignment-expressions ) to.
2682
2682
2683
2683
Also, if the type of the expression to the left of the dot is a pointer,
@@ -2713,7 +2713,7 @@ idx_expr : expr '[' expr ']' ;
2713
2713
2714
2714
[ Vector] ( #vector-types ) -typed expressions can be indexed by writing a
2715
2715
square-bracket-enclosed expression (the index) after them. When the
2716
- vector is mutable, the resulting [ lvalue] ( #lvalues-rvalues-and-temporaries ) can be assigned to.
2716
+ vector is mutable, the resulting [ lvalue] ( #lvalues, -rvalues-and-temporaries ) can be assigned to.
2717
2717
2718
2718
Indices are zero-based, and may be of any integral type. Vector access
2719
2719
is bounds-checked at run-time. When the check fails, it will put the
@@ -2739,7 +2739,7 @@ before the expression they apply to.
2739
2739
: Negation. May only be applied to numeric types.
2740
2740
* ` * `
2741
2741
: Dereference. When applied to a [ pointer] ( #pointer-types ) it denotes the pointed-to location.
2742
- For pointers to mutable locations, the resulting [ lvalue] ( #lvalues-rvalues-and-temporaries ) can be assigned to.
2742
+ For pointers to mutable locations, the resulting [ lvalue] ( #lvalues, -rvalues-and-temporaries ) can be assigned to.
2743
2743
On non-pointer types, it calls the ` deref ` method of the ` std::ops::Deref ` trait, or the
2744
2744
` deref_mut ` method of the ` std::ops::DerefMut ` trait (if implemented by the type and required
2745
2745
for an outer expression that will or could mutate the dereference), and produces the
@@ -2874,8 +2874,8 @@ fn avg(v: &[f64]) -> f64 {
2874
2874
2875
2875
#### Assignment expressions
2876
2876
2877
- An _ assignment expression_ consists of an [ lvalue] ( #lvalues-rvalues-and-temporaries ) expression followed by an
2878
- equals sign (` = ` ) and an [ rvalue] ( #lvalues-rvalues-and-temporaries ) expression.
2877
+ An _ assignment expression_ consists of an [ lvalue] ( #lvalues, -rvalues-and-temporaries ) expression followed by an
2878
+ equals sign (` = ` ) and an [ rvalue] ( #lvalues, -rvalues-and-temporaries ) expression.
2879
2879
2880
2880
Evaluating an assignment expression [ either copies or moves] ( #moved-and-copied-types ) its right-hand operand to its left-hand operand.
2881
2881
@@ -3188,7 +3188,7 @@ fn main() {
3188
3188
~~~~
3189
3189
3190
3190
A ` match ` behaves differently depending on whether or not the head expression
3191
- is an [ lvalue or an rvalue] ( #lvalues-rvalues-and-temporaries ) .
3191
+ is an [ lvalue or an rvalue] ( #lvalues, -rvalues-and-temporaries ) .
3192
3192
If the head expression is an rvalue, it is
3193
3193
first evaluated into a temporary location, and the resulting value
3194
3194
is sequentially compared to the patterns in the arms until a match
@@ -3552,7 +3552,7 @@ There are four varieties of pointer in Rust:
3552
3552
: These point to memory _ owned by some other value_ .
3553
3553
References arise by (automatic) conversion from owning pointers, managed pointers,
3554
3554
or by applying the borrowing operator ` & ` to some other value,
3555
- including [ lvalues, rvalues or temporaries] ( #lvalues-rvalues-and-temporaries ) .
3555
+ including [ lvalues, rvalues or temporaries] ( #lvalues, -rvalues-and-temporaries ) .
3556
3556
References are written ` &content ` , or in some cases ` &'f content ` for some lifetime-variable ` f ` ,
3557
3557
for example ` &int ` means a reference to an integer.
3558
3558
Copying a reference is a "shallow" operation:
@@ -3854,7 +3854,7 @@ references to any boxes; the remainder of its heap is immediately freed.
3854
3854
A task's stack contains slots.
3855
3855
3856
3856
A _ slot_ is a component of a stack frame, either a function parameter,
3857
- a [ temporary] ( #lvalues-rvalues-and-temporaries ) , or a local variable.
3857
+ a [ temporary] ( #lvalues, -rvalues-and-temporaries ) , or a local variable.
3858
3858
3859
3859
A _ local variable_ (or * stack-local* allocation) holds a value directly,
3860
3860
allocated within the stack's memory. The value is a part of the stack frame.
0 commit comments