From 35470bfc6e43dac2715009cc1adc0931944cf3b5 Mon Sep 17 00:00:00 2001 From: Xinye Tao Date: Wed, 1 Oct 2025 16:38:04 +0800 Subject: [PATCH] sync: clarify bounded channel panic behavior (#7641) Signed-off-by: Xinye Tao Co-authored-by: Xinye Tao --- tokio/src/sync/mpsc/bounded.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index 2bbffcecb..4fc300ca4 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -127,7 +127,10 @@ pub struct Receiver { /// /// # Panics /// -/// Panics if the buffer capacity is 0. +/// Panics if the buffer capacity is 0, or too large. Currently the maximum +/// capacity is [`Semaphore::MAX_PERMITS`]. +/// +/// [`Semaphore::MAX_PERMITS`]: crate::sync::Semaphore::MAX_PERMITS /// /// # Examples ///