Skip to content

Commit 33d175f

Browse files
authored
Rollup merge of rust-lang#47874 - jcowgill:mips-from_raw_os_error, r=dtolnay
std: use more portable error number in from_raw_os_error docs On MIPS, error number 98 is not `EADDRINUSE` (it is `EPROTOTYPE`). To fix the resulting test failure this causes, use a more portable error number in the example documentation. `EINVAL` shold be more reliable because it was defined in the original Unix as 22 so hopefully most derivatives have defined it the same way.
2 parents c66c6b7 + e9d7041 commit 33d175f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libstd/io/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ impl Error {
292292
/// # if cfg!(target_os = "linux") {
293293
/// use std::io;
294294
///
295-
/// let error = io::Error::from_raw_os_error(98);
296-
/// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
295+
/// let error = io::Error::from_raw_os_error(22);
296+
/// assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
297297
/// # }
298298
/// ```
299299
///
@@ -303,8 +303,8 @@ impl Error {
303303
/// # if cfg!(windows) {
304304
/// use std::io;
305305
///
306-
/// let error = io::Error::from_raw_os_error(10048);
307-
/// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
306+
/// let error = io::Error::from_raw_os_error(10022);
307+
/// assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
308308
/// # }
309309
/// ```
310310
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)