Skip to content

Commit

Permalink
Fix the uds_datagram tests with the latest nightly stdlib
Browse files Browse the repository at this point in the history
io::ErrorKind just replaced most uses of "Other" with "Uncategorized"
and prohibits users from matching on "Uncategorized".  So match on the
errno instead.

rust-lang/rust#85746
  • Loading branch information
asomers committed Jul 10, 2021
1 parent c306bf8 commit e742c5c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tokio/tests/uds_datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit e742c5c

Please sign in to comment.