File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -448,15 +448,18 @@ Here are some examples where expressions have extended temporary scopes:
448448
449449``` rust
450450# fn temp () {}
451- # trait Use { fn use_temp (& self ) -> & Self { self } }
452- # impl Use for () {}
453451// The temporary that stores the result of `temp()` lives in the same scope
454452// as x in these cases.
455453let x = & temp ();
454+ # x ;
456455let x = & temp () as & dyn Send ;
456+ # x ;
457457let x = (& * & temp (),);
458+ # x ;
458459let x = { [Some (& temp ()) ] };
460+ # x ;
459461let ref x = temp ();
462+ # x ;
460463let ref x = * & temp ();
461464# x ;
462465```
@@ -471,6 +474,7 @@ Here are some examples where expressions don't have extended temporary scopes:
471474// end of the let statement in these cases.
472475
473476let x = std::convert::identity(&temp()); // ERROR
477+ # x;
474478let x = (&temp()).use_temp(); // ERROR
475479# x;
476480```
You can’t perform that action at this time.
0 commit comments