Skip to content

Commit 15b5e49

Browse files
committed
---
yaml --- r: 24462 b: refs/heads/master c: cb4c747 h: refs/heads/master v: v3
1 parent b2b32b7 commit 15b5e49

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6c2c6947256db3841ceb3253ebace259a72dd917
2+
refs/heads/master: cb4c747e9f6b51f8e44caab27ca376b59df3a56d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/doc/rust.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,25 @@ structure of expressions. Blocks themselves are expressions, so the nesting
14681468
sequence of block, statement, expression, and block can repeatedly nest to an
14691469
arbitrary depth.
14701470

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+
14711490
### Literal expressions
14721491

14731492
A _literal expression_ consists of one of the [literal](#literals)

0 commit comments

Comments
 (0)