@@ -383,11 +383,11 @@ expression which is one of the following:
383
383
* The operand(s) of an extending [ array] [ array expression ] , [ cast] [ cast
384
384
expression] , [ braced struct] [ struct expression ] , or [ tuple] [ tuple expression ]
385
385
expression.
386
+ * The arguments to an extending [ tuple struct] or [ tuple variant] constructor expression.
386
387
* The final expression of any extending [ block expression] .
387
388
388
- So the borrow expressions in ` &mut 0 ` , ` (&1, &mut 2) ` , and ` Some { 0: &mut 3 } `
389
- are all extending expressions. The borrows in ` &0 + &1 ` and ` Some(&mut 0) ` are
390
- not: the latter is syntactically a function call expression.
389
+ So the borrow expressions in ` &mut 0 ` , ` (&1, &mut 2) ` , and ` Some(&mut 3) `
390
+ are all extending expressions. The borrows in ` &0 + &1 ` and ` f(&mut 0) ` are not.
391
391
392
392
The operand of any extending borrow expression has its temporary scope
393
393
extended.
@@ -405,7 +405,7 @@ Here are some examples where expressions have extended temporary scopes:
405
405
let x = & temp ();
406
406
let x = & temp () as & dyn Send ;
407
407
let x = (& * & temp (),);
408
- let x = { [Some { 0 : & temp (), } ] };
408
+ let x = { [Some ( & temp ()) ] };
409
409
let ref x = temp ();
410
410
let ref x = * & temp ();
411
411
# x ;
@@ -420,7 +420,7 @@ Here are some examples where expressions don't have extended temporary scopes:
420
420
// The temporary that stores the result of `temp()` only lives until the
421
421
// end of the let statement in these cases.
422
422
423
- let x = Some (&temp()); // ERROR
423
+ let x = std::convert::identity (&temp()); // ERROR
424
424
let x = (&temp()).use_temp(); // ERROR
425
425
# x;
426
426
```
@@ -477,6 +477,8 @@ There is one additional case to be aware of: when a panic reaches a [non-unwindi
477
477
[ struct pattern ] : patterns.md#struct-patterns
478
478
[ tuple pattern ] : patterns.md#tuple-patterns
479
479
[ tuple struct pattern ] : patterns.md#tuple-struct-patterns
480
+ [ tuple struct ] : type.struct.tuple
481
+ [ tuple variant ] : type.enum.declaration
480
482
481
483
[ array expression ] : expressions/array-expr.md#array-expressions
482
484
[ block expression ] : expressions/block-expr.md
0 commit comments