We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
DISCONNECTED
oneshot::Packet::send
1 parent 5045d4e commit fb90e4cCopy full SHA for fb90e4c
src/libstd/sync/mpsc/mod.rs
@@ -1940,6 +1940,13 @@ mod tests {
1940
// wait for the child thread to exit before we exit
1941
rx2.recv().unwrap();
1942
}
1943
+
1944
+ #[test]
1945
+ fn issue_32114() {
1946
+ let (tx, _) = channel();
1947
+ let _ = tx.send(123);
1948
+ assert_eq!(tx.send(123), Err(SendError(123)));
1949
+ }
1950
1951
1952
#[cfg(all(test, not(target_os = "emscripten")))]
src/libstd/sync/mpsc/oneshot.rs
@@ -113,6 +113,8 @@ impl<T> Packet<T> {
113
// Couldn't send the data, the port hung up first. Return the data
114
// back up the stack.
115
DISCONNECTED => {
116
+ self.state.swap(DISCONNECTED, Ordering::SeqCst);
117
+ self.upgrade = NothingSent;
118
Err(self.data.take().unwrap())
119
120
0 commit comments