diff options
| author | Mads Ravn <madsravn@gmail.com> | 2023-04-25 13:50:50 +0200 |
|---|---|---|
| committer | Mads Ravn <madsravn@gmail.com> | 2023-04-25 13:50:50 +0200 |
| commit | 3b196fb391ea9c869a798005e0fd7c84214518f4 (patch) | |
| tree | dba7553a024c0a9a2bc8019d4a5256274b7a25ce | |
| parent | 91b61a4ad618c1abc2af43a58695de185ef1e513 (diff) | |
| download | rust-3b196fb391ea9c869a798005e0fd7c84214518f4.tar.gz rust-3b196fb391ea9c869a798005e0fd7c84214518f4.zip | |
Updating Wake example to use new 'pin!' macro
| -rw-r--r-- | library/alloc/src/task.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/alloc/src/task.rs b/library/alloc/src/task.rs index 9d8e309a978..5d9772b878b 100644 --- a/library/alloc/src/task.rs +++ b/library/alloc/src/task.rs @@ -39,6 +39,7 @@ use crate::sync::Arc; /// use std::sync::Arc; /// use std::task::{Context, Poll, Wake}; /// use std::thread::{self, Thread}; +/// use core::pin::pin; /// /// /// A waker that wakes up the current thread when called. /// struct ThreadWaker(Thread); @@ -52,7 +53,7 @@ use crate::sync::Arc; /// /// Run a future to completion on the current thread. /// fn block_on<T>(fut: impl Future<Output = T>) -> T { /// // Pin the future so it can be polled. -/// let mut fut = Box::pin(fut); +/// let mut fut = pin!(fut); /// /// // Create a new context to be passed to the future. /// let t = thread::current(); |
