-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit 21bdfa1
Ensure consistent drop for hint::select_unpredictable
There are a few alternatives to the implementation. The principal
problem is that the selected value must be owned (in the sense of having
any drop flag of sorts) when the unselected value is dropped, such that
panic unwind goes through the drop of both. This ownership must then be
passed on in return when the drop went smoothly. The basic way of
achieving this is by extracting the selected value first, at the cost of
relying on the optimizer a little more for detecting the copy as
constructing the return value despite having a place in the body.1 parent ca77504 commit 21bdfa1
2 files changed
+42
-1
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
790 | 790 |
| |
791 | 791 |
| |
792 | 792 |
| |
793 | + | ||
794 | + | ||
795 | + | ||
796 | + | ||
793 | 797 |
| |
794 | 798 |
| |
795 | - | ||
799 | + | ||
796 | 800 |
| |
797 | 801 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + |
0 commit comments