Skip to content

Commit 3b196fb

Browse files
committed
Updating Wake example to use new 'pin!' macro
1 parent 91b61a4 commit 3b196fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/alloc/src/task.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ use crate::sync::Arc;
3939
/// use std::sync::Arc;
4040
/// use std::task::{Context, Poll, Wake};
4141
/// use std::thread::{self, Thread};
42+
/// use core::pin::pin;
4243
///
4344
/// /// A waker that wakes up the current thread when called.
4445
/// struct ThreadWaker(Thread);
@@ -52,7 +53,7 @@ use crate::sync::Arc;
5253
/// /// Run a future to completion on the current thread.
5354
/// fn block_on<T>(fut: impl Future<Output = T>) -> T {
5455
/// // Pin the future so it can be polled.
55-
/// let mut fut = Box::pin(fut);
56+
/// let mut fut = pin!(fut);
5657
///
5758
/// // Create a new context to be passed to the future.
5859
/// let t = thread::current();

0 commit comments

Comments
 (0)