File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 6c2c6947256db3841ceb3253ebace259a72dd917
2
+ refs/heads/master: cb4c747e9f6b51f8e44caab27ca376b59df3a56d
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5
5
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
Original file line number Diff line number Diff line change @@ -1468,6 +1468,25 @@ structure of expressions. Blocks themselves are expressions, so the nesting
1468
1468
sequence of block, statement, expression, and block can repeatedly nest to an
1469
1469
arbitrary depth.
1470
1470
1471
+ #### Lvalues, rvalues and temporaries
1472
+
1473
+ Expressions are divided into two main categories: _ lvalues_ and _ rvalues_ .
1474
+ Likewise within each expression, sub-expressions may occur in _ lvalue context_ or _ rvalue context_ .
1475
+ The evaluation of an expression depends both on its own category and the context it occurs within.
1476
+
1477
+ Path, field and index expressions are lvalues.
1478
+ All other expressions are rvalues.
1479
+
1480
+ The left operand of an assignment expression and the operand of the borrow operator are lvalue contexts.
1481
+ All other expression contexts are rvalue contexts.
1482
+
1483
+ When an lvalue is evaluated in an _ lvalue context_ , it denotes a memory location;
1484
+ when evaluated in an _ rvalue context_ , it denotes the value held _ in_ that memory location.
1485
+
1486
+ When an rvalue is used in lvalue context, a temporary un-named lvalue is created and used instead.
1487
+ A temporary's lifetime equals the largest lifetime of any borrowed pointer that points to it.
1488
+
1489
+
1471
1490
### Literal expressions
1472
1491
1473
1492
A _ literal expression_ consists of one of the [ literal] ( #literals )
You can’t perform that action at this time.
0 commit comments