File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,8 @@ expression which is one of the following:
435435 expression.
436436* The arguments to an extending [ tuple struct] or [ tuple variant] constructor expression.
437437* The final expression of any extending [ block expression] .
438+ * The arm(s) of an extending [ ` match ` ] expression.
439+ * The final expressions of an extending [ ` if ` ] expression's consequent, ` else if ` , and ` else ` blocks.
438440
439441So the borrow expressions in ` &mut 0 ` , ` (&1, &mut 2) ` , and ` Some(&mut 3) `
440442are all extending expressions. The borrows in ` &0 + &1 ` and ` f(&mut 0) ` are not.
@@ -458,6 +460,10 @@ let x = (&*&temp(),);
458460# x ;
459461let x = { [Some (& temp ()) ] };
460462# x ;
463+ let x = match () { _ => & temp () };
464+ # x ;
465+ let x = if true { & temp () } else { & temp () };
466+ # x ;
461467let ref x = temp ();
462468# x ;
463469let ref x = * & temp ();
@@ -477,6 +483,8 @@ let x = std::convert::identity(&temp()); // ERROR
477483# x;
478484let x = (&temp()).use_temp(); // ERROR
479485# x;
486+ let x = match &temp() { x => x }; // ERROR
487+ # x;
480488```
481489
482490r[ destructors.forget]
You can’t perform that action at this time.
0 commit comments