From 7d0d729d8f03a0033d6752730d0fb5928962560e Mon Sep 17 00:00:00 2001 From: Phil Phauler <128394598+philphauler@users.noreply.github.com> Date: Sun, 6 Sep 2026 14:20:39 +0200 Subject: [PATCH] sync: clarify panic behavior of `broadcast::channel()` (#8420) Co-authored-by: philphauler --- tokio/src/sync/broadcast.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs index f88972ba6..f2ef64fd8 100644 --- a/tokio/src/sync/broadcast.rs +++ b/tokio/src/sync/broadcast.rs @@ -532,7 +532,7 @@ const MAX_RECEIVERS: usize = usize::MAX >> 2; /// /// # Panics /// -/// This will panic if `capacity` is equal to `0`. +/// This will panic if `capacity` is equal to `0` or exceeds `usize::MAX / 2`. /// /// This pre-allocates space for `capacity` messages. Allocation failure may result in a panic or /// [an allocation error](std::alloc::handle_alloc_error).