You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In tokio-master/tokio/src/sync/broadcast.rs, this function indicates when 0 < capacity <= usize::MAX / 2, this function will not panic.
/// This will panic if `capacity` is equal to `0` or larger/// than `usize::MAX / 2`.#[track_caller]pubfnchannel<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.let tx = unsafe{Sender::new_with_receiver_count(1, capacity)};
...}
but when capacity == usize::MAX / 2, this test will still panic. Actually, this function will panic when capacity overflows, so I think comment should be changed to "This will panic if capacity is equal to 0 or overflows."
In tokio-master/tokio/src/sync/broadcast.rs, this function indicates when 0 < capacity <= usize::MAX / 2, this function will not panic.
but when capacity == usize::MAX / 2, this test will still panic. Actually, this function will panic when capacity overflows, so I think comment should be changed to "This will panic if
capacity
is equal to0
or overflows."The text was updated successfully, but these errors were encountered: