Skip to content

Commit 467def3

Browse files
committed
Update examples.
1 parent cd8119a commit 467def3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/destructors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ Here are some examples where expressions have extended temporary scopes:
395395
let x = &temp();
396396
let x = &temp() as &dyn Send;
397397
let x = (&*&temp(),);
398-
let x = { [Some { 0: &temp(), }] };
398+
let x = { [Some(&temp()) ] };
399399
let ref x = temp();
400400
let ref x = *&temp();
401401
# x;
@@ -410,7 +410,7 @@ Here are some examples where expressions don't have extended temporary scopes:
410410
// The temporary that stores the result of `temp()` only lives until the
411411
// end of the let statement in these cases.
412412
413-
let x = Some(&temp()); // ERROR
413+
let x = std::convert::identity(&temp()); // ERROR
414414
let x = (&temp()).use_temp(); // ERROR
415415
# x;
416416
```

0 commit comments

Comments
 (0)