Skip to content

Commit

Permalink
docs: Clarify safety docs for spawn_unchecked
Browse files Browse the repository at this point in the history
* docs(safety): Clarify safety requirements for spawn_unchecked

* docs(safety): Clarify free spawn_unchecked function safety reqs
  • Loading branch information
khoover authored Aug 3, 2023
1 parent d598dc8 commit 182c4dd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/runnable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,13 @@ impl<M> Builder<M> {
///
/// # Safety
///
/// - If `future`'s output is not [`Send`], its [`Runnable`] must be used and dropped on the original
/// - If `Fut` is not [`Send`], its [`Runnable`] must be used and dropped on the original
/// thread.
/// - If `future`'s output is not `'static`, borrowed variables must outlive its [`Runnable`].
/// - If `schedule` is not [`Send`] and [`Sync`], the task's [`Waker`] must be used and dropped on
/// the original thread.
/// - If `schedule` is not `'static`, borrowed variables must outlive the task's [`Waker`].
/// - If `Fut` is not `'static`, borrowed non-metadata variables must outlive its [`Runnable`].
/// - If `schedule` is not [`Send`] and [`Sync`], all instances of the [`Runnable`]'s [`Waker`]
/// must be used and dropped on the original thread.
/// - If `schedule` is not `'static`, borrowed variables must outlive all instances of the
/// [`Runnable`]'s [`Waker`].
///
/// # Examples
///
Expand Down Expand Up @@ -627,9 +628,10 @@ where
/// - If `future` is not [`Send`], its [`Runnable`] must be used and dropped on the original
/// thread.
/// - If `future` is not `'static`, borrowed variables must outlive its [`Runnable`].
/// - If `schedule` is not [`Send`] and [`Sync`], the task's [`Waker`] must be used and dropped on
/// the original thread.
/// - If `schedule` is not `'static`, borrowed variables must outlive the task's [`Waker`].
/// - If `schedule` is not [`Send`] and [`Sync`], all instances of the [`Runnable`]'s [`Waker`]
/// must be used and dropped on the original thread.
/// - If `schedule` is not `'static`, borrowed variables must outlive all instances of the
/// [`Runnable`]'s [`Waker`].
///
/// # Examples
///
Expand Down

0 comments on commit 182c4dd

Please sign in to comment.