Skip to content

Commit

Permalink
Enforce non zero capacity for channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Licenser committed Feb 24, 2020
1 parent efab39e commit bd1b4a1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/sync/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ use crate::sync::WakerSet;
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
pub fn channel<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
assert!(cap >= 1);
let channel = Arc::new(Channel::with_capacity(cap));
let s = Sender {
channel: channel.clone(),
Expand Down

0 comments on commit bd1b4a1

Please sign in to comment.