diff options
| author | tvallotton <57121854+tvallotton@users.noreply.github.com> | 2024-01-13 10:44:01 -0300 |
|---|---|---|
| committer | Tomás Vallotton <tvallotton@uc.cl> | 2024-01-20 10:14:25 -0300 |
| commit | c67a446e72764663892606b131ed35c6e32e7133 (patch) | |
| tree | 80b40f770b38f976b150a1c120b88989e6065466 | |
| parent | a8e71f225817d11acd9ba63721d539fb998ef319 (diff) | |
| download | rust-c67a446e72764663892606b131ed35c6e32e7133.tar.gz rust-c67a446e72764663892606b131ed35c6e32e7133.zip | |
fix: Apply suggestions from code review
Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
| -rw-r--r-- | library/alloc/src/task.rs | 6 | ||||
| -rw-r--r-- | library/core/src/task/wake.rs | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/library/alloc/src/task.rs b/library/alloc/src/task.rs index 611468a9fea..7dad2f3f822 100644 --- a/library/alloc/src/task.rs +++ b/library/alloc/src/task.rs @@ -168,14 +168,14 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker { /// to hold data that does not implement `Send` and `Sync`. Additionally, it saves calls /// to `Arc::clone`, which requires atomic synchronization. /// - +/// /// # Examples /// /// This is a simplified example of a `spawn` and a `block_on` function. The `spawn` function /// is used to push new tasks onto the run queue, while the block on function will remove them /// and poll them. When a task is woken, it will put itself back on the run queue to be polled by the executor. /// -/// **Note:** A real world example would interlieve poll calls with calls to an io reactor to wait for events instead +/// **Note:** A real world example would interleave poll calls with calls to an io reactor to wait for events instead /// of spinning on a loop. /// /// ```rust @@ -221,7 +221,7 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker { /// { /// spawn(future); /// loop { -/// let Some(task) = RUN_QUEUE.with_borrow_mut(|queue|queue.pop_front()) else { +/// let Some(task) = RUN_QUEUE.with_borrow_mut(|queue| queue.pop_front()) else { /// // we exit, since there are no more tasks remaining on the queue /// return; /// }; diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 3fa49d1ea06..da34e070e29 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -332,7 +332,6 @@ impl<'a> ContextBuilder<'a> { } /// This field is used to set the value of the waker on `Context`. - #[inline] #[rustc_const_unstable(feature = "const_waker", issue = "102012")] #[unstable(feature = "local_waker", issue = "118959")] @@ -598,6 +597,7 @@ impl fmt::Debug for Waker { } /// A `LocalWaker` is analogous to a [`Waker`], but it does not implement [`Send`] or [`Sync`]. +/// /// This handle encapsulates a [`RawWaker`] instance, which defines the /// executor-specific wakeup behavior. /// @@ -646,9 +646,8 @@ impl fmt::Debug for Waker { /// [`Future::poll()`]: core::future::Future::poll /// [`Poll::Pending`]: core::task::Poll::Pending /// [`local_waker`]: core::task::Context::local_waker - #[unstable(feature = "local_waker", issue = "118959")] -#[repr(transparent)] +#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401 pub struct LocalWaker { waker: RawWaker, } |
