From e742c5cb78d6deeaa3ada608ecdb003e46fa6533 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 10 Jul 2021 17:51:10 -0600 Subject: [PATCH 1/2] Fix the uds_datagram tests with the latest nightly stdlib io::ErrorKind just replaced most uses of "Other" with "Uncategorized" and prohibits users from matching on "Uncategorized". So match on the errno instead. https://github.com/rust-lang/rust/pull/85746 --- tokio/tests/uds_datagram.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tokio/tests/uds_datagram.rs b/tokio/tests/uds_datagram.rs index 10314bebf9c..5628a00edf0 100644 --- a/tokio/tests/uds_datagram.rs +++ b/tokio/tests/uds_datagram.rs @@ -88,8 +88,14 @@ async fn try_send_recv_never_block() -> io::Result<()> { match dgram1.try_send(payload) { Err(err) => match err.kind() { - io::ErrorKind::WouldBlock | io::ErrorKind::Other => break, - _ => unreachable!("unexpected error {:?}", err), + io::ErrorKind::WouldBlock => break, + _ => { + let errno = err.raw_os_error().expect("Not an errno?"); + if errno == libc::ENOBUFS { + break; + } + unreachable!("unexpected error {:?}", err); + } }, Ok(len) => { assert_eq!(len, payload.len()); @@ -292,8 +298,14 @@ async fn try_recv_buf_never_block() -> io::Result<()> { match dgram1.try_send(payload) { Err(err) => match err.kind() { - io::ErrorKind::WouldBlock | io::ErrorKind::Other => break, - _ => unreachable!("unexpected error {:?}", err), + io::ErrorKind::WouldBlock => break, + _ => { + let errno = err.raw_os_error().expect("Not an errno?"); + if errno == libc::ENOBUFS { + break; + } + unreachable!("unexpected error {:?}", err); + } }, Ok(len) => { assert_eq!(len, payload.len()); From 383058268e7e18eb84a30a247b27d556f2cf9026 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sun, 11 Jul 2021 07:01:57 -0600 Subject: [PATCH 2/2] Condense the error matching block --- tokio/tests/uds_datagram.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tokio/tests/uds_datagram.rs b/tokio/tests/uds_datagram.rs index 5628a00edf0..4d2846865f5 100644 --- a/tokio/tests/uds_datagram.rs +++ b/tokio/tests/uds_datagram.rs @@ -87,14 +87,11 @@ async fn try_send_recv_never_block() -> io::Result<()> { dgram1.writable().await.unwrap(); match dgram1.try_send(payload) { - Err(err) => match err.kind() { - io::ErrorKind::WouldBlock => break, + Err(err) => match (err.kind(), err.raw_os_error()) { + (io::ErrorKind::WouldBlock, _) => break, + (_, Some(libc::ENOBUFS)) => break, _ => { - let errno = err.raw_os_error().expect("Not an errno?"); - if errno == libc::ENOBUFS { - break; - } - unreachable!("unexpected error {:?}", err); + panic!("unexpected error {:?}", err); } }, Ok(len) => { @@ -297,14 +294,11 @@ async fn try_recv_buf_never_block() -> io::Result<()> { dgram1.writable().await.unwrap(); match dgram1.try_send(payload) { - Err(err) => match err.kind() { - io::ErrorKind::WouldBlock => break, + Err(err) => match (err.kind(), err.raw_os_error()) { + (io::ErrorKind::WouldBlock, _) => break, + (_, Some(libc::ENOBUFS)) => break, _ => { - let errno = err.raw_os_error().expect("Not an errno?"); - if errno == libc::ENOBUFS { - break; - } - unreachable!("unexpected error {:?}", err); + panic!("unexpected error {:?}", err); } }, Ok(len) => {