sync: update broadcast docs on allocation failure (#7352)

This commit is contained in:
Alice Ryhl
2025-05-24 16:10:13 +02:00
committed by GitHub
parent 7ec77a0677
commit d7d4f7d08b
+4 -2
View File
@@ -500,8 +500,10 @@ const MAX_RECEIVERS: usize = usize::MAX >> 2;
///
/// # Panics
///
/// This will panic if `capacity` is equal to `0` or larger
/// than `usize::MAX / 2`.
/// This will panic if `capacity` is equal to `0`.
///
/// This pre-allocates space for `capacity` messages. Allocation failure may result in a panic or
/// [an allocation failure](std::alloc::handle_alloc_error).
#[track_caller]
pub fn channel<T: Clone>(capacity: usize) -> (Sender<T>, Receiver<T>) {
// SAFETY: In the line below we are creating one extra receiver, so there will be 1 in total.