Skip to content

Commit e742c5c

Browse files
committed
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. rust-lang/rust#85746
1 parent c306bf8 commit e742c5c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

tokio/tests/uds_datagram.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,14 @@ async fn try_send_recv_never_block() -> io::Result<()> {
8888

8989
match dgram1.try_send(payload) {
9090
Err(err) => match err.kind() {
91-
io::ErrorKind::WouldBlock | io::ErrorKind::Other => break,
92-
_ => unreachable!("unexpected error {:?}", err),
91+
io::ErrorKind::WouldBlock => break,
92+
_ => {
93+
let errno = err.raw_os_error().expect("Not an errno?");
94+
if errno == libc::ENOBUFS {
95+
break;
96+
}
97+
unreachable!("unexpected error {:?}", err);
98+
}
9399
},
94100
Ok(len) => {
95101
assert_eq!(len, payload.len());
@@ -292,8 +298,14 @@ async fn try_recv_buf_never_block() -> io::Result<()> {
292298

293299
match dgram1.try_send(payload) {
294300
Err(err) => match err.kind() {
295-
io::ErrorKind::WouldBlock | io::ErrorKind::Other => break,
296-
_ => unreachable!("unexpected error {:?}", err),
301+
io::ErrorKind::WouldBlock => break,
302+
_ => {
303+
let errno = err.raw_os_error().expect("Not an errno?");
304+
if errno == libc::ENOBUFS {
305+
break;
306+
}
307+
unreachable!("unexpected error {:?}", err);
308+
}
297309
},
298310
Ok(len) => {
299311
assert_eq!(len, payload.len());

0 commit comments

Comments
 (0)