From 938b7d6742995ca516193e393d09b1700a030786 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sat, 7 May 2022 22:32:29 +0200 Subject: [PATCH] util: improve `impl Send for ReusableBoxFuture` docs (#4658) --- tokio-util/src/sync/reusable_box.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tokio-util/src/sync/reusable_box.rs b/tokio-util/src/sync/reusable_box.rs index 3204207db..0c6940526 100644 --- a/tokio-util/src/sync/reusable_box.rs +++ b/tokio-util/src/sync/reusable_box.rs @@ -122,7 +122,12 @@ impl Future for ReusableBoxFuture<'_, T> { } } -// The future stored inside ReusableBoxFuture<'_, T> must be Send. +// The future stored inside ReusableBoxFuture<'_, T> must be Send since the +// `new` and `set` and `try_set` methods only allow setting the future to Send +// futures. +// +// Note that T is the return type of the future, so its not relevant for +// whether the future itself is Send. unsafe impl Send for ReusableBoxFuture<'_, T> {} // The only method called on self.boxed is poll, which takes &mut self, so this