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