From 41bbadd9c295365eabe7e15d88f09c897b690277 Mon Sep 17 00:00:00 2001 From: Ken Hoover Date: Wed, 2 Aug 2023 14:13:11 -0700 Subject: [PATCH 1/2] docs(safety): Clarify safety requirements for spawn_unchecked --- src/runnable.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runnable.rs b/src/runnable.rs index e495d53..e80f803 100644 --- a/src/runnable.rs +++ b/src/runnable.rs @@ -476,12 +476,12 @@ impl Builder { /// /// # 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 + /// - 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 the task's [`Waker`]. + /// - If `schedule` is not `'static`, borrowed variables must outlive all instances of the [`Runnable`]'s [`Waker`]. /// /// # Examples /// From f66e8e56d7c46a982f70f13ef6fe72b5c09fd457 Mon Sep 17 00:00:00 2001 From: Ken Hoover Date: Wed, 2 Aug 2023 14:21:55 -0700 Subject: [PATCH 2/2] docs(safety): Clarify free spawn_unchecked function safety reqs --- src/runnable.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/runnable.rs b/src/runnable.rs index e80f803..8b1b062 100644 --- a/src/runnable.rs +++ b/src/runnable.rs @@ -479,9 +479,10 @@ impl Builder { /// - If `Fut` is not [`Send`], its [`Runnable`] must be used and dropped on the original /// thread. /// - 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`]. + /// - 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 ///