From 2047d370ef6fe414ce6a550a5bd132ae48137d5a Mon Sep 17 00:00:00 2001 From: Rhett Griggs Date: Fri, 31 Jul 2026 15:18:07 -0400 Subject: [PATCH] Bound stream Send impls on the handle's Target, not the handle `StreamProducer`, `StreamConsumer`, `StreamGrantW`, and `StreamGrantR` all store `Q::Target`, but their `Send` impls required `Q: Send`. `BbqHandle` is a public safe trait with an associated `Target`, so a downstream impl can pair a `Send` handle with a `!Send` target and hand back a `Send` producer that holds an `Rc`. `Q: Send` says nothing about `Q::Target`, and nothing else in the crate closes that gap. The producer and consumer hold nothing but `Q::Target`, so they need no manual impl at all; the derived one is already exactly right. The two grants also hold a `NonNull`, so they keep an unsafe impl, now bounded on `Q::Target: Send` the way `FramedGrantW` and `FramedGrantR` already are. --- bbqueue/src/prod_cons/stream.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bbqueue/src/prod_cons/stream.rs b/bbqueue/src/prod_cons/stream.rs index 543afbf..c43459e 100644 --- a/bbqueue/src/prod_cons/stream.rs +++ b/bbqueue/src/prod_cons/stream.rs @@ -151,8 +151,6 @@ where } } -unsafe impl Send for StreamProducer {} - // ---- StreamConsumer ---- impl StreamConsumer @@ -197,8 +195,6 @@ where } } -unsafe impl Send for StreamConsumer {} - // ---- StreamGrantW ---- impl StreamGrantW @@ -260,7 +256,12 @@ where } } -unsafe impl Send for StreamGrantW {} +unsafe impl Send for StreamGrantW +where + Q: BbqHandle, + Q::Target: Send, +{ +} // ---- StreamGrantR ---- @@ -321,4 +322,9 @@ where } } -unsafe impl Send for StreamGrantR {} +unsafe impl Send for StreamGrantR +where + Q: BbqHandle, + Q::Target: Send, +{ +}