Commit 64c5354
authored
Rollup merge of rust-lang#74304 - yoshuawuyts:stabilize-wake, r=KodrAus
Stabilize the Wake trait
This PR proposes stabilizing the `wake_trait` feature, tracking issue rust-lang#69912.
## Motivation
The surface area this trait introduces is small, and it has been on nightly for 4 months without any reported issues. Given the surface area of this trait is small and only serves to provide a safe interface around the already stable [`std::task::RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWaker.html) it seems unlikely this trait will require any further changes. So I'm proposing we stabilize this.
Personally I would love to have this available on stable, since it would enable cleaning up some runtime internals by removing the tedious pointer required to construct a [`RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWakerVTable.html). I believe the intent was always to introduce a `Wake` counterpart to `RawWaker` in order to safely construct `Waker` instances. And the `Wake` trait feels like it does that job as intended.
## Implementation notes
This PR itself fixes a link in the docs, and introduces an example of how to use the trait: a minimal `block_on` example that runs a future to completion on the current thread. It doesn't include fancier features such as support for nesting, but is intended to serve as a teaching device for both `task::Wake` and futures alike.File tree
3 files changed
+60
-10
lines changed- library
- alloc/src
- std/src
- src/test/ui/async-await
3 files changed
+60
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 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 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
20 | 70 | | |
21 | 71 | | |
22 | | - | |
| 72 | + | |
23 | 73 | | |
24 | 74 | | |
25 | 75 | | |
26 | 76 | | |
27 | 77 | | |
28 | 78 | | |
29 | | - | |
30 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
31 | 83 | | |
32 | 84 | | |
33 | 85 | | |
34 | 86 | | |
35 | 87 | | |
36 | 88 | | |
37 | 89 | | |
38 | | - | |
| 90 | + | |
39 | 91 | | |
40 | 92 | | |
41 | 93 | | |
| |||
46 | 98 | | |
47 | 99 | | |
48 | 100 | | |
49 | | - | |
| 101 | + | |
50 | 102 | | |
51 | 103 | | |
52 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | 332 | | |
334 | 333 | | |
335 | 334 | | |
| |||
508 | 507 | | |
509 | 508 | | |
510 | 509 | | |
511 | | - | |
| 510 | + | |
512 | 511 | | |
513 | 512 | | |
514 | 513 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
0 commit comments