docs: Clarify safety docs for `spawn_unchecked`

* docs(safety): Clarify safety requirements for spawn_unchecked

* docs(safety): Clarify free spawn_unchecked function safety reqs
This commit is contained in:
Ken Hoover 2023-08-02 17:35:11 -07:00 committed by GitHub
parent d598dc8026
commit 182c4ddfe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -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
///
@ -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
///