If the receiver is gone, send only returns an error once:
use std::sync::mpsc::{channel, SendError};
#[test]
fn doublesend() {
let (tx, _) = channel();
assert_eq!(tx.send(123), Err(SendError(123))); // OK
assert_eq!(tx.send(123), Err(SendError(123))); // Fails - returns success
}
This fails with:
thread 'doublesend' panicked at 'assertion failed:
(left == right)(left:
Ok(()), right:
Err("SendError(..)"))', <anon>:8
It seems like a bug. Is it intended?