Skip to content

Commit 182c4dd

Browse files
authored
docs: Clarify safety docs for spawn_unchecked
* docs(safety): Clarify safety requirements for spawn_unchecked * docs(safety): Clarify free spawn_unchecked function safety reqs
1 parent d598dc8 commit 182c4dd

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/runnable.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,13 @@ impl<M> Builder<M> {
476476
///
477477
/// # Safety
478478
///
479-
/// - If `future`'s output is not [`Send`], its [`Runnable`] must be used and dropped on the original
479+
/// - If `Fut` is not [`Send`], its [`Runnable`] must be used and dropped on the original
480480
/// thread.
481-
/// - If `future`'s output is not `'static`, borrowed variables must outlive its [`Runnable`].
482-
/// - If `schedule` is not [`Send`] and [`Sync`], the task's [`Waker`] must be used and dropped on
483-
/// the original thread.
484-
/// - If `schedule` is not `'static`, borrowed variables must outlive the task's [`Waker`].
481+
/// - If `Fut` is not `'static`, borrowed non-metadata variables must outlive its [`Runnable`].
482+
/// - If `schedule` is not [`Send`] and [`Sync`], all instances of the [`Runnable`]'s [`Waker`]
483+
/// must be used and dropped on the original thread.
484+
/// - If `schedule` is not `'static`, borrowed variables must outlive all instances of the
485+
/// [`Runnable`]'s [`Waker`].
485486
///
486487
/// # Examples
487488
///
@@ -627,9 +628,10 @@ where
627628
/// - If `future` is not [`Send`], its [`Runnable`] must be used and dropped on the original
628629
/// thread.
629630
/// - If `future` is not `'static`, borrowed variables must outlive its [`Runnable`].
630-
/// - If `schedule` is not [`Send`] and [`Sync`], the task's [`Waker`] must be used and dropped on
631-
/// the original thread.
632-
/// - If `schedule` is not `'static`, borrowed variables must outlive the task's [`Waker`].
631+
/// - If `schedule` is not [`Send`] and [`Sync`], all instances of the [`Runnable`]'s [`Waker`]
632+
/// must be used and dropped on the original thread.
633+
/// - If `schedule` is not `'static`, borrowed variables must outlive all instances of the
634+
/// [`Runnable`]'s [`Waker`].
633635
///
634636
/// # Examples
635637
///

0 commit comments

Comments
 (0)