loom icon indicating copy to clipboard operation
loom copied to clipboard

Sending on closed channel causes "Messages leaked" error

Open faern opened this issue 5 years ago • 0 comments

#[test]
fn send_on_closed_channel() {
    loom::model(|| {
        let (sender, receiver) = loom::sync::mpsc::channel();
        std::mem::drop(receiver);
        sender.send(()).unwrap_err();
    })
}

This simple test above fails with:

thread 'send_on_closed_channel' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `1`: Messages leaked', /.../loom/src/rt/mpsc.rs:142:9

Is this correct/intentional? There is no memory leak going on here, the value that fails to be sent is correctly dropped.

EDIT: This happens on 0.3.3 and latest version in git. I have not tried older versions.

faern avatar May 01 '20 21:05 faern